# Encrypting application source code

**URL:** <https://www.ruby-forum.com/t/encrypting-application-source-code/122077>\
**Category:** Rails\
**Created:** [December 4, 2007, 1:18pm UTC](https://www.ruby-forum.com/t/encrypting-application-source-code/122077 "2007-12-04T13:18:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 4, 2007, 1:18pm UTC](https://www.ruby-forum.com/t/encrypting-application-source-code/122077/1 "2007-12-04T13:18:42Z")

</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](http://www.sphred.com)

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

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 4, 2007, 7:27pm UTC](https://www.ruby-forum.com/t/encrypting-application-source-code/122077/2 "2007-12-04T19:27:21Z")

</div>

On 04 Dec 2007, at 13:17, nas wrote:

> 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.

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:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 4, 2007, 11:47pm UTC](https://www.ruby-forum.com/t/encrypting-application-source-code/122077/3 "2007-12-04T23:47:30Z")

</div>

On Dec 4, 2007 6:17 AM, nas [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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.

–  
Greg D.  
[http://destiney.com/](http://destiney.com/)

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 5, 2007, 11:55am UTC](https://www.ruby-forum.com/t/encrypting-application-source-code/122077/4 "2007-12-05T11:55:30Z")

</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:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 5, 2007, 12:05pm UTC](https://www.ruby-forum.com/t/encrypting-application-source-code/122077/5 "2007-12-05T12:05:29Z")

</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:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 5, 2007, 5:43am UTC](https://www.ruby-forum.com/t/encrypting-application-source-code/122077/6 "2007-12-05T05:43:22Z")

</div>

On Dec 4, 4:17 am, nas [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> conclusion that we should enrypt the Rails application source code and  
> Thanks in advance.
> 
> www.sphred.comhttp://nasir.wordpress.com

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:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [December 5, 2007, 12:07pm UTC](https://www.ruby-forum.com/t/encrypting-application-source-code/122077/7 "2007-12-05T12:07:16Z")

</div>

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

Regards

Nasir
