DECRYPTBYCERT
cryptographic transform or key lookup
What changes
- Input
- plaintext or ciphertext and a key, certificate or passphrase
- Output or change
- ciphertext, plaintext, hash, signature check, or key metadata
- Return type
- varbinary, with a maximum size of 8,000 bytes.
Syntax at a glance
DecryptByCert ( certificate_ID , { 'ciphertext' | @ciphertext } [ , { 'cert_password' | @cert_password } ] )
Work example
Decrypt existing bytes with a certificate in a maintained database design.
Use synthetic data in an isolated database. Follow the existing key hierarchy and keep keys and plaintext out of output.
Check your work Confirm the certificate and private key are available and send plaintext only to an approved caller.
Open Microsoft Learn for full syntax, permissions, and details for your version.