Is the ID of the certificate that is used to protect the symmetric key. cert_ID is int.

cert_password

Is the password that protects the private key of the certificate. Can be NULL if the private key is protected by the database master key. cert_password is varchar.

'ciphertext'

Is the data that was encrypted with the key. ciphertext is varbinary.

@ciphertext

Is a variable of type varbinary that contains data that was encrypted with the key.

add_authenticator

Indicates whether an authenticator was encrypted together with the plaintext. Must be the same value that is passed to EncryptByKey when encrypting the data.Is 1 if an authenticator was used. add_authenticator is int.

@add_authenticator

Indicates whether an authenticator was encrypted together with the plaintext. Must be the same value that is passed to EncryptByKey when encrypting the data.

authenticator

Is the data from which to generate an authenticator. Must match the value that was supplied to EncryptByKey. authenticator is sysname.

@authenticator

Is a variable that contains data from which to generate an authenticator. Must match the value that was supplied to EncryptByKey.

The following example shows how DecryptByKeyAutoCert can be used to simplify code that performs a decryption. This code should be run on an AdventureWorks2008R2 database that does not already have a database master key.