views:

10

answers:

1

I am creating a certificate in one of my databases, which works without a problem. However, when I try to back up that certificate so that I can port it over to another database I receive the following error message:

An error occurred during decryption.

Here's my backup statement:

BACKUP CERTIFICATE test_certs TO FILE = 'C:\test_certs.cer'
WITH PRIVATE KEY (FILE = 'C:\test_certs.pvk',
    ENCRYPTION BY PASSWORD = 'SomePassw0rd',
    DECRYPTION BY PASSWORD = 'SomeOtherPassw0rd')

Just to be safe, I've checked that the server has a C:\ drive with:

EXEC xp_cmdshell 'DIR C:\'

I also confirmed that I could write to the location with:

EXEC xp_cmdshell 'echo test > C:\test.txt'

So, unless the security used by BACKUP CERTIFICATE is different than that for xp_cmdshell (which is entirely possible), it's not an issue with writing to the disk.

Google turned up only a few results and none of them seemed to address this problem. Has anyone else seen this before? Any idea what the issue is?

Thanks!

+1  A: 

Sigh... apparently the DECRYPTION BY PASSWORD (but not the ENCRYPTION BY PASSWORD) must match the ENCRYPTION BY PASSWORD of the CREATE CERTIFICATE command. I'll leave this here in case anyone else in the future has the same brain hiccup that I just did.

Tom H.