Backup Certificate Syntax Trouble

  • Hello,

    I'm trying to execute the following code:

    CREATE CERTIFICATE [CertName]

    ENCRYPTION BY PASSWORD = 'password'

    with subject = 'Certificate Subject'

    GO

    backup certificate CertName to file = 'C:\CertName.cer'

    WITH PRIVATE KEY (encryption by password = 'password');

    GO

    This produces the error:

    Msg 102, Level 15, State 1, Line 2

    Incorrect syntax near 'PRIVATE KEY'.

    According to BOL article at http://msdn.microsoft.com/en-us/library/ms178578.aspx, I've got the correct syntax. I'm not sure what I'm missing here.

    Thanks for any help!

  • Hello,

    The following code works as expected (from BOL):

    BACKUP CERTIFICATE [CertName]

    TO FILE = 'C:\CertName.cer'

    WITH PRIVATE KEY (

    FILE = 'C:\CertName.pvk',

    ENCRYPTION BY PASSWORD='password',

    DECRYPTION BY PASSWORD='password'

    )

    GO

    All three 'WITH PRIVATE KEY' paramaters appear to be required.

    Thanks.

  • Yes, you will need all three parameters.

    Thanks for posting back with what you discovered.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply