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 encrypted data. To do this, it first decrypts a symmetric key with a separate asymmetric key, and then decrypts the encrypted data with the symmetric key extracted in the first "step".
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**.
45
+
The ID of the asymmetric key used to encrypt the symmetric key. *akey_ID*has an **int** data type.
46
46
47
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**.
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
49
50
50
'*ciphertext*'
51
-
Is the data that was encrypted with the key. *ciphertext*is **varbinary**.
51
+
The data encrypted with the key. *ciphertext*has a **varbinary** data type.
52
52
53
53
@ciphertext
54
-
Is a variable of type **varbinary**that contains data that was encrypted with the key.
54
+
A variable of type **varbinary**containing data encrypted with the symmetric key.
55
55
56
56
*add_authenticator*
57
-
Indicates whether an authenticator was encryptedtogether 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**.
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.
58
58
59
59
@add_authenticator
60
-
Indicates whether an authenticator was encryptedtogether with the plaintext. Must be the same value that is passed to EncryptByKey when encrypting the data.
60
+
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 an **int** data type.
61
61
62
62
*authenticator*
63
-
Is the data from which to generate an authenticator. Must match the value that was supplied to EncryptByKey.*authenticator*is **sysname**.
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
64
65
65
@authenticator
66
-
Is a variable that contains data from which to generate an authenticator. Must match the value that was supplied to EncryptByKey.
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
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 both OPEN SYMMETRIC KEY and DecryptByKey. In a single operation, it decrypts a symmetric key and then uses that key to decrypt ciphertext.
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 use of `DECRYPTBYKEYAUTOASYMKEY`to 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