6

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.

2 Answers 2

10

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.

1

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

1
  • 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, 2011 at 23:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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