vb System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter.DecryptKeyExchange类(方法)实例源码

下面列出了vb System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter.DecryptKeyExchange 类(方法)源码代码实例,从而了解它的用法。

作者:VB.NET开发    项目:System.Security.Cryptograph   
Public Sub Receive(ByVal iv() As Byte, ByVal encryptedSessionKey() As Byte, ByVal encryptedMessage() As Byte)

    Using aes = New AesCryptoServiceProvider()

        aes.IV = iv

        ' Decrypt the session key
        Dim keyDeformatter As New RSAOAEPKeyExchangeDeformatter(rsaKey)
        aes.Key = keyDeformatter.DecryptKeyExchange(encryptedSessionKey)

        ' Decrypt the message
        Using plaintext As New MemoryStream()
            Using cs As New CryptoStream(plaintext, aes.CreateDecryptor(), CryptoStreamMode.Write)
                    cs.Write(encryptedMessage, 0, encryptedMessage.Length)
                    cs.Close()

                    Dim message As String = Encoding.UTF8.GetString(plaintext.ToArray())
                    Console.WriteLine(message)
            End Using
        End Using
    End Using

End Sub


问题


面经


文章

微信
公众号

扫码关注公众号