Skip to content

Latest commit

 

History

History
172 lines (150 loc) · 5.2 KB

File metadata and controls

172 lines (150 loc) · 5.2 KB
description Cryptographic Functions (Transact-SQL)
title Cryptographic Functions (Transact-SQL) | Microsoft Docs
ms.custom
ms.date 07/24/2017
ms.prod sql
ms.prod_service database-engine, sql-database
ms.reviewer
ms.technology t-sql
ms.topic reference
dev_langs
TSQL
helpviewer_keywords
functions [SQL Server], cryptographic
crypto functions
cryptography [SQL Server], functions
decryption [SQL Server], functions
security functions
encryption [SQL Server], functions
ms.assetid 0be5626b-5a25-4d8c-9f44-7abbfccf816c
author VanMSFT
ms.author vanto

Cryptographic functions (Transact-SQL)

[!INCLUDE SQL Server SQL Database]

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::: VERIFYSIGNEDBYASMKEY :::column-end::: :::row-end::: :::row::: :::column::: SIGNBYCERT :::column-end::: :::column::: VERIGYSIGNEDBYCERT :::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)