AsymmetricKeyExchangeDeformatter.DecryptKeyExchange(Byte[]) Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Wanneer deze worden overschreven in een afgeleide klasse, extraheert u geheime informatie uit de versleutelde sleuteluitwisselingsgegevens.
public:
abstract cli::array <System::Byte> ^ DecryptKeyExchange(cli::array <System::Byte> ^ rgb);
public abstract byte[] DecryptKeyExchange(byte[] rgb);
abstract member DecryptKeyExchange : byte[] -> byte[]
Public MustOverride Function DecryptKeyExchange (rgb As Byte()) As Byte()
Parameters
- rgb
- Byte[]
De sleuteluitwisselingsgegevens waarin de geheime informatie is verborgen.
Retouren
De geheime informatie die is afgeleid van de sleuteluitwisselingsgegevens.
Voorbeelden
In het volgende codevoorbeeld ziet u hoe u de methode overschrijft voor het DecryptKeyExchange maken van een versleutelde sleuteluitwisseling voor de opgegeven invoergegevens. Dit codevoorbeeld maakt deel uit van een groter voorbeeld voor de AsymmetricKeyExchangeDeformatter klasse.
// Create the encrypted key exchange data from the specified input
// data. This method uses the RSA class only. To
// support additional providers or provide custom decryption logic,
// add logic to this member.
public override byte[] DecryptKeyExchange(byte[] rgbData)
{
byte[] decryptedBytes = null;
if (_rsaKey != null)
{
if (_rsaKey is RSA rsa)
{
decryptedBytes = rsa.Decrypt(rgbData, RSAEncryptionPadding.OaepSHA1);
}
// Add custom decryption logic here.
}
else
{
throw new CryptographicUnexpectedOperationException(
"Cryptography_MissingKey");
}
return decryptedBytes;
}
' Create the encrypted key exchange data from the specified input
' data. This method uses the RSA class only. To
' support additional providers or provide custom decryption logic,
' add logic to this member.
Public Overrides Function DecryptKeyExchange(
ByVal rgbData() As Byte) As Byte()
Dim decryptedBytes() As Byte
If (Not rsaKey Is Nothing) Then
If (TypeOf (rsaKey) Is RSA) Then
Dim rsa As RSA
rsa = CType(rsaKey, RSA)
decryptedBytes = rsa.Decrypt(rgbData, RSAEncryptionPadding.OaepSHA1)
End If
' Add custom decryption logic here.
Else
Throw New CryptographicUnexpectedOperationException(
"Cryptography_MissingKey")
End If
Return decryptedBytes
End Function
Opmerkingen
U moet een sleutel opgeven voordat u een implementatie van deze methode aanroept.