SignByCert (Transact-SQL)
Signs text with a certificate and returns the signature.
Syntax
SignByCert( certificate_ID, @cleartext [,'password' ] )
Arguments
- certificate_ID
The ID of a certificate in the current database. int.
- @cleartext
A variable of type nvarchar, char, varchar, or nchar containing data that will be signed.
- 'password'
The password with which the certificate's private key was encrypted. nvarchar(128).
Return Types
varbinary with a maximum size of 8,000 bytes.
Remarks
Requires CONTROL permission on the certificate.
Examples
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
See Also
Reference
VerifySignedByCert (Transact-SQL)
Cert_ID (Transact-SQL)
CREATE CERTIFICATE (Transact-SQL)
ALTER CERTIFICATE (Transact-SQL)
DROP CERTIFICATE (Transact-SQL)