# Encrypting application source code

**URL:** <https://discuss.rubyonrails.org/t/encrypting-application-source-code/21222>\
**Category:** rubyonrails-talk\
**Created:** [December 4, 2007, 12:17pm UTC](https://discuss.rubyonrails.org/t/encrypting-application-source-code/21222 "2007-12-04T12:17:45Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nasir\_Jamal](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nasir\_Jamal](https://discuss.rubyonrails.org/u/Nasir_Jamal)\
**Post date:** [December 4, 2007, 12:17pm UTC](https://discuss.rubyonrails.org/t/encrypting-application-source-code/21222/1 "2007-12-04T12:17:45Z")

</div>

Hi,

I would like to secure my Rails app source code because we have a complex application and we install it on our customer sites.

It is in our company's best interest to keep the source code secure since we have invested a great amount of time and research in developing the logic/algorithm behind the application.

We evaluated several options (like Rubyscript2exe, etc) and came to a conclusion that we should enrypt the Rails application source code and which can be decrypted on the fly to serve application. This will not allow anyone to look at the code even if the application is running or if someone get hold of a copy of our source code.

I looked around but couldn't find anything that can do something like this, ie encryption and decryption of source code something what ZendGuard does for PHP.

I would appreciate if you have any suggestions or ideas on this.

Thanks in advance.

www.sphred.com

> **[Nasir Jamal](https://nasir.wordpress.com)**
>
> on ruby, rails and other stuff

---

<div class="post-metadata">

**Author:** ![Peter\_De\_Berdt](https://avatars.discourse-cdn.com/v4/letter/p/53a042/32.png) [@Peter\_De\_Berdt](https://discuss.rubyonrails.org/u/Peter_De_Berdt)\
**Post date:** [December 4, 2007, 6:26pm UTC](https://discuss.rubyonrails.org/t/encrypting-application-source-code/21222/2 "2007-12-04T18:26:04Z")

</div>

Good luck waiting for a bytecompiler for ruby, might take a long while though. A good contract or a preconfigured and inaccessible servers are your best option.

Best regards

Peter De Berdt

---

<div class="post-metadata">

**Author:** ![Greg\_Donald1](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/greg_donald1/32/1313_2.png) [@Greg\_Donald1](https://discuss.rubyonrails.org/u/Greg_Donald1)\
**Post date:** [December 4, 2007, 10:46pm UTC](https://discuss.rubyonrails.org/t/encrypting-application-source-code/21222/3 "2007-12-04T22:46:28Z")

</div>

> I looked around but couldn't find anything that can do something like this, ie encryption and decryption of source code something what ZendGuard does for PHP.

First, it's not encryption. It's byte-code compilation (much like what you get when using a caching mechanism such as APC).

Second, it can be reversed very easily:

> **[QInvent.com is for sale | HugeDomains](https://www.hugedomains.com/domain_profile.cfm?d=qinvent.com)**
>
> This domain is for sale! Fast and easy shopping. Trusted and secure since 2005.

Looks like this one app supports reversing all current PHP "protection" rackets.

> I would appreciate if you have any suggestions or ideas on this.

If you want 100% secure code.. put the code on your server, then unplug the server from the wall.

---

<div class="post-metadata">

**Author:** ![Gene\_Tani](https://avatars.discourse-cdn.com/v4/letter/g/4491bb/32.png) [@Gene\_Tani](https://discuss.rubyonrails.org/u/Gene_Tani)\
**Post date:** [December 5, 2007, 4:42am UTC](https://discuss.rubyonrails.org/t/encrypting-application-source-code/21222/4 "2007-12-05T04:42:46Z")

</div>

you can look at zenobfuscate . You can also read the dozens of threads people have discussed this exact issue in.

also, how mingle does it:

> **[Mingle on JRuby – How it’s deployed](https://kiyo.wordpress.com/2007/08/21/mingle-on-jruby-how-its-deployed/)**
>
> Time to Mingle… Originally uploaded by l. argos I installed ThoughtWorks Studios’ Mingle (Early Access Windows Version) a few weeks ago. I was interested in Mingle only because it runs …

---

<div class="post-metadata">

**Author:** ![Nasir\_Jamal](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nasir\_Jamal](https://discuss.rubyonrails.org/u/Nasir_Jamal)\
**Post date:** [December 5, 2007, 10:45am UTC](https://discuss.rubyonrails.org/t/encrypting-application-source-code/21222/5 "2007-12-05T10:45:41Z")

</div>

Thanks for the reply Peter.

We thought about the contract and inaccessible servers but unfortunately that is not a viable solution for us.

Regards

Nasir

---

<div class="post-metadata">

**Author:** ![Nasir\_Jamal](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nasir\_Jamal](https://discuss.rubyonrails.org/u/Nasir_Jamal)\
**Post date:** [December 5, 2007, 11:04am UTC](https://discuss.rubyonrails.org/t/encrypting-application-source-code/21222/6 "2007-12-05T11:04:33Z")

</div>

Thanks for correcting me Greg about byte-code compilation.

I will put forward a very simple analogy here for your second point.

We all know that anyone can break into our house but we still lock it before leaving our doorstep. Infact some of us take more than one measure to make sure that the stuff in our house is secure and also to feel secure.

So I imagine that my company's first step to do something like above is not that bad a choice.

However, I never mentioned 100% secure code but I guess that was a great suggestion. I am sure you must have tried that in the past, did that work? ;o) I think we all would like to know how did you get that working ;o)

Anyway thanks for replying.

Regards

Nasir

---

<div class="post-metadata">

**Author:** ![Nasir\_Jamal](https://avatars.discourse-cdn.com/v4/letter/n/e8c25b/32.png) [@Nasir\_Jamal](https://discuss.rubyonrails.org/u/Nasir_Jamal)\
**Post date:** [December 5, 2007, 11:06am UTC](https://discuss.rubyonrails.org/t/encrypting-application-source-code/21222/7 "2007-12-05T11:06:41Z")

</div>

Thanks for the link gene. I will look at zenobfuscate and the mingle link.

Regards

Nasir
