Re: Setting Encryption to 1000 Stored procedures

From: Erland Sommarskog (sommar@algonet.se)
Date: 07/26/02


From: Erland Sommarskog <sommar@algonet.se>
Date: Thu, 25 Jul 2002 22:08:04 +0000 (UTC)


[posted and mailed, please reply in news]

Germán Cabrera H. (gcabrera@pulsar.cl) writes:
> I have about 1000 stored procedures in my db and I wont to modify all of
> them to include "with encryption".
>
> I have tried to form the sentence: "ALTER PROC " + @PROCNAME + " WITH
> ENCRYPCION AS " + @PROCTEXT

Well you need to consider the parameters too.
 
> My problem is to form @PROCTEXT. I have tried using sp_helptext, with no
> good results.

If you don't have your stored procedures on disk and under the version
control, this is the time to do.Script the objects from enterprise manager;
I believe that you can get one object per file. Then again, for the task of
adding WITH ENCRYPTION, it may be simpler to have all in one file.

You need to use some good script language do this: find CREATE/ALTER
PROCEDURE, and then get the through the parameter list until you find
AS. Beware if that there is a WITH RECOMPILE, you should add
", ENCRYPTION", that is not another WITH.

Once your through with that exercise, it will be a much simpler task to
split the big file in one per SQL object, and check in to the version-
control system of your choice.

Note also that if you start to change procedures in SQL Server without
saving them to disk, YOU WILL NOT BE ABLE TO ACCESS YOUR CODE, once
you got that WITH ENCRYPTION in place; all you will see "procedure has
been encrypted".

-- 
Erland Sommarskog, SQL Server MVP
sommar@algonet.se
Books Online (updated!) for SQL 2000 at
http://www.microsoft.com/sql/techinfo/productdoc/2000/books.asp


Relevant Pages

  • Re: Preventing access to Process Info
    ... I seem to be running into more and more vendor packages that encrypt their ... Info" tool or sp_who-like stored procedures. ... Is there a way to do this (SQL Server ... Not that it is encryption, it is obfustication, and anyone ...
    (microsoft.public.sqlserver.security)
  • Re: SP Source Control Options
    ... > relies heavily on Stored Procedures on SQL 7. ... > What options are there to implementing Source Control on ... Script them out of SQL Server, ... control system. ...
    (microsoft.public.sqlserver.security)
  • Re: SP Source Control Options
    ... > relies heavily on Stored Procedures on SQL 7. ... > What options are there to implementing Source Control on ... Script them out of SQL Server, ... control system. ...
    (microsoft.public.sqlserver.security)
  • RE: SQL stored procedures encryption strength
    ... I was wondering how secure is the encryption used for stored procedures in SQL Server 2000. ...
    (Security-Basics)
  • Re: Encrypting Stored Procedures - Production Support
    ... SQL Server's encryption is easy to crack... ... The illusion of security is probably more dangerous than being ... >> Just wondering if encrypting stored procedures would make production ...
    (microsoft.public.sqlserver.programming)