RSA Class
Definition
Represents the base class from which all implementations of the RSA algorithm inherit.
public ref class RSA abstract : System::Security::Cryptography::AsymmetricAlgorithm
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class RSA : System.Security.Cryptography.AsymmetricAlgorithm
type RSA = class
inherit AsymmetricAlgorithm
Public MustInherit Class RSA
Inherits AsymmetricAlgorithm
- Inheritance
- Derived
- Attributes
Remarks
Extending this class proves that you are implementing an RSA
key. This is required for any developer providing a new RSA
key implementation.
The only purpose of this class is as a hierarchy member for identification of the RSA
algorithm.
The RSACryptoServiceProvider supports key lengths from 384 bits to 16384 bits in increments of 8 bits if you have the Microsoft Enhanced Cryptographic Provider installed. It supports key lengths from 384 bits to 512 bits in increments of 8 bits if you have the Microsoft Base Cryptographic Provider installed.
Constructors
RSA() |
Initializes a new instance of the RSA class. |
Fields
KeySizeValue |
Represents the size, in bits, of the key modulus used by the asymmetric algorithm. (Inherited from AsymmetricAlgorithm) |
LegalKeySizesValue |
Specifies the key sizes that are supported by the asymmetric algorithm. (Inherited from AsymmetricAlgorithm) |
Properties
KeyExchangeAlgorithm |
Gets the name of the key exchange algorithm available with this implementation of RSA. |
KeySize |
Gets or sets the size, in bits, of the key modulus used by the asymmetric algorithm. (Inherited from AsymmetricAlgorithm) |
LegalKeySizes |
Gets the key sizes that are supported by the asymmetric algorithm. (Inherited from AsymmetricAlgorithm) |
SignatureAlgorithm |
Gets the name of the signature algorithm available with this implementation of RSA. |
Methods
Clear() |
Releases all resources used by the AsymmetricAlgorithm class. (Inherited from AsymmetricAlgorithm) |
Create() |
Creates an instance of the default implementation of the RSA algorithm. |
Create(Int32) |
Creates a new ephemeral RSA key with the specified key size. |
Create(RSAParameters) |
Creates a new ephemeral RSA key with the specified RSA key parameters. |
Create(String) |
Creates an instance of the specified implementation of RSA. |
Decrypt(Byte[], RSAEncryptionPadding) |
When overridden in a derived class, decrypts the input data using the specified padding mode. |
DecryptValue(Byte[]) |
When overridden in a derived class, decrypts the input data using the private key. |
Dispose() |
Releases all resources used by the current instance of the AsymmetricAlgorithm class. (Inherited from AsymmetricAlgorithm) |
Dispose(Boolean) |
Releases the unmanaged resources used by the AsymmetricAlgorithm class and optionally releases the managed resources. (Inherited from AsymmetricAlgorithm) |
Encrypt(Byte[], RSAEncryptionPadding) |
When overridden in a derived class, encrypts the input data using the specified padding mode. |
EncryptValue(Byte[]) |
When overridden in a derived class, encrypts the input data using the public key. |
Equals(Object) |
Determines whether the specified object is equal to the current object. (Inherited from Object) |
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters) |
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password. (Inherited from AsymmetricAlgorithm) |
ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters) |
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password. (Inherited from AsymmetricAlgorithm) |
ExportParameters(Boolean) |
When overridden in a derived class, exports the RSAParameters. |
ExportPkcs8PrivateKey() |
Exports the current key in the PKCS#8 PrivateKeyInfo format. (Inherited from AsymmetricAlgorithm) |
ExportRSAPrivateKey() |
Exports the current key in the PKCS#1 RSAPrivateKey format. |
ExportRSAPublicKey() |
Exports the public-key portion of the current key in the PKCS#1 RSAPublicKey format. |
ExportSubjectPublicKeyInfo() |
Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format. (Inherited from AsymmetricAlgorithm) |
FromXmlString(String) |
Initializes an RSA object from the key information from an XML string. |
GetHashCode() |
Serves as the default hash function. (Inherited from Object) |
GetType() |
Gets the Type of the current instance. (Inherited from Object) |
HashData(Byte[], Int32, Int32, HashAlgorithmName) |
When overridden in a derived class, computes the hash value of a specified portion of a byte array by using a specified hashing algorithm. |
HashData(Stream, HashAlgorithmName) |
When overridden in a derived class, computes the hash value of a specified binary stream by using a specified hashing algorithm. |
ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, Int32) |
Imports the public/private keypair from a PKCS#8 EncryptedPrivateKeyInfo structure after decrypting with a byte-based password, replacing the keys for this object. |
ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, ReadOnlySpan<Byte>, Int32) |
Imports the public/private keypair from a PKCS#8 EncryptedPrivateKeyInfo structure after decrypting with a char-based password, replacing the keys for this object. |
ImportParameters(RSAParameters) |
When overridden in a derived class, imports the specified RSAParameters. |
ImportPkcs8PrivateKey(ReadOnlySpan<Byte>, Int32) |
Imports the public/private keypair from a PKCS#8 PrivateKeyInfo structure after decryption, replacing the keys for this object. |
ImportRSAPrivateKey(ReadOnlySpan<Byte>, Int32) |
Imports the public/private keypair from a PKCS#1 RSAPrivateKey structure after decryption, replacing the keys for this object. |
ImportRSAPublicKey(ReadOnlySpan<Byte>, Int32) |
Imports the public key from a PKCS#1 RSAPublicKey structure after decryption, replacing the keys for this object. |
ImportSubjectPublicKeyInfo(ReadOnlySpan<Byte>, Int32) |
Imports the public key from an X.509 SubjectPublicKeyInfo structure after decryption, replacing the keys for this object. |
MemberwiseClone() |
Creates a shallow copy of the current Object. (Inherited from Object) |
SignData(Byte[], HashAlgorithmName, RSASignaturePadding) |
Computes the hash value of the specified byte array using the specified hash algorithm and padding mode, and signs the resulting hash value. |
SignData(Byte[], Int32, Int32, HashAlgorithmName, RSASignaturePadding) |
Computes the hash value of a portion of the specified byte array using the specified hash algorithm and padding mode, and signs the resulting hash value. |
SignData(Stream, HashAlgorithmName, RSASignaturePadding) |
Computes the hash value of the specified stream using the specified hash algorithm and padding mode, and signs the resulting hash value. |
SignHash(Byte[], HashAlgorithmName, RSASignaturePadding) |
When overridden in a derived class, computes the signature for the specified hash value by encrypting it with the private key using the specified padding. |
ToString() |
Returns a string that represents the current object. (Inherited from Object) |
ToXmlString(Boolean) |
Creates and returns an XML string containing the key of the current RSA object. |
TryDecrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding, Int32) | |
TryEncrypt(ReadOnlySpan<Byte>, Span<Byte>, RSAEncryptionPadding, Int32) | |
TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Byte>, PbeParameters, Span<Byte>, Int32) |
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a byte-based password. |
TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<Char>, PbeParameters, Span<Byte>, Int32) |
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer, using a char-based password. |
TryExportPkcs8PrivateKey(Span<Byte>, Int32) |
Attempts to export the current key in the PKCS#8 PrivateKeyInfo format into a provided buffer. |
TryExportRSAPrivateKey(Span<Byte>, Int32) |
Attempts to export the current key in the PKCS#1 RSAPrivateKey format into a provided buffer. |
TryExportRSAPublicKey(Span<Byte>, Int32) |
Attempts to export the current key in the PKCS#1 RSAPublicKey format into a provided buffer. |
TryExportSubjectPublicKeyInfo(Span<Byte>, Int32) |
Attempts to export the current key in the X.509 SubjectPublicKeyInfo format into a provided buffer. |
TryHashData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, Int32) | |
TrySignData(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32) | |
TrySignHash(ReadOnlySpan<Byte>, Span<Byte>, HashAlgorithmName, RSASignaturePadding, Int32) | |
VerifyData(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding) |
Verifies that a digital signature is valid by calculating the hash value of the specified data using the specified hash algorithm and padding, and comparing it to the provided signature. |
VerifyData(Byte[], Int32, Int32, Byte[], HashAlgorithmName, RSASignaturePadding) |
Verifies that a digital signature is valid by calculating the hash value of the data in a portion of a byte array using the specified hash algorithm and padding, and comparing it to the provided signature. |
VerifyData(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding) | |
VerifyData(Stream, Byte[], HashAlgorithmName, RSASignaturePadding) |
Verifies that a digital signature is valid by calculating the hash value of the specified stream using the specified hash algorithm and padding, and comparing it to the provided signature. |
VerifyHash(Byte[], Byte[], HashAlgorithmName, RSASignaturePadding) |
Verifies that a digital signature is valid by determining the hash value in the signature using the specified hash algorithm and padding, and comparing it to the provided hash value. |
VerifyHash(ReadOnlySpan<Byte>, ReadOnlySpan<Byte>, HashAlgorithmName, RSASignaturePadding) |
Explicit Interface Implementations
IDisposable.Dispose() |
For a description of this member, see Dispose(). (Inherited from AsymmetricAlgorithm) |