| description | SIGNBYCERT (Transact-SQL) | |||||||
|---|---|---|---|---|---|---|---|---|
| title | SIGNBYCERT (Transact-SQL) | Microsoft Docs | |||||||
| ms.custom | ||||||||
| ms.date | 03/06/2017 | |||||||
| ms.prod | sql | |||||||
| ms.prod_service | database-engine, sql-database | |||||||
| ms.reviewer | ||||||||
| ms.technology | t-sql | |||||||
| ms.topic | reference | |||||||
| f1_keywords |
|
|||||||
| dev_langs |
|
|||||||
| helpviewer_keywords |
|
|||||||
| ms.assetid | b4c6bced-4473-4bae-85b9-56deced495f9 | |||||||
| author | VanMSFT | |||||||
| ms.author | vanto |
[!INCLUDE SQL Server SQL Database]
Signs text with a certificate and returns the signature.
Transact-SQL Syntax Conventions
SignByCert ( certificate_ID , @cleartext [ , 'password' ] )
[!INCLUDEsql-server-tsql-previous-offline-documentation]
certificate_ID
Is the ID of a certificate in the current database. certificate_ID is int.
@cleartext
Is a variable of type nvarchar, char, varchar, or nchar that contains data that will be signed.
' password '
Is the password with which the certificate's private key was encrypted. password is nvarchar(128).
varbinary with a maximum size of 8,000 bytes.
Requires CONTROL permission on the certificate.
The following example signs the text in @SensitiveData with certificate ABerglundCert07, having first decrypted the certificate with password "pGFD4bb925DGvbd2439587y". It then inserts the cleartext and the signature in table SignedData04.
DECLARE @SensitiveData NVARCHAR(max);
SET @SensitiveData = N'Saddle Price Points are
2, 3, 5, 7, 11, 13, 17, 19, 23, 29';
INSERT INTO [SignedData04]
VALUES( N'data signed by certificate ''ABerglundCert07''',
@SensitiveData, SignByCert( Cert_Id( 'ABerglundCert07' ),
@SensitiveData, N'pGFD4bb925DGvbd2439587y' ));
GO VERIFYSIGNEDBYCERT (Transact-SQL)
CERT_ID (Transact-SQL)
CREATE CERTIFICATE (Transact-SQL)
ALTER CERTIFICATE (Transact-SQL)
DROP CERTIFICATE (Transact-SQL)
Encryption Hierarchy