EncryptedXml.DecryptKey Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Decrypts an <EncryptedKey>
element.
Overloads
DecryptKey(Byte[], SymmetricAlgorithm) |
Decrypts an |
DecryptKey(Byte[], RSA, Boolean) |
Decrypts an |
Remarks
Use the DecryptKey method to decrypt an <EncryptedKey>
element and retrieve the key used to decrypt that element.
DecryptKey(Byte[], SymmetricAlgorithm)
- Source:
- EncryptedXml.cs
- Source:
- EncryptedXml.cs
- Source:
- EncryptedXml.cs
- Source:
- EncryptedXml.cs
- Source:
- EncryptedXml.cs
Decrypts an <EncryptedKey>
element using a symmetric algorithm.
public:
static cli::array <System::Byte> ^ DecryptKey(cli::array <System::Byte> ^ keyData, System::Security::Cryptography::SymmetricAlgorithm ^ symmetricAlgorithm);
public static byte[] DecryptKey (byte[] keyData, System.Security.Cryptography.SymmetricAlgorithm symmetricAlgorithm);
static member DecryptKey : byte[] * System.Security.Cryptography.SymmetricAlgorithm -> byte[]
Public Shared Function DecryptKey (keyData As Byte(), symmetricAlgorithm As SymmetricAlgorithm) As Byte()
Parameters
- keyData
- Byte[]
An array of bytes that represents an encrypted <EncryptedKey>
element.
- symmetricAlgorithm
- SymmetricAlgorithm
The symmetric key used to decrypt keyData
.
Returns
A byte array that contains the plain text key.
Exceptions
The value of the keyData
parameter is null
.
-or-
The value of the symmetricAlgorithm
parameter is null
.
The value of the symmetricAlgorithm
element is not the Triple DES Key Wrap algorithm or the Advanced Encryption Standard (AES) Key Wrap algorithm (also called Rijndael).
Remarks
The DecryptKey method decrypts an encrypted key contained within the <EncryptedKey>
element of an XML document. This method accepts a value for the symmetricAlgorithm
parameter that represents either the Triple DES algorithm or the AES key wrap algorithm (also called Rijndael).
Applies to
DecryptKey(Byte[], RSA, Boolean)
- Source:
- EncryptedXml.cs
- Source:
- EncryptedXml.cs
- Source:
- EncryptedXml.cs
- Source:
- EncryptedXml.cs
- Source:
- EncryptedXml.cs
Decrypts an <EncryptedKey>
element using an asymmetric algorithm.
public:
static cli::array <System::Byte> ^ DecryptKey(cli::array <System::Byte> ^ keyData, System::Security::Cryptography::RSA ^ rsa, bool useOAEP);
public static byte[] DecryptKey (byte[] keyData, System.Security.Cryptography.RSA rsa, bool useOAEP);
static member DecryptKey : byte[] * System.Security.Cryptography.RSA * bool -> byte[]
Public Shared Function DecryptKey (keyData As Byte(), rsa As RSA, useOAEP As Boolean) As Byte()
Parameters
- keyData
- Byte[]
An array of bytes that represents an encrypted <EncryptedKey>
element.
- rsa
- RSA
The asymmetric key used to decrypt keyData
.
- useOAEP
- Boolean
A value that specifies whether to use Optimal Asymmetric Encryption Padding (OAEP).
Returns
A byte array that contains the plain text key.
Exceptions
The value of the keyData
parameter is null
.
-or-
The value of the rsa
parameter is null
.
Remarks
The DecryptKey method decrypts an encrypted key contained within the <EncryptedKey>
element of an XML document. This method accepts a value for the rsa
parameter that represents either the RSA PKCS#1 v1.5 algorithm or the RSA PKCS#1 type 2 algorithm (also called OAEP padding).