AsymmetricKeyExchangeDeformatter.DecryptKeyExchange(Byte[]) 메서드

정의

파생 클래스에서 재정의된 경우 암호화된 키 교환 데이터에서 비밀 정보를 추출합니다.

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()

매개 변수

rgb
Byte[]

비밀 정보가 숨겨진 키 교환 데이터입니다.

반환

Byte[]

키 교환 데이터에서 파생된 비밀 정보입니다.

예제

다음 코드 예제에서는 메서드를 재정의 DecryptKeyExchange 하여 지정된 입력 데이터에 대한 암호화된 키 교환을 만드는 방법을 보여 줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 AsymmetricKeyExchangeDeformatter 클래스입니다.

// 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 rsa = (RSA)rsaKey;

            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

설명

이 메서드의 구현을 호출하기 전에 키를 지정해야 합니다.

적용 대상

추가 정보