SignByAsymKey(Transact-SQL)
비대칭 키를 사용하여 일반 텍스트에 서명합니다.
구문
SignByAsymKey( Asym_Key_ID , @plaintext [ , 'password' ] )
인수
- Asym_Key_ID
현재 데이터베이스에 있는 비대칭 키의 ID입니다. int.
- @plaintext
비대칭 키로 서명될 데이터가 들어 있는 nvarchar, char, varchar 또는 nchar 유형의 변수입니다.
- password
개인 키를 보호하는 암호입니다. nvarchar(128).
주의
비대칭 키에 대한 CONTROL 권한이 필요합니다.
반환 형식
최대 크기가 8,000바이트인 varbinary
예
1. 비대칭 키로 생성된 서명과 함께 데이터 저장
다음 예에서는 일반 텍스트와 해당 서명을 저장할 SignedData04
테이블을 만듭니다. 그런 다음 테이블에 비대칭 키 PrimeKey
로 서명된 레코드를 삽입합니다. 이 비대칭 키는 먼저 암호 'pGFD4bb925DGvbd2439587y'
를 사용하여 해독해야 합니다.
-- Create a table in which to store the data
CREATE TABLE [SignedData04]( Description nvarchar(max), Data nvarchar(max), DataSignature varbinary(8000) );
GO
-- Store data together with its signature
DECLARE @clear_text_data nvarchar(max);
set @clear_text_data = N'Important numbers 2, 3, 5, 7, 11, 13, 17,
19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79,
83, 89, 97';
INSERT INTO [SignedData04]
VALUES( N'data encrypted by asymmetric key ''PrimeKey''',
@clear_text_data, SignByAsymKey( AsymKey_Id( 'PrimeKey' ),
@clear_text_data, N'pGFD4bb925DGvbd2439587y' ));
GO
참고 항목
참조
AsymKey_ID(Transact-SQL)
VerifySignedByAsmKey(Transact-SQL)
CREATE ASYMMETRIC KEY(Transact-SQL)
ALTER ASYMMETRIC KEY(Transact-SQL)
DROP ASYMMETRIC KEY(Transact-SQL)