RSAOAEPKeyExchangeFormatter.SetKey(AsymmetricAlgorithm) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
設定公鑰用於加密金鑰交換資料。
public:
override void SetKey(System::Security::Cryptography::AsymmetricAlgorithm ^ key);
public override void SetKey(System.Security.Cryptography.AsymmetricAlgorithm key);
override this.SetKey : System.Security.Cryptography.AsymmetricAlgorithm -> unit
Public Overrides Sub SetKey (key As AsymmetricAlgorithm)
參數
持有公鑰的演算法實例 RSA 。
例外狀況
key 是 null。
範例
以下程式碼範例示範如何使用此 SetKey 方法設定 RSA 解密金鑰。 此程式碼範例是本類別更大範例 RSAOAEPKeyExchangeFormatter 的一部分。
RSA key = RSA.Create();
rsaFormatter.SetKey(key);
Dim key As RSA = RSA.Create()
rsaFormatter.SetKey(key)
備註
你必須先設定鑰匙再呼叫 CreateKeyExchange。