RSACryptoServiceProvider Classe

Definizione

Esegue la crittografia e la decrittografia asimmetrica usando l'implementazione dell'algoritmo RSA fornito dal provider del servizio di crittografia (CSP). La classe non può essere ereditata.

public ref class RSACryptoServiceProvider sealed : System::Security::Cryptography::RSA, System::Security::Cryptography::ICspAsymmetricAlgorithm
public ref class RSACryptoServiceProvider sealed : System::Security::Cryptography::RSA
public sealed class RSACryptoServiceProvider : System.Security.Cryptography.RSA, System.Security.Cryptography.ICspAsymmetricAlgorithm
public sealed class RSACryptoServiceProvider : System.Security.Cryptography.RSA
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class RSACryptoServiceProvider : System.Security.Cryptography.RSA, System.Security.Cryptography.ICspAsymmetricAlgorithm
type RSACryptoServiceProvider = class
    inherit RSA
    interface ICspAsymmetricAlgorithm
type RSACryptoServiceProvider = class
    inherit RSA
[<System.Runtime.InteropServices.ComVisible(true)>]
type RSACryptoServiceProvider = class
    inherit RSA
    interface ICspAsymmetricAlgorithm
Public NotInheritable Class RSACryptoServiceProvider
Inherits RSA
Implements ICspAsymmetricAlgorithm
Public NotInheritable Class RSACryptoServiceProvider
Inherits RSA
Ereditarietà
RSACryptoServiceProvider
Attributi
Implementazioni

Esempio

Nell'esempio di codice seguente viene usata la RSACryptoServiceProvider classe per crittografare una stringa in una matrice di byte e quindi decrittografare i byte in una stringa.

using namespace System;
using namespace System::Security::Cryptography;
using namespace System::Text;
array<Byte>^ RSAEncrypt( array<Byte>^DataToEncrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding )
{
   try
   {
      
      //Create a new instance of RSACryptoServiceProvider.
      RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider;
      
      //Import the RSA Key information. This only needs
      //toinclude the public key information.
      RSA->ImportParameters( RSAKeyInfo );
      
      //Encrypt the passed byte array and specify OAEP padding.  
      //OAEP padding is only available on Microsoft Windows XP or
      //later.  

      array<Byte>^encryptedData = RSA->Encrypt( DataToEncrypt, DoOAEPPadding );
      delete RSA;
      return encryptedData;
   }
   //Catch and display a CryptographicException  
   //to the console.
   catch ( CryptographicException^ e ) 
   {
      Console::WriteLine( e->Message );
      return nullptr;
   }

}

array<Byte>^ RSADecrypt( array<Byte>^DataToDecrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding )
{
   try
   {
      
      //Create a new instance of RSACryptoServiceProvider.
      RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider;
      
      //Import the RSA Key information. This needs
      //to include the private key information.
      RSA->ImportParameters( RSAKeyInfo );
      
      //Decrypt the passed byte array and specify OAEP padding.  
      //OAEP padding is only available on Microsoft Windows XP or
      //later.  
      
      array<Byte>^decryptedData = RSA->Decrypt( DataToDecrypt, DoOAEPPadding );
      delete RSA;
      return decryptedData;
   }
   //Catch and display a CryptographicException  
   //to the console.
   catch ( CryptographicException^ e ) 
   {
      Console::WriteLine( e );
      return nullptr;
   }

}

int main()
{
   try
   {
      
      //Create a UnicodeEncoder to convert between byte array and string.
      UnicodeEncoding^ ByteConverter = gcnew UnicodeEncoding;
      
      //Create byte arrays to hold original, encrypted, and decrypted data.
      array<Byte>^dataToEncrypt = ByteConverter->GetBytes( "Data to Encrypt" );
      array<Byte>^encryptedData;
      array<Byte>^decryptedData;
      
      //Create a new instance of RSACryptoServiceProvider to generate
      //public and private key data.
      RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider;
      
      //Pass the data to ENCRYPT, the public key information 
      //(using RSACryptoServiceProvider.ExportParameters(false),
      //and a boolean flag specifying no OAEP padding.
      encryptedData = RSAEncrypt( dataToEncrypt, RSA->ExportParameters( false ), false );
      
      //Pass the data to DECRYPT, the private key information 
      //(using RSACryptoServiceProvider.ExportParameters(true),
      //and a boolean flag specifying no OAEP padding.
      decryptedData = RSADecrypt( encryptedData, RSA->ExportParameters( true ), false );
      
      //Display the decrypted plaintext to the console. 
      Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) );
      delete RSA;
   }
   catch ( ArgumentNullException^ ) 
   {
      
      //Catch this exception in case the encryption did
      //not succeed.
      Console::WriteLine( "Encryption failed." );
   }

}
using System;
using System.Security.Cryptography;
using System.Text;

class RSACSPSample
{

    static void Main()
    {
        try
        {
            //Create a UnicodeEncoder to convert between byte array and string.
            UnicodeEncoding ByteConverter = new UnicodeEncoding();

            //Create byte arrays to hold original, encrypted, and decrypted data.
            byte[] dataToEncrypt = ByteConverter.GetBytes("Data to Encrypt");
            byte[] encryptedData;
            byte[] decryptedData;

            //Create a new instance of RSACryptoServiceProvider to generate
            //public and private key data.
            using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider())
            {

                //Pass the data to ENCRYPT, the public key information 
                //(using RSACryptoServiceProvider.ExportParameters(false),
                //and a boolean flag specifying no OAEP padding.
                encryptedData = RSAEncrypt(dataToEncrypt, RSA.ExportParameters(false), false);

                //Pass the data to DECRYPT, the private key information 
                //(using RSACryptoServiceProvider.ExportParameters(true),
                //and a boolean flag specifying no OAEP padding.
                decryptedData = RSADecrypt(encryptedData, RSA.ExportParameters(true), false);

                //Display the decrypted plaintext to the console. 
                Console.WriteLine("Decrypted plaintext: {0}", ByteConverter.GetString(decryptedData));
            }
        }
        catch (ArgumentNullException)
        {
            //Catch this exception in case the encryption did
            //not succeed.
            Console.WriteLine("Encryption failed.");
        }
    }

    public static byte[] RSAEncrypt(byte[] DataToEncrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding)
    {
        try
        {
            byte[] encryptedData;
            //Create a new instance of RSACryptoServiceProvider.
            using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider())
            {

                //Import the RSA Key information. This only needs
                //to include the public key information.
                RSA.ImportParameters(RSAKeyInfo);

                //Encrypt the passed byte array and specify OAEP padding.  
                //OAEP padding is only available on Microsoft Windows XP or
                //later.  
                encryptedData = RSA.Encrypt(DataToEncrypt, DoOAEPPadding);
            }
            return encryptedData;
        }
        //Catch and display a CryptographicException  
        //to the console.
        catch (CryptographicException e)
        {
            Console.WriteLine(e.Message);

            return null;
        }
    }

    public static byte[] RSADecrypt(byte[] DataToDecrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding)
    {
        try
        {
            byte[] decryptedData;
            //Create a new instance of RSACryptoServiceProvider.
            using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider())
            {
                //Import the RSA Key information. This needs
                //to include the private key information.
                RSA.ImportParameters(RSAKeyInfo);

                //Decrypt the passed byte array and specify OAEP padding.  
                //OAEP padding is only available on Microsoft Windows XP or
                //later.  
                decryptedData = RSA.Decrypt(DataToDecrypt, DoOAEPPadding);
            }
            return decryptedData;
        }
        //Catch and display a CryptographicException  
        //to the console.
        catch (CryptographicException e)
        {
            Console.WriteLine(e.ToString());

            return null;
        }
    }
}
Imports System.Security.Cryptography
Imports System.Text

 _

Class RSACSPSample


    Shared Sub Main()
        Try
            'Create a UnicodeEncoder to convert between byte array and string.
            Dim ByteConverter As New UnicodeEncoding()

            'Create byte arrays to hold original, encrypted, and decrypted data.
            Dim dataToEncrypt As Byte() = ByteConverter.GetBytes("Data to Encrypt")
            Dim encryptedData() As Byte
            Dim decryptedData() As Byte

            'Create a new instance of RSACryptoServiceProvider to generate
            'public and private key data.
            Using RSA As New RSACryptoServiceProvider

                'Pass the data to ENCRYPT, the public key information 
                '(using RSACryptoServiceProvider.ExportParameters(false),
                'and a boolean flag specifying no OAEP padding.
                encryptedData = RSAEncrypt(dataToEncrypt, RSA.ExportParameters(False), False)

                'Pass the data to DECRYPT, the private key information 
                '(using RSACryptoServiceProvider.ExportParameters(true),
                'and a boolean flag specifying no OAEP padding.
                decryptedData = RSADecrypt(encryptedData, RSA.ExportParameters(True), False)

                'Display the decrypted plaintext to the console. 
                Console.WriteLine("Decrypted plaintext: {0}", ByteConverter.GetString(decryptedData))
            End Using
        Catch e As ArgumentNullException
            'Catch this exception in case the encryption did
            'not succeed.
            Console.WriteLine("Encryption failed.")
        End Try
    End Sub


    Public Shared Function RSAEncrypt(ByVal DataToEncrypt() As Byte, ByVal RSAKeyInfo As RSAParameters, ByVal DoOAEPPadding As Boolean) As Byte()
        Try
            Dim encryptedData() As Byte
            'Create a new instance of RSACryptoServiceProvider.
            Using RSA As New RSACryptoServiceProvider

                'Import the RSA Key information. This only needs
                'toinclude the public key information.
                RSA.ImportParameters(RSAKeyInfo)

                'Encrypt the passed byte array and specify OAEP padding.  
                'OAEP padding is only available on Microsoft Windows XP or
                'later.  
                encryptedData = RSA.Encrypt(DataToEncrypt, DoOAEPPadding)
            End Using
            Return encryptedData
            'Catch and display a CryptographicException  
            'to the console.
        Catch e As CryptographicException
            Console.WriteLine(e.Message)

            Return Nothing
        End Try
    End Function


    Public Shared Function RSADecrypt(ByVal DataToDecrypt() As Byte, ByVal RSAKeyInfo As RSAParameters, ByVal DoOAEPPadding As Boolean) As Byte()
        Try
            Dim decryptedData() As Byte
            'Create a new instance of RSACryptoServiceProvider.
            Using RSA As New RSACryptoServiceProvider
                'Import the RSA Key information. This needs
                'to include the private key information.
                RSA.ImportParameters(RSAKeyInfo)

                'Decrypt the passed byte array and specify OAEP padding.  
                'OAEP padding is only available on Microsoft Windows XP or
                'later.  
                decryptedData = RSA.Decrypt(DataToDecrypt, DoOAEPPadding)
                'Catch and display a CryptographicException  
                'to the console.
            End Using
            Return decryptedData
        Catch e As CryptographicException
            Console.WriteLine(e.ToString())

            Return Nothing
        End Try
    End Function
End Class

Nell'esempio di codice seguente le informazioni sulla chiave create usando in RSACryptoServiceProvider un RSAParameters oggetto .

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

Commenti

Per altre informazioni su questa API, vedere Note sulle API supplementari per RSACryptoServiceProvider.

Costruttori

RSACryptoServiceProvider()

Inizializza una nuova istanza della classe RSACryptoServiceProvider con una coppia di chiavi casuale.

RSACryptoServiceProvider(CspParameters)

Inizializza una nuova istanza della classe RSACryptoServiceProvider con i parametri specificati.

RSACryptoServiceProvider(Int32)

Inizializza una nuova istanza della classe RSACryptoServiceProvider con una coppia di chiavi generate in modo casuale con le dimensioni chiave specificate.

RSACryptoServiceProvider(Int32, CspParameters)

Inizializza una nuova istanza della classe RSACryptoServiceProvider con la dimensione e i parametri di chiave specificati.

Campi

KeySizeValue

Rappresenta la dimensione in bit del modulo della chiave usato dall'algoritmo asimmetrico.

(Ereditato da AsymmetricAlgorithm)
LegalKeySizesValue

Specifica le dimensioni delle chiavi supportate dall'algoritmo asimmetrico.

(Ereditato da AsymmetricAlgorithm)

Proprietà

CspKeyContainerInfo

Ottiene un oggetto CspKeyContainerInfo che descrive informazioni aggiuntive su una coppia di chiavi crittografiche.

KeyExchangeAlgorithm

Ottiene il nome dell'algoritmo di scambio delle chiavi disponibile con l'implementazione di RSA.

KeyExchangeAlgorithm

Ottiene il nome dell'algoritmo di scambio delle chiavi disponibile con l'implementazione di RSA.

(Ereditato da RSA)
KeySize

Ottiene la dimensione della chiave corrente.

LegalKeySizes

Ottiene le dimensioni delle chiavi supportate dall'algoritmo asimmetrico.

LegalKeySizes

Ottiene le dimensioni delle chiavi supportate dall'algoritmo asimmetrico.

(Ereditato da AsymmetricAlgorithm)
PersistKeyInCsp

Ottiene o imposta un valore che indica se la chiave deve essere mantenuta nel provider del servizio di crittografia (CSP).

PublicOnly

Ottiene un valore che indica se l'oggetto RSACryptoServiceProvider contiene solo una chiave pubblica.

SignatureAlgorithm

Ottiene il nome dell'algoritmo di firma disponibile con l'implementazione di RSA.

SignatureAlgorithm

Ottiene il nome dell'algoritmo di firma disponibile con l'implementazione di RSA.

(Ereditato da RSA)
UseMachineKeyStore

Ottiene o imposta un valore che indica se la chiave deve essere mantenuta nell'archivio delle chiavi del computer invece che nell'archivio del profilo utente.

Metodi

Clear()

Rilascia tutte le risorse usate dalla classe AsymmetricAlgorithm.

(Ereditato da AsymmetricAlgorithm)
Decrypt(Byte[], Boolean)

Decrittografa i dati con l'algoritmo RSA.

Decrypt(Byte[], RSAEncryptionPadding)

Decrittografa i dati precedentemente crittografati con l'algoritmo RSA usando il riempimento specificato.

Decrypt(Byte[], RSAEncryptionPadding)

Quando è sottoposto a override in una classe derivata, decrittografa i dati di input usando la modalità di riempimento specificata.

(Ereditato da RSA)
Decrypt(ReadOnlySpan<Byte>, RSAEncryptionPadding)

Decrittografa i dati di input usando la modalità di riempimento specificata.

(Ereditato da RSA)
Decrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding)

Decrittografa i dati di input usando la modalità di riempimento specificata.

(Ereditato da RSA)
DecryptValue(Byte[])
Obsoleti.

Metodo non supportato nella versione corrente.

DecryptValue(Byte[])
Obsoleti.

Quando è sottoposto a override in una classe derivata, decrittografa i dati di input usando la chiave privata.

(Ereditato da RSA)
Dispose()

Rilascia tutte le risorse usate dall'istanza corrente della classe AsymmetricAlgorithm.

(Ereditato da AsymmetricAlgorithm)
Dispose(Boolean)

Rilascia le risorse non gestite usate dalla classe AsymmetricAlgorithm e facoltativamente le risorse gestite.

(Ereditato da AsymmetricAlgorithm)
Encrypt(Byte[], Boolean)

Crittografa i dati con l'algoritmo RSA.

Encrypt(Byte[], RSAEncryptionPadding)

Crittografa i dati con l'algoritmo RSA usando il riempimento specificato.

Encrypt(Byte[], RSAEncryptionPadding)

Quando è sottoposto a override in una classe derivata, crittografa i dati di input usando la modalità di riempimento specificata.

(Ereditato da RSA)
Encrypt(ReadOnlySpan<Byte>, RSAEncryptionPadding)

Crittografa i dati di input usando la modalità di riempimento specificata.

(Ereditato da RSA)
Encrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding)

Crittografa i dati di input usando la modalità di riempimento specificata.

(Ereditato da RSA)
EncryptValue(Byte[])
Obsoleti.

Metodo non supportato nella versione corrente.

EncryptValue(Byte[])
Obsoleti.

Quando è sottoposto a override in una classe derivata, decrittografa i dati di input usando la chiave pubblica.

(Ereditato da RSA)
Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
ExportCspBlob(Boolean)

Esporta un BLOB che contiene le informazioni sulla chiave associate a un oggetto RSACryptoServiceProvider.

ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters)

Esporta la chiave corrente nel formato PKCS#8 EncryptedPrivateKeyInfo con una password basata su byte.

(Ereditato da AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters)

Esporta la chiave corrente nel formato PKCS#8 EncryptedPrivateKeyInfo con una password basata su caratteri.

(Ereditato da AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters)

Esporta la chiave corrente nel formato PKCS#8 EncryptedPrivateKeyInfo con una password basata su byte, con codifica PEM.

(Ereditato da AsymmetricAlgorithm)
ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters)

Esporta la chiave corrente nel formato PKCS#8 EncryptedPrivateKeyInfo con una password basata su caratteri, con codifica PEM.

(Ereditato da AsymmetricAlgorithm)
ExportParameters(Boolean)

Esporta RSAParameters.

ExportPkcs8PrivateKey()

Esporta la chiave corrente nel formato PKCS#8 PrivateKeyInfo.

(Ereditato da AsymmetricAlgorithm)
ExportPkcs8PrivateKeyPem()

Esporta la chiave corrente nel formato PKCS#8 PrivateKeyInfo, con codifica PEM.

(Ereditato da AsymmetricAlgorithm)
ExportRSAPrivateKey()

Esporta la chiave corrente nel formato PKCS#1 RSAPrivateKey.

(Ereditato da RSA)
ExportRSAPrivateKeyPem()

Esporta la chiave corrente nel formato PKCS#1 RSAPrivateKey, con codifica PEM.

(Ereditato da RSA)
ExportRSAPublicKey()

Esporta la parte della chiave pubblica della chiave corrente nel formato PKCS#1 RSAPublicKey.

(Ereditato da RSA)
ExportRSAPublicKeyPem()

Esporta la parte della chiave pubblica della chiave corrente nel formato PKCS#1 RSAPublicKey, codificata CON PEM.

(Ereditato da RSA)
ExportSubjectPublicKeyInfo()

Esporta la parte della chiave pubblica della chiave corrente nel formato X.509 SubjectPublicKeyInfo.

(Ereditato da AsymmetricAlgorithm)
ExportSubjectPublicKeyInfoPem()

Esporta la parte pubblica della chiave pubblica della chiave corrente nel formato X.509 SubjectPublicKeyInfo, codificato con PEM.

(Ereditato da AsymmetricAlgorithm)
Finalize()

Rilascia le risorse non gestite contenute da questa istanza.

FromXmlString(String)

Inizializza un oggetto RSA dalle informazioni sulla chiave di una stringa XML.

(Ereditato da RSA)
GetHashCode()

Funge da funzione hash predefinita.

(Ereditato da Object)
GetMaxOutputSize()

Ottiene il numero massimo di byte che un'operazione RSA può produrre.

(Ereditato da RSA)
GetType()

Ottiene l'oggetto Type dell'istanza corrente.

(Ereditato da Object)
HashData(Byte[], Int32, Int32, HashAlgorithmName)

Quando sottoposto a override in una classe derivata, calcola il valore hash di una parte specificata di una matrice di byte usando un algoritmo hash specificato.

(Ereditato da RSA)
HashData(Stream, HashAlgorithmName)

Quando sottoposto a override in una classe derivata, calcola il valore hash di un flusso binario specificato usando un algoritmo hash specificato.

(Ereditato da RSA)
ImportCspBlob(Byte[])

Importa un BLOB che rappresenta le informazioni chiave RSA.

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)

Importa la coppia di chiavi pubblica/privata da una struttura PKCS#8 EncryptedPrivateKeyInfo dopo la decrittografia con una password basata su byte, sostituendo le chiavi per questo oggetto.

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32)

Importa la coppia di chiavi pubblica/privata da una struttura PKCS#8 EncryptedPrivateKeyInfo dopo la decrittografia con una password basata su byte, sostituendo le chiavi per questo oggetto.

(Ereditato da RSA)
ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32)

Importa la coppia di chiavi pubblica/privata da una struttura PKCS#8 EncryptedPrivateKeyInfo dopo la decrittografia con una password basata su caratteri, sostituendo le chiavi per questo oggetto.

ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32)

Importa la coppia di chiavi pubblica/privata da una struttura PKCS#8 EncryptedPrivateKeyInfo dopo la decrittografia con una password basata su caratteri, sostituendo le chiavi per questo oggetto.

(Ereditato da RSA)
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Byte>)

Importa una chiave privata con codifica PEM crittografata RFC 7468, sostituendo le chiavi per questo oggetto.

(Ereditato da RSA)
ImportFromEncryptedPem(ReadOnlySpan<Char>, ReadOnlySpan<Char>)

Importa una chiave privata con codifica PEM crittografata RFC 7468, sostituendo le chiavi per questo oggetto.

(Ereditato da RSA)
ImportFromPem(ReadOnlySpan<Char>)

Importa una chiave con codifica PEM RFC 7468, sostituendo le chiavi per questo oggetto.

(Ereditato da RSA)
ImportParameters(RSAParameters)

Importa l'oggetto RSAParameters specificato.

ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32)

Importa la coppia di chiavi pubblica/privata da una struttura PKCS#8 PrivateKeyInfo dopo la decrittografia, sostituendo le chiavi per questo oggetto.

(Ereditato da RSA)
ImportRSAPrivateKey(ReadOnlySpan<Byte>, Int32)

Importa la coppia di chiavi pubblica/privata da una struttura PKCS#1 RSAPrivateKey dopo la decrittografia, sostituendo le chiavi per questo oggetto.

(Ereditato da RSA)
ImportRSAPublicKey(ReadOnlySpan<Byte>, Int32)

Importa la chiave pubblica da una struttura PKCS#1 RSAPublicKey dopo la decrittografia, sostituendo le chiavi per questo oggetto.

(Ereditato da RSA)
ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32)

Importa la chiave pubblica da una struttura X.509 SubjectPublicKeyInfo dopo la decrittografia, sostituendo le chiavi per questo oggetto.

(Ereditato da RSA)
MemberwiseClone()

Crea una copia superficiale dell'oggetto Object corrente.

(Ereditato da Object)
SignData(Byte[], HashAlgorithmName, RSASignaturePadding)

Calcola il valore hash della matrice di byte specificata usando l'algoritmo hash e la modalità di spaziatura interna specificati e firma il valore hash risultante.

(Ereditato da RSA)
SignData(Byte[], Int32, Int32, HashAlgorithmName, RSASignaturePadding)

Calcola il valore hash di una parte della matrice di byte specificata usando l'algoritmo hash e la modalità di riempimento specificati e firma il valore hash risultante.

(Ereditato da RSA)
SignData(Byte[], Int32, Int32, Object)

Calcola il valore hash di un subset della matrice di byte specificata usando l'algoritmo hash specificato e firma il valore hash risultante.

SignData(Byte[], Object)

Calcola il valore hash della matrice di byte specificata usando l'algoritmo hash specificato e firma il valore hash risultante.

SignData(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

Calcola il valore hash dei dati specificati e lo firma.

(Ereditato da RSA)
SignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding)

Calcola l'hash dei dati forniti con l'algoritmo specificato e firma l'hash con la chiave corrente, scrivendo la firma in un buffer fornito.

(Ereditato da RSA)
SignData(Stream, HashAlgorithmName, RSASignaturePadding)

Calcola il valore hash del flusso specificato usando l'algoritmo hash e la modalità di spaziatura interna specificati e firma il valore hash risultante.

(Ereditato da RSA)
SignData(Stream, Object)

Calcola il valore hash del flusso di input specificato usando l'algoritmo hash specificato e firma il valore hash risultante.

SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)

Calcola la firma per il valore hash specificato usando il riempimento specificato.

SignHash(Byte[], HashAlgorithmName, RSASignaturePadding)

Quando è sottoposto a override in una classe derivata, calcola la firma per il valore hash specificato usando il riempimento specificato.

(Ereditato da RSA)
SignHash(Byte[], String)

Calcola la firma per il valore hash specificato.

SignHash(ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

Calcola la firma per il valore hash specificato usando il riempimento specificato.

(Ereditato da RSA)
SignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding)

Firma l'hash con la chiave corrente, scrivendo la firma in un buffer fornito.

(Ereditato da RSA)
ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)
ToXmlString(Boolean)

Crea e restituisce una stringa XML contenente la chiave dell'oggetto RSA corrente.

(Ereditato da RSA)
TryDecrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding, Int32)

Prova a decrittografare i dati di input usando la modalità di riempimento specificata e scrivendo il risultato in un buffer specificato.

(Ereditato da RSA)
TryEncrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding, Int32)

Prova a crittografare i dati di input con una modalità di riempimento specificata in un buffer specificato.

(Ereditato da RSA)
TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32)

Tenta di esportare la chiave corrente nel formato PKCS#8 EncryptedPrivateKeyInfo in un buffer specificato, usando una password basata su byte.

(Ereditato da RSA)
TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32)

Tenta di esportare la chiave corrente nel formato PKCS#8 EncryptedPrivateKeyInfo in un buffer specificato, usando una password basata su caratteri.

(Ereditato da RSA)
TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Byte>, PbeParameters, Span<Char>, Int32)

Tenta di esportare la chiave corrente nel formato PKCS#8 EncryptedPrivateKeyInfo con una password basata su byte, con codifica PEM.

(Ereditato da AsymmetricAlgorithm)
TryExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<Char>, PbeParameters, Span<Char>, Int32)

Esporta la chiave corrente nel formato PKCS#8 EncryptedPrivateKeyInfo con una password basata su caratteri, con codifica PEM.

(Ereditato da AsymmetricAlgorithm)
TryExportPkcs8PrivateKey(Span<Byte>, Int32)

Tenta di esportare la chiave corrente nel formato PKCS#8 PrivateKeyInfo in un buffer specificato.

(Ereditato da RSA)
TryExportPkcs8PrivateKeyPem(Span<Char>, Int32)

Tenta di esportare la chiave corrente nel formato PKCS#8 PrivateKeyInfo con codifica PEM in un buffer fornito.

(Ereditato da AsymmetricAlgorithm)
TryExportRSAPrivateKey(Span<Byte>, Int32)

Tenta di esportare la chiave corrente nel formato PKCS#1 RSAPrivateKey in un buffer specificato.

(Ereditato da RSA)
TryExportRSAPrivateKeyPem(Span<Char>, Int32)

Tenta di esportare la chiave corrente nel formato PKCS#1 CON codifica PEM in un buffer fornito.

(Ereditato da RSA)
TryExportRSAPublicKey(Span<Byte>, Int32)

Tenta di esportare la chiave corrente nel formato PKCS#1 RSAPublicKey in un buffer specificato.

(Ereditato da RSA)
TryExportRSAPublicKeyPem(Span<Char>, Int32)

Tenta di esportare la chiave corrente nel formato PKCS#1 CON codifica PEM in un buffer fornito.

(Ereditato da RSA)
TryExportSubjectPublicKeyInfo(Span<Byte>, Int32)

Tenta di esportare la chiave corrente nel formato X.509 SubjectPublicKeyInfo in un buffer specificato.

(Ereditato da RSA)
TryExportSubjectPublicKeyInfoPem(Span<Char>, Int32)

Tenta di esportare la chiave corrente nel formato X.509 SoggettoPublicKeyInfo con codifica PEM in un buffer fornito.

(Ereditato da AsymmetricAlgorithm)
TryHashData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, Int32)

Prova a calcolare l'hash dei dati specificati usando l'algoritmo specificato e scrivendo i risultati in un buffer specificato.

(Ereditato da RSA)
TrySignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32)

Prova a eseguire l'hashing dei dati specificati con l'algoritmo specificato e di firmare l'hash con la chiave corrente, scrivendo la firma in un buffer specificato.

(Ereditato da RSA)
TrySignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32)

Prova a firmare l'hash con la chiave corrente, scrivendo la firma in un buffer specificato.

(Ereditato da RSA)
VerifyData(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

Verifica che una firma digitale sia valida calcolando il valore hash dei dati indicati usando l'algoritmo hash e la spaziatura interna specificati e confrontandolo con la firma fornita.

(Ereditato da RSA)
VerifyData(Byte[], Int32, Int32, Byte[], HashAlgorithmName, RSASignaturePadding)

Verifica che una firma digitale sia valida calcolando il valore hash dei dati in una parte di matrice di byte usando l'algoritmo hash e la spaziatura interna specificati e confrontandolo con la firma fornita.

(Ereditato da RSA)
VerifyData(Byte[], Object, Byte[])

Verifica che una firma digitale sia valida determinando il valore hash nella firma usando la chiave pubblica fornita e confrontandola con il valore hash fornito.

VerifyData(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

Verifica che una firma digitale sia valida calcolando il valore hash dei dati indicati usando l'algoritmo hash e la spaziatura interna specificati e confrontandolo con la firma fornita.

(Ereditato da RSA)
VerifyData(Stream, Byte[], HashAlgorithmName, RSASignaturePadding)

Verifica che una firma digitale sia valida calcolando il valore hash del flusso specificato usando l'algoritmo hash e la spaziatura interna specificati e confrontandolo con la firma fornita.

(Ereditato da RSA)
VerifyHash(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

Verifica che una firma digitale sia valida determinando il valore hash nella firma tramite l'algoritmo hash e il riempimento specificati e confrontandolo con il valore hash indicato.

VerifyHash(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding)

Verifica che una firma digitale sia valida determinando il valore hash nella firma tramite l'algoritmo hash e la spaziatura interna specificati e confrontandolo con il valore hash indicato.

(Ereditato da RSA)
VerifyHash(Byte[], String, Byte[])

Verifica la validità di una firma digitale confrontando il valore hash della firma determinato tramite la chiave pubblica fornita con il valore hash fornito.

VerifyHash(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding)

Verifica che una firma digitale sia valida determinando il valore hash nella firma tramite l'algoritmo hash e la spaziatura interna specificati e confrontandolo con il valore hash indicato.

(Ereditato da RSA)

Implementazioni dell'interfaccia esplicita

IDisposable.Dispose()

Questa API supporta l'infrastruttura del prodotto e non è previsto che venga usata direttamente dal codice.

Per una descrizione di questo membro, vedere Dispose().

(Ereditato da AsymmetricAlgorithm)

Si applica a

Vedi anche