Skip to content

Latest commit

 

History

History
171 lines (149 loc) · 5.1 KB

cryptographic-functions-transact-sql.md

File metadata and controls

171 lines (149 loc) · 5.1 KB
title description author ms.author ms.date ms.service ms.subservice ms.topic ms.custom helpviewer_keywords dev_langs monikerRange
Cryptographic Functions (Transact-SQL)
Cryptographic Functions (Transact-SQL)
VanMSFT
vanto
07/24/2017
sql
t-sql
reference
ignite-2024
functions [SQL Server], cryptographic
crypto functions
cryptography [SQL Server], functions
decryption [SQL Server], functions
security functions
encryption [SQL Server], functions
TSQL
=azuresqldb-current || >=sql-server-2016 || >=sql-server-linux-2017 || =azuresqldb-mi-current || =fabric

Cryptographic functions (Transact-SQL)

[!INCLUDE SQL Server Azure SQL Database Azure SQL Managed Instance FabricSQLDB]

These functions support digital signing, digital signature validation, encryption, and decryption.

Symmetric encryption and decryption

:::row::: :::column::: ENCRYPTBYKEY :::column-end::: :::column::: DECRYPTBYKEY :::column-end::: :::row-end::: :::row::: :::column::: ENCRYPTBYPASSPHRASE :::column-end::: :::column::: DECRYPTBYPASSPHRASE :::column-end::: :::row-end::: :::row::: :::column::: KEY_ID :::column-end::: :::column::: KEY_GUID :::column-end::: :::row-end::: :::row::: :::column::: DECRYPTBYKEYAUTOASYMKEY :::column-end::: :::column::: KEY_NAME :::column-end::: :::row-end::: :::row::: :::column::: SYMKEYPROPERTY :::column-end::: :::column::: :::column-end::: :::row-end:::

 

Asymmetric encryption and decryption

:::row::: :::column::: ENCRYPTBYASYMKEY :::column-end::: :::column::: DECRYPTBYASYMKEY :::column-end::: :::row-end::: :::row::: :::column::: ENCRYPTBYCERT :::column-end::: :::column::: DECRYPTBYCERT :::column-end::: :::row-end::: :::row::: :::column::: ASYMKEYPROPERTY :::column-end::: :::column::: ASYMKEY_ID :::column-end::: :::row-end:::

 

Signing and signature verification

:::row::: :::column::: SIGNBYASYMKEY :::column-end::: :::column::: VERIFYSIGNEDBYASYMKEY :::column-end::: :::row-end::: :::row::: :::column::: SIGNBYCERT :::column-end::: :::column::: VERIFYSIGNEDBYCERT :::column-end::: :::row-end::: :::row::: :::column::: IS_OBJECTSIGNED :::column-end::: :::column::: :::column-end::: :::row-end:::

 

Symmetric decryption, with automatic key handling

:::row::: :::column::: DecryptByKeyAutoCert :::column-end::: :::row-end:::

 

Encryption hashing

:::row::: :::column::: HASHBYTES :::column-end::: :::row-end:::

 

Certificate copying

:::row::: :::column::: CERTENCODED (Transact-SQL) :::column-end::: :::column::: CERTPRIVATEKEY (Transact-SQL) :::column-end::: :::row-end:::

 

See also

Functions
Encryption Hierarchy
Permissions Hierarchy (Database Engine)
CREATE CERTIFICATE (Transact-SQL)
CREATE SYMMETRIC KEY (Transact-SQL)
CREATE ASYMMETRIC KEY (Transact-SQL)
Security Catalog Views (Transact-SQL)