You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Decrypts using a symmetric key that is automatically decrypted using an asymmetric key.
29
+
This function decrypts data with a symmetric key. That symmetric key automatically decrypts with an asymmetric key.
30
30
31
31
[Transact-SQL Syntax Conventions](../../t-sql/language-elements/transact-sql-syntax-conventions-transact-sql.md)
Is the ID of the asymmetric key that is used to protect the symmetric key. *akey_ID*is **int**.
44
+
*akey_ID*
45
+
The ID of the asymmetric key used to encrypt the symmetric key. *akey_ID*has an **int** data type.
46
46
47
-
*akey_password*
48
-
Is the password that protects the private key of the asymmetric key. Can be NULL if the private key is protected by the database master key. *akey_password* is **nvarchar**.
49
-
50
-
'*ciphertext*'
51
-
Is the data that was encrypted with the key. *ciphertext* is **varbinary**.
52
-
53
-
@ciphertext
54
-
Is a variable of type **varbinary** that contains data that was encrypted with the key.
55
-
56
-
*add_authenticator*
57
-
Indicates whether an authenticator was encrypted together with the plaintext. Must be the same value that is passed to EncryptByKey when encrypting the data. Is 1 if an authenticator was used. *add_authenticator* is **int**.
58
-
59
-
@add_authenticator
60
-
Indicates whether an authenticator was encrypted together with the plaintext. Must be the same value that is passed to EncryptByKey when encrypting the data.
47
+
*akey_password*
48
+
The password protecting the asymmetric key. *akey_password* can have a NULL value if the database master key protects the asymmetric private key. *akey_password* has an **nvarchar** data type.
49
+
50
+
*ciphertext*
51
+
The data encrypted with the key. *ciphertext* has a **varbinary** data type.
61
52
62
-
*authenticator*
63
-
Is the data from which to generate an authenticator. Must match the value that was supplied to EncryptByKey. *authenticator* is **sysname**.
53
+
@ciphertext
54
+
A variable of type **varbinary** containing data encrypted with the symmetric key.
64
55
65
-
@authenticator
66
-
Is a variable that contains data from which to generate an authenticator. Must match the value that was supplied to EncryptByKey.
56
+
*add_authenticator*
57
+
Indicates whether the original encryption process included, and encrypted, an authenticator together with the plaintext. Must match the value passed to [ENCRYPTBYKEY (Transact-SQL)](./encryptbykey-transact-sql.md) during the data encryption process. *add_authenticator* has a value of 1 if the encryption process used an authenticator. *add_authenticator* has an **int** data type.
67
58
59
+
@add_authenticator
60
+
A variable indicating whether the original encryption process included, and encrypted, an authenticator together with the plaintext. Must match the value passed to [ENCRYPTBYKEY (Transact-SQL)](./encryptbykey-transact-sql.md) during the data encryption process. *@add_authenticator* has an **int** data type.
61
+
62
+
*authenticator*
63
+
The data used as the basis for the generation of the authenticator. Must match the value supplied to [ENCRYPTBYKEY (Transact-SQL)](./encryptbykey-transact-sql.md). *authenticator* has a **sysname** data type.
64
+
65
+
@authenticator
66
+
A variable containing data from which an authenticator generates. Must match the value supplied to [ENCRYPTBYKEY (Transact-SQL)](./encryptbykey-transact-sql.md). *@authenticator* has a **sysname** data type.
67
+
68
68
## Return Types
69
-
**varbinary** with a maximum size of 8,000 bytes.
69
+
**varbinary**, with a maximum size of 8,000 bytes.
70
70
71
71
## Remarks
72
-
DecryptByKeyAutoAsymKey combines the functionality of OPEN SYMMETRIC KEY and DecryptByKey. In a single operation, it decrypts a symmetric key and uses that key to decrypt ciphertext.
72
+
`DECRYPTBYKEYAUTOASYMKEY`combines the functionality of `OPEN SYMMETRIC KEY` and `DECRYPTBYKEY`. In a single operation, it first decrypts a symmetric key, and then decrypts encrypted ciphertext with that key.
73
73
74
74
## Permissions
75
-
Requires VIEW DEFINITION permission on the symmetric key and CONTROL permission on the asymmetric key.
75
+
Requires `VIEW DEFINITION` permission on the symmetric key, and `CONTROL` permission on the asymmetric key.
76
76
77
77
## Examples
78
-
The following example shows how `DecryptByKeyAutoAsymKey` can be used to simplify code that performs a decryption. This code should be run on an [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] database that does not already have a database master key.
78
+
This example shows how `DECRYPTBYKEYAUTOASYMKEY` can simplify decryption code. This code should run on an [!INCLUDE[ssSampleDBobject](../../includes/sssampledbobject-md.md)] database that does not already have a database master key.
0 commit comments