SQL Encryption - Asymmetric Key - 2nd Server

Posted by Jason Heine on Stack Overflow See other posts from Stack Overflow or by Jason Heine
Published on 2010-05-10T14:26:18Z Indexed on 2010/05/10 23:34 UTC
Read the original article Hit count: 282

Hello,

I created an asymmetric key on one of my SQL servers (2008). I encrypted a password field and I am able to retrieve that password just fine on my development server.

The issue comes into play where I need to move this data to a production server.

Here is the code for the key that was created:

CREATE MASTER KEY ENCRYPTION BY PASSWORD='#########'
CREATE ASYMMETRIC KEY UserEncryptionKey
WITH ALGORITHM = RSA_2048

Now, when I run this on the production server, it creates the key just fine. However, when I run my sproc to get the password, it returns NULL.

SQL:

    SELECT EncryptByAsymKey(AsymKey_ID('UserEncryptionKey'), Password ) 
    FROM Users WHERE UserName = '######'

Any thoughts on what I need to do to get the encrypted field to work on multiple SQL Servers?

Please let me know if I need to clarify something.

Thanks

© Stack Overflow or respective owner

Related posts about sql-server-2008

Related posts about encryption-asymmetric