Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

We have a lot of proprietary database code that is simply encrypted using the "WITH ENCRYPTION" option. Unfortunately, this is a very weak method of securing database code.

Is there any better way to secure the database code?

We're currently on SQL Server 2005, if that helps, but we're in the process of migrating to SQL Server 2008 R2.

share|improve this question

2 Answers 2

up vote 10 down vote accepted

There isn't much you'll be able to do to prevent people from getting access to your code.

If it's encrypted WITH ENCRYPTION it can be decrypted pretty quickly. If you use CLR procedures the T/SQL statements that are executed against the SQL Server can be captured via SQL Profiler very easily. Not to mention many shops don't like SQL CLR and wouldn't bring your app in shop. If you encrypt the procedures via third party code it can still be decrypted pretty easily (if SQL can decrypt the procedures so that it can run them, odds are a user will be able to decrypt it).

Your code should be protected through contracts and NDAs.

Personally when I see an app with encrypted procedures about the first thing I'm going to do is force them to decrypt them. If they won't, I'll do it myself. Most databases out there which come from venders aren't tuned very well, and if I'm going to be tuning the database I'm going to need access to the code.

share|improve this answer

One option would be to write your code using CLR. That way you could prevent users from viewing that.

share|improve this answer
3  
CLR is typically slower than T/SQL for traditional database access, so it isn't a really good replacement for normal T/SQL stored procedures. –  mrdenny Aug 16 '11 at 23:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.