次の方法で共有


RSACryptoServiceProvider.ImportParameters メソッド

指定した RSAParameters をインポートします。

Overrides Public Sub ImportParameters( _
   ByVal parameters As RSAParameters _)
[C#]
public override void ImportParameters(RSAParametersparameters);
[C++]
public: void ImportParameters(RSAParametersparameters);
[JScript]
public override function ImportParameters(
   parameters : RSAParameters);

パラメータ

  • parameters
    RSA のパラメータ。

例外

例外の種類 条件
CryptographicException 暗号サービス プロバイダ (CSP) を取得できません。

または

parameters パラメータに欠落しているフィールドがあります。

使用例

 
Try
    'Create a new RSACryptoServiceProvider object. 
    Dim RSA As New RSACryptoServiceProvider()

    'Export the key information to an RSAParameters object.
    'Pass false to export the public key information or pass
    'true to export public and private key information.
    Dim RSAParams As RSAParameters = RSA.ExportParameters(False)

    'Create another RSACryptoServiceProvider object.
    Dim RSA2 As New RSACryptoServiceProvider()

    'Import the the key information from the other 
    'RSACryptoServiceProvider object.  
    RSA2.ImportParameters(RSAParams)


Catch e As CryptographicException
    'Catch this exception in case the encryption did
    'not succeed.
    Console.WriteLine(e.Message)
End Try

[C#] 
try
{
    //Create a new RSACryptoServiceProvider object. 
    RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();

    //Export the key information to an RSAParameters object.
    //Pass false to export the public key information or pass
    //true to export public and private key information.
    RSAParameters RSAParams = RSA.ExportParameters(false);

    //Create another RSACryptoServiceProvider object.
    RSACryptoServiceProvider RSA2 = new RSACryptoServiceProvider();

    //Import the the key information from the other 
    //RSACryptoServiceProvider object.  
    RSA2.ImportParameters(RSAParams);


}
catch(CryptographicException e)
{
    //Catch this exception in case the encryption did
    //not succeed.
    Console.WriteLine(e.Message);

}

[C++] 
try {
    //Create a new RSACryptoServiceProvider object. 
    RSACryptoServiceProvider* RSA = new RSACryptoServiceProvider();

    //Export the key information to an RSAParameters object.
    //Pass false to export the public key information or pass
    //true to export public and private key information.
    RSAParameters RSAParams = RSA->ExportParameters(false);

    //Create another RSACryptoServiceProvider object.
    RSACryptoServiceProvider* RSA2 = new RSACryptoServiceProvider();

    //Import the the key information from the other 
    //RSACryptoServiceProvider object.  
    RSA2->ImportParameters(RSAParams);
} catch (CryptographicException* e) {
    //Catch this exception in case the encryption did
    //not succeed.
    Console::WriteLine(e->Message);
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

RSACryptoServiceProvider クラス | RSACryptoServiceProvider メンバ | System.Security.Cryptography 名前空間 | 暗号サービス