Solved

Storing Data Encrypted in SQL 2K possible?

Posted on 2006-11-24
5
396 Views
Last Modified: 2012-05-05
Hello all.  Here is what I am trying to accomplish.  I can access an external SQL Server which is open just to my specific IP address.  What I want to do is somehow setup a SQL Job to transfer a two field table and store the data encrypted on the external box.  Then in a application I have decrypt the data possibly.  Is there a way in SQL Server to lock down the table and store the data encrypted?   I know I can do this in a application but the problem is we are talking millions of rows I need to transfer on a weekly basis.
0
Comment
Question by:sbornstein2
  • 3
  • 2
5 Comments
 
LVL 75

Accepted Solution

by:
Aneesh Retnakaran earned 250 total points
ID: 18006333
You can try the LetLib Encriptioniser (www.netlib.com) or xpcrypt (www.xp_crypt.com)
0
 

Author Comment

by:sbornstein2
ID: 18006354
Well this is what I am hoping to do.  I want to run a DTS transfer of data every week.  After the data gets inserted into my table,  is there a way to just run a stored procedure to encrypt the data and then have the key external that we can use in our apps to decrypt the data?   Then after the DTS Transfer the next step in the job would be to run the stored proc to encrypt it?  I really only need to do this to one field and its not like credit card data or anything.
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18006395
OK, You can write ur own encryption and the  decryption algorithm or can use any of the above.
0
 

Author Comment

by:sbornstein2
ID: 18011746
thanks anees I will check out xpcrypt
0
 
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18011762
Here is an example on how to use this , u need to install the s/w first, and then u can create the following functions (if you want)

CREATE FUNCTION MyEncrypt  (@src varchar (32) , @password varchar (32)) RETURNS varchar(100) AS BEGIN
     declare @out varchar(100)
     exec master..xp_aes128_encrypt @src,@password,@out output
     return @out
END
go


CREATE FUNCTION MyDecrypt  (@src varchar (100), @password varchar (32)) RETURNS varchar(32) AS BEGIN
     declare @out varchar(32)
     exec master..xp_aes128_decrypt @src,@password,@out output
     return @out
END

That's all.

Now encrypt whole column use:

update SecretTable set creditcard = dbo.MyEncrypt(creditcard,'password')

Insert SecretTable (name,creditcard) values
(dbo.MyEncrypt('Aneesh','password'),dbo.MyEncrypt('123407234987545','password'))

To select use :

select dbo.MyDecrypt(name,'password'),dbo.MyDecrypt(creditcard,'password') where name= dbo.MyEncrypt('Aneesh','password')
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Truncate vs Delete 63 87
Move SQL 2005 Express to Server 2012R2 19 72
how to fix this error 14 46
Numeric sequence in SQL 14 37
Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now