Re: Any script to encrypt the all SPs and Views in one go

From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 06/15/04


Date: Tue, 15 Jun 2004 15:56:10 -0400

I don't think there is a simple way to do this. You could try to do it in a
T-SQL cursor (e.g. SELECT ROUTINE_DEFINITION FROM
INFORMATION_SCHEMA.ROUTINES), but you will be faced with many obstacles:

(a) you won't easily be able to tell where to add the "WITH ENCRYPTION"
text. Since some procedures might start with AS / BEGIN, have varying
layouts for parameters, etc. You can't just replace "dbo.procedurename"
with "dbo.procedurename with encryption" because it might be mentioned in
other places in the code.

(b) if the procedure or view is > 8000 characters, you won't be able to
automate re-creation, because it will come back as multiple rows.

(c) automated script reproduction will be further troubled by stored
procedures that use EXEC() or other things that require nested quotes,
nested double-quotes, etc. It will take a lot of REPLACE() work and trial
and error to produce another script which can be run in an automated
fashion.

(d) I'm sure there are others I'm not thinking of.

What you should consider doing is generating a drop/create script for all
procedures and all views, manually edit them to say WITH ENCRYPTION, and
send them that script.

Also, be aware that a 2-second google search will yield a script that will
decrypt these objects, so the current implementation for encrypting objects
within SQL Server will only stop the casual observer.

-- 
http://www.aspfaq.com/
(Reverse address to reply.)
"Rayan Yellina" <ryellina@hotmail.com> wrote in message
news:1cd7401c45300$f456c850$a401280a@phx.gbl...
> Hi,
>    Is there any script to encrypt all the stored procs and
> views from the database, instead of Altering them
> with "WITH ENCRYPTION" manually for each and every Stored
> proc and view.
> The situation is, until now we never encrypted any views
> or stored procs for our clients, but from now onwards we
> have to encrypt them. What is the fastest or proper way to
> do it. We do not have access to our client databases, so
> we have to mail a CD with our scripts and they can run it.
> That is why I am asking that whether there is an
> usual/common way of doing this. Any work-arounds or your
> experiences of doing this. Thank you very much.
> -Rayan


Relevant Pages

  • Re: Any script to encrypt the all SPs and Views in one go
    ... put "WITH ENCRYPTION" in comments when ... >automate re-creation, because it will come back as ... >automated script reproduction will be further ... >> Is there any script to encrypt all the stored procs ...
    (microsoft.public.sqlserver.programming)
  • Voynich script.
    ... Also there was a mention about mysterious Voynich script. ... The second principle were pictures always people tend to make as much signs as many letters ... what you see is an inferior data stream, which resemble normal. ... And also there are some words which are looking as sort of "vocabularies" for this encryption. ...
    (sci.lang)
  • Voynich script.
    ... Also there was a mention about mysterious Voynich script. ... The second principle were pictures always people tend to make as much signs as many letters ... what you see is an inferior data stream, which resemble normal. ... And also there are some words which are looking as sort of "vocabularies" for this encryption. ...
    (sci.misc)
  • Re: Protecting Source code of a perl script
    ... > administrator could crack the encryption with only a day's work. ... Running 'strings' may yield vital information ... contained in the script turned binary. ... of the script to *hide* the code is a weak way to *protect* the code. ...
    (comp.lang.perl.misc)
  • php to perl translation
    ... I need the result of this script to store the password in out LDAP database in the oracle hashed format. ... The mcrypt functions should be used. ... // Using thirdparty library for DES with CBC encryption ... Concatenate the username and the password to produce a plaintext string; ...
    (perl.beginners)