RSACryptoServiceProvider.ExportParameters(Boolean) メソッド

定義

RSAParameters をエクスポートします。Exports the RSAParameters.

public:
 override System::Security::Cryptography::RSAParameters ExportParameters(bool includePrivateParameters);
public override System.Security.Cryptography.RSAParameters ExportParameters (bool includePrivateParameters);
override this.ExportParameters : bool -> System.Security.Cryptography.RSAParameters
Public Overrides Function ExportParameters (includePrivateParameters As Boolean) As RSAParameters

パラメーター

includePrivateParameters
Boolean

プライベート パラメーターを含める場合は true。それ以外の場合は falsetrue to include private parameters; otherwise, false.

戻り値

RSA のパラメーター。The parameters for RSA.

例外

キーをエクスポートできません。The key cannot be exported.

次のコード例では、 RSACryptoServiceProviderを使用して作成されたキー情報をRSAParametersオブジェクトにエクスポートします。The following code example exports the key information created using the RSACryptoServiceProvider into an RSAParameters object.

try
{
   //Create a new RSACryptoServiceProvider Object*.
   RSACryptoServiceProvider^ RSA = gcnew 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 );
}
catch ( CryptographicException^ e ) 
{
   //Catch this exception in case the encryption did
   //not succeed.
   Console::WriteLine( e->Message );
}
try
{
    //Create a new RSACryptoServiceProvider object.
    using (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);
    }


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

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


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

セキュリティ

KeyContainerPermissionAccessEntryCollection
キーをエクスポートする権限。for permission to export a key. セキュリティアクション: DemandSecurity action: Demand. 関連付けられた列挙型:ExportAssociated enumeration: Export

適用対象

こちらもご覧ください