次の方法で共有


DSACryptoServiceProvider.ImportParameters メソッド

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

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

パラメータ

  • parameters
    DSA のパラメータ。

例外

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

または

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

使用例

 
Try
    'Create a new DSACryptoServiceProvider object. 
    Dim DSA As New DSACryptoServiceProvider()

    'Export the key information to a DSAParameters object.
    'Pass false to export the public key information or pass
    'true to export public and private key information.
    Dim DSAParams As DSAParameters = DSA.ExportParameters(False)

    'Create another DSACryptoServiceProvider object.
    Dim DSA2 As New DSACryptoServiceProvider()

    'Import the the key information from the other 
    'DSACryptoServiceProvider object.  
    DSA2.ImportParameters(DSAParams)


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 DSACryptoServiceProvider object. 
    DSACryptoServiceProvider DSA = new DSACryptoServiceProvider();

    //Export the key information to a DSAParameters object.
    //Pass false to export the public key information or pass
    //true to export public and private key information.
    DSAParameters DSAParams = DSA.ExportParameters(false);

    //Create another DSACryptoServiceProvider object.
    DSACryptoServiceProvider DSA2 = new DSACryptoServiceProvider();

    //Import the the key information from the other 
    //DSACryptoServiceProvider object.  
    DSA2.ImportParameters(DSAParams);


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

}

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

    //Export the key information to a DSAParameters object.
    //Pass false to export the public key information or pass
    //true to export public and private key information.
    DSAParameters DSAParams = DSA->ExportParameters(false);

    //Create another DSACryptoServiceProvider object.
    DSACryptoServiceProvider* DSA2 = new DSACryptoServiceProvider();

    //Import the the key information from the other 
    //DSACryptoServiceProvider Object*.  
    DSA2->ImportParameters(DSAParams);
} 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 ファミリ

参照

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