RSACryptoServiceProvider.ImportParameters(RSAParameters) 메서드

정의

지정된 RSAParameters를 가져옵니다.

public:
 override void ImportParameters(System::Security::Cryptography::RSAParameters parameters);
public override void ImportParameters (System.Security.Cryptography.RSAParameters parameters);
override this.ImportParameters : System.Security.Cryptography.RSAParameters -> unit
Public Overrides Sub ImportParameters (parameters As RSAParameters)

매개 변수

parameters
RSAParameters

RSA에 대한 매개 변수입니다.

예외

CSP(암호화 서비스 공급자)를 가져올 수 없습니다.

또는 parameters 매개 변수에 빠진 필드가 있는 경우

예제

다음 코드 예제에서는 개체에서 RSAParameters 만든 키 정보를 개체로 RSACryptoServiceProvider 가져옵니다.

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 );
   
   //Create another RSACryptoServiceProvider object.
   RSACryptoServiceProvider^ RSA2 = gcnew RSACryptoServiceProvider;
   
   //Import 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 );
}
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);

        //Create another RSACryptoServiceProvider object.
        using (RSACryptoServiceProvider RSA2 = new RSACryptoServiceProvider())
        {
        //Import 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);
}
Try
    'Create a new RSACryptoServiceProvider object. 
    Using 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.
        Using RSA2 As New RSACryptoServiceProvider()

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

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

적용 대상

추가 정보