Early Preview
This is currently very much a preview. Please feel free to try things out,
but don't be upset if anything is not yet working. Feedback is welcome over on our
GitHub Dicussions page.
class System.​Security.​Cryptography.​RSACryptoServiceProvider
Assembly: System.Security.Cryptography
Inheritance: object → AsymmetricAlgorithm → RSA → RSACryptoServiceProvider
Implemented Interfaces
- IDisposable Implemented by: AsymmetricAlgorithm
- ICspAsymmetricAlgorithm
Performs asymmetric encryption and decryption using the implementation of the <see cref="T:System.Security.Cryptography.RSA" /> algorithm provided by the cryptographic service provider (CSP). This class cannot be inherited.
Fields and Constants
protected
int
KeySizeValue
Represents the size, in bits, of the key modulus used by the asymmetric algorithm.
protected
KeySizes[]
LegalKeySizesValue
Specifies the key sizes that are supported by the asymmetric algorithm.
Properties
public
CspKeyContainerInfo
CspKeyContainerInfo
Gets a <see cref="T:System.Security.Cryptography.CspKeyContainerInfo" /> object that describes additional information about a cryptographic key pair.
public
string
KeyExchangeAlgorithm
Gets the name of the key exchange algorithm available with this implementation of <see cref="T:System.Security.Cryptography.RSA" /> .
public
int
KeySize
Gets the size of the current key.
public
KeySizes[]
LegalKeySizes
Gets the key sizes that are supported by the asymmetric algorithm.
public
bool
PersistKeyInCsp
Gets or sets a value indicating whether the key should be persisted in the cryptographic service provider (CSP).
public
bool
PublicOnly
Gets a value that indicates whether the <see cref="T:System.Security.Cryptography.RSACryptoServiceProvider" /> object contains only a public key.
public
string
SignatureAlgorithm
Gets the name of the signature algorithm available with this implementation of <see cref="T:System.Security.Cryptography.RSA" /> .
public static
bool
UseMachineKeyStore
Gets or sets a value indicating whether the key should be persisted in the computer's key store instead of the user profile store.
Methods
public
byte[]
Decrypt​(byte[] rgb,
bool fOAEP)
Decrypts data with the <see cref="T:System.Security.Cryptography.RSA" /> algorithm.
Returns The decrypted data, which is the original plain text before encryption.
rgb
The data to be decrypted.
fOAEP
<see langword="true" /> to perform direct <see cref="T:System.Security.Cryptography.RSA" /> decryption using OAEP padding; otherwise, <see langword="false" /> to use PKCS#1 v1.5 padding.
public
byte[]
Decrypt​(byte[] data,
RSAEncryptionPadding padding)
Decrypts data that was previously encrypted with the <see cref="T:System.Security.Cryptography.RSA" /> algorithm by using the specified padding.
Returns The decrypted data.
data
The data to decrypt.
padding
The padding.
public
byte[]
DecryptValue​(byte[] rgb)
This method is not supported in the current version.
Returns The decrypted data, which is the original plain text before encryption.
rgb
The data to be decrypted.
protected
void
Dispose​(bool disposing)
public
byte[]
Encrypt​(byte[] rgb,
bool fOAEP)
Encrypts data with the <see cref="T:System.Security.Cryptography.RSA" /> algorithm.
Returns The encrypted data.
rgb
The data to be encrypted.
fOAEP
<see langword="true" /> to perform direct <see cref="T:System.Security.Cryptography.RSA" /> encryption using OAEP padding (only available on a computer running Windows XP or later); otherwise, <see langword="false" /> to use PKCS#1 v1.5 padding.
public
byte[]
Encrypt​(byte[] data,
RSAEncryptionPadding padding)
Encrypts data with the <see cref="T:System.Security.Cryptography.RSA" /> algorithm using the specified padding.
Returns The encrypted data.
data
The data to encrypt.
padding
The padding.
public
byte[]
EncryptValue​(byte[] rgb)
This method is not supported in the current version.
Returns The encrypted data.
rgb
The data to be encrypted.
public
byte[]
ExportCspBlob​(bool includePrivateParameters)
Exports a blob containing the key information associated with an <see cref="T:System.Security.Cryptography.RSACryptoServiceProvider" /> object.
Returns A byte array containing the key information associated with an <see cref="T:System.Security.Cryptography.RSACryptoServiceProvider" /> object.
includePrivateParameters
<see langword="true" /> to include the private key; otherwise, <see langword="false" /> .
public
RSAParameters
ExportParameters​(bool includePrivateParameters)
Exports the <see cref="T:System.Security.Cryptography.RSAParameters" /> .
Returns The parameters for <see cref="T:System.Security.Cryptography.RSA" /> .
includePrivateParameters
<see langword="true" /> to include private parameters; otherwise, <see langword="false" /> .
public
void
ImportCspBlob​(byte[] keyBlob)
Imports a blob that represents RSA key information.
keyBlob
A byte array that represents an RSA key blob.
public
void
ImportEncryptedPkcs8PrivateKey​(ReadOnlySpan<​byte> passwordBytes,
ReadOnlySpan<​byte> source,
Int32& bytesRead)
public
void
ImportEncryptedPkcs8PrivateKey​(ReadOnlySpan<​char> password,
ReadOnlySpan<​byte> source,
Int32& bytesRead)
public
void
ImportParameters​(RSAParameters parameters)
Imports the specified <see cref="T:System.Security.Cryptography.RSAParameters" /> .
parameters
The parameters for <see cref="T:System.Security.Cryptography.RSA" /> .
public
byte[]
SignData​(byte[] buffer,
int offset,
int count,
object halg)
Computes the hash value of a subset of the specified byte array using the specified hash algorithm, and signs the resulting hash value.
Returns The <see cref="T:System.Security.Cryptography.RSA" /> signature for the specified data.
buffer
The input data to hash and sign.
offset
The offset into the array from which to begin using data.
count
The number of bytes in the array to use as data.
halg
The hash algorithm to use to create the hash value.
public
byte[]
SignData​(byte[] buffer,
object halg)
Computes the hash value of the specified byte array using the specified hash algorithm, and signs the resulting hash value.
Returns The <see cref="T:System.Security.Cryptography.RSA" /> signature for the specified data.
buffer
The input data to hash and sign.
halg
The hash algorithm to use to create the hash value.
public
byte[]
SignData​(IO.​Stream inputStream,
object halg)
Computes the hash value of the specified input stream using the specified hash algorithm, and signs the resulting hash value.
Returns The <see cref="T:System.Security.Cryptography.RSA" /> signature for the specified data.
inputStream
The input stream to hash and sign.
halg
The hash algorithm to use to create the hash value.
public
byte[]
SignHash​(byte[] hash,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Computes the signature for the specified hash value using the specified padding.
Returns The <see cref="T:System.Security.Cryptography.RSA" /> signature for the specified hash value.
hash
The hash value of the data to be signed.
hashAlgorithm
The hash algorithm name used to create the hash value of the data.
padding
The padding.
public
byte[]
SignHash​(byte[] rgbHash,
string str)
Computes the signature for the specified hash value.
Returns The <see cref="T:System.Security.Cryptography.RSA" /> signature for the specified hash value.
rgbHash
The hash value of the data to be signed.
str
The hash algorithm identifier (OID) used to create the hash value of the data.
public
bool
VerifyData​(byte[] buffer,
object halg,
byte[] signature)
Verifies that a digital signature is valid by determining the hash value in the signature using the provided public key and comparing it to the hash value of the provided data.
Returns <see langword="true" /> if the signature is valid; otherwise, <see langword="false" /> .
buffer
The data that was signed.
halg
The name of the hash algorithm used to create the hash value of the data.
signature
The signature data to be verified.
public
bool
VerifyHash​(byte[] hash,
byte[] signature,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Verifies that a digital signature is valid by determining the hash value in the signature using the specified hashing algorithm and padding, and comparing it to the provided hash value.
Returns <see langword="true" /> if the signature is valid; otherwise, <see langword="false" /> .
hash
The hash value of the signed data.
signature
The signature data to be verified.
hashAlgorithm
The hash algorithm name used to create the hash value.
padding
The padding.
public
bool
VerifyHash​(byte[] rgbHash,
string str,
byte[] rgbSignature)
Verifies that a digital signature is valid by determining the hash value in the signature using the provided public key and comparing it to the provided hash value.
Returns <see langword="true" /> if the signature is valid; otherwise, <see langword="false" /> .
rgbHash
The hash value of the signed data.
str
The hash algorithm identifier (OID) used to create the hash value of the data.
rgbSignature
The signature data to be verified.
public
byte[]
Decrypt​(ReadOnlySpan<​byte> data,
RSAEncryptionPadding padding)
Inherited from RSA
Decrypts the input data using the specified padding mode.
Returns The decrypted data.
data
The data to decrypt.
padding
The padding mode.
public
int
Decrypt​(ReadOnlySpan<​byte> data,
Span<​byte> destination,
RSAEncryptionPadding padding)
Inherited from RSA
Decrypts the input data using the specified padding mode.
Returns The total number of bytes written to <paramref name="destination" /> .
data
The data to decrypt.
destination
The buffer to receive the decrypted data.
padding
The padding mode.
public
byte[]
Encrypt​(ReadOnlySpan<​byte> data,
RSAEncryptionPadding padding)
Inherited from RSA
Encrypts the input data using the specified padding mode.
Returns The encrypted data.
data
The data to encrypt.
padding
The padding mode.
public
int
Encrypt​(ReadOnlySpan<​byte> data,
Span<​byte> destination,
RSAEncryptionPadding padding)
Inherited from RSA
Encrypts the input data using the specified padding mode.
Returns The total number of bytes written to <paramref name="destination" /> .
data
The data to encrypt.
destination
The buffer to receive the encrypted data.
padding
The padding mode.
public
byte[]
ExportRSAPrivateKey​()
Inherited from RSA
Exports the current key in the PKCS#1 RSAPrivateKey format.
Returns A byte array containing the PKCS#1 RSAPrivateKey representation of this key.
public
string
ExportRSAPrivateKeyPem​()
Inherited from RSA
Exports the current key in the PKCS#1 RSAPrivateKey format, PEM encoded.
Returns A string containing the PEM-encoded PKCS#1 RSAPrivateKey.
public
byte[]
ExportRSAPublicKey​()
Inherited from RSA
Exports the public-key portion of the current key in the PKCS#1 RSAPublicKey format.
Returns A byte array containing the PKCS#1 RSAPublicKey representation of this key.
public
string
ExportRSAPublicKeyPem​()
Inherited from RSA
Exports the public-key portion of the current key in the PKCS#1 RSAPublicKey format, PEM encoded.
Returns A string containing the PEM-encoded PKCS#1 RSAPublicKey.
public
void
FromXmlString​(string xmlString)
Inherited from RSA
Initializes an <see cref="T:System.Security.Cryptography.RSA" /> object from the key information from an XML string.
xmlString
The XML string containing <see cref="T:System.Security.Cryptography.RSA" /> key information.
public
int
GetMaxOutputSize​()
Inherited from RSA
Gets the maximum number of bytes an RSA operation can produce.
Returns The maximum number of bytes an RSA operation can produce.
protected
byte[]
HashData​(byte[] data,
int offset,
int count,
HashAlgorithmName hashAlgorithm)
Inherited from RSA
When overridden in a derived class, computes the hash value of a specified portion of a byte array by using a specified hashing algorithm.
Returns The hashed data.
data
The data to be hashed.
offset
The index of the first byte in <paramref name="data" /> that is to be hashed.
count
The number of bytes to hash.
hashAlgorithm
The algorithm to use in hash the data.
protected
byte[]
HashData​(IO.​Stream data,
HashAlgorithmName hashAlgorithm)
Inherited from RSA
When overridden in a derived class, computes the hash value of a specified binary stream by using a specified hashing algorithm.
Returns The hashed data.
data
The binary stream to hash.
hashAlgorithm
The hash algorithm.
public
void
ImportFromEncryptedPem​(ReadOnlySpan<​char> input,
ReadOnlySpan<​byte> passwordBytes)
Inherited from RSA
Imports an encrypted RFC 7468 PEM-encoded private key, replacing the keys for this object.
input
The PEM text of the encrypted key to import.
passwordBytes
The bytes to use as a password when decrypting the key material.
public
void
ImportFromEncryptedPem​(ReadOnlySpan<​char> input,
ReadOnlySpan<​char> password)
Inherited from RSA
Imports an encrypted RFC 7468 PEM-encoded private key, replacing the keys for this object.
input
The PEM text of the encrypted key to import.
password
The password to use for decrypting the key material.
public
void
ImportFromPem​(ReadOnlySpan<​char> input)
Inherited from RSA
Imports an RFC 7468 PEM-encoded key, replacing the keys for this object.
input
The PEM text of the key to import.
public
void
ImportPkcs8PrivateKey​(ReadOnlySpan<​byte> source,
Int32& bytesRead)
Inherited from RSA
public
void
ImportRSAPrivateKey​(ReadOnlySpan<​byte> source,
Int32& bytesRead)
Inherited from RSA
public
void
ImportRSAPublicKey​(ReadOnlySpan<​byte> source,
Int32& bytesRead)
Inherited from RSA
public
void
ImportSubjectPublicKeyInfo​(ReadOnlySpan<​byte> source,
Int32& bytesRead)
Inherited from RSA
public
byte[]
SignData​(byte[] data,
int offset,
int count,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
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.
Returns The RSA signature for the specified data.
data
The input data to hash and sign.
offset
The offset into the array at which to begin using data.
count
The number of bytes in the array to use as data.
hashAlgorithm
The hash algorithm to use to create the hash value.
padding
The padding mode.
public
byte[]
SignData​(byte[] data,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
Computes the hash value of the specified byte array using the specified hash algorithm and padding mode, and signs the resulting hash value.
Returns The RSA signature for the specified data.
data
The input data to hash and sign.
hashAlgorithm
The hash algorithm to use to create the hash value.
padding
The padding mode.
public
byte[]
SignData​(IO.​Stream data,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
Computes the hash value of the specified stream using the specified hash algorithm and padding mode, and signs the resulting hash value.
Returns The RSA signature for the specified data.
data
The input stream to hash and sign.
hashAlgorithm
The hash algorithm to use to create the hash value.
padding
The padding mode.
public
byte[]
SignData​(ReadOnlySpan<​byte> data,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
Computes the hash value of the specified data and signs it.
Returns The RSA signature for the specified data.
data
The input data to hash and sign.
hashAlgorithm
The hash algorithm to use to create the hash value.
padding
The padding mode.
public
int
SignData​(ReadOnlySpan<​byte> data,
Span<​byte> destination,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
Computes the hash of the provided data with the specified algorithm and sign the hash with the current key, writing the signature into a provided buffer.
Returns The total number of bytes written to <paramref name="destination" /> .
data
The input data to hash and sign.
destination
The buffer to receive the RSA signature.
hashAlgorithm
The hash algorithm to use to create the hash value.
padding
The padding mode.
public
byte[]
SignHash​(ReadOnlySpan<​byte> hash,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
Computes the signature for the specified hash value using the specified padding.
Returns The RSA signature for the specified hash value.
hash
The hash value of the data to be signed.
hashAlgorithm
The hash algorithm used to create the hash of <paramref name="hash" /> .
padding
The padding mode.
public
int
SignHash​(ReadOnlySpan<​byte> hash,
Span<​byte> destination,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
Signs the hash with the current key, writing the signature into a provided buffer.
Returns The total number of bytes written to <paramref name="destination" /> .
hash
The hash value of the data to be signed.
destination
The buffer to receive the RSA signature.
hashAlgorithm
The hash algorithm used to create the hash of <paramref name="hash" /> .
padding
The padding mode.
public
string
ToXmlString​(bool includePrivateParameters)
Inherited from RSA
Creates and returns an XML string containing the key of the current <see cref="T:System.Security.Cryptography.RSA" /> object.
Returns An XML string containing the key of the current <see cref="T:System.Security.Cryptography.RSA" /> object.
includePrivateParameters
<see langword="true" /> to include a public and private RSA key; <see langword="false" /> to include only the public key.
public
bool
TryDecrypt​(ReadOnlySpan<​byte> data,
Span<​byte> destination,
RSAEncryptionPadding padding,
Int32& bytesWritten)
Inherited from RSA
public
bool
TryEncrypt​(ReadOnlySpan<​byte> data,
Span<​byte> destination,
RSAEncryptionPadding padding,
Int32& bytesWritten)
Inherited from RSA
public
bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan<​byte> passwordBytes,
PbeParameters pbeParameters,
Span<​byte> destination,
Int32& bytesWritten)
Inherited from RSA
public
bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan<​char> password,
PbeParameters pbeParameters,
Span<​byte> destination,
Int32& bytesWritten)
Inherited from RSA
public
bool
TryExportPkcs8PrivateKey​(Span<​byte> destination,
Int32& bytesWritten)
Inherited from RSA
public
bool
TryExportRSAPrivateKey​(Span<​byte> destination,
Int32& bytesWritten)
Inherited from RSA
public
bool
TryExportRSAPrivateKeyPem​(Span<​char> destination,
Int32& charsWritten)
Inherited from RSA
public
bool
TryExportRSAPublicKey​(Span<​byte> destination,
Int32& bytesWritten)
Inherited from RSA
public
bool
TryExportRSAPublicKeyPem​(Span<​char> destination,
Int32& charsWritten)
Inherited from RSA
public
bool
TryExportSubjectPublicKeyInfo​(Span<​byte> destination,
Int32& bytesWritten)
Inherited from RSA
protected
bool
TryHashData​(ReadOnlySpan<​byte> data,
Span<​byte> destination,
HashAlgorithmName hashAlgorithm,
Int32& bytesWritten)
Inherited from RSA
public
bool
TrySignData​(ReadOnlySpan<​byte> data,
Span<​byte> destination,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding,
Int32& bytesWritten)
Inherited from RSA
public
bool
TrySignHash​(ReadOnlySpan<​byte> hash,
Span<​byte> destination,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding,
Int32& bytesWritten)
Inherited from RSA
public
bool
VerifyData​(byte[] data,
byte[] signature,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
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.
Returns <see langword="true" /> if the signature is valid; otherwise, <see langword="false" /> .
data
The signed data.
signature
The signature data to be verified.
hashAlgorithm
The hash algorithm used to create the hash value of the data.
padding
The padding mode.
public
bool
VerifyData​(byte[] data,
int offset,
int count,
byte[] signature,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
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.
Returns <see langword="true" /> if the signature is valid; otherwise, <see langword="false" /> .
data
The signed data.
offset
The starting index at which to compute the hash.
count
The number of bytes to hash.
signature
The signature data to be verified.
hashAlgorithm
The hash algorithm used to create the hash value of the data.
padding
The padding mode.
public
bool
VerifyData​(IO.​Stream data,
byte[] signature,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
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.
Returns <see langword="true" /> if the signature is valid; otherwise, <see langword="false" /> .
data
The signed data.
signature
The signature data to be verified.
hashAlgorithm
The hash algorithm used to create the hash value of the data.
padding
The padding mode.
public
bool
VerifyData​(ReadOnlySpan<​byte> data,
ReadOnlySpan<​byte> signature,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
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.
Returns <see langword="true" /> if the signature is valid; otherwise, <see langword="false" /> .
data
The signed data.
signature
The signature data to be verified.
hashAlgorithm
The hash algorithm used to create the hash value of the data.
padding
The padding mode.
public
bool
VerifyHash​(ReadOnlySpan<​byte> hash,
ReadOnlySpan<​byte> signature,
HashAlgorithmName hashAlgorithm,
RSASignaturePadding padding)
Inherited from RSA
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.
Returns <see langword="true" /> if the signature is valid; otherwise, <see langword="false" /> .
hash
The hash value of the signed data.
signature
The signature data to be verified.
hashAlgorithm
The hash algorithm used to create the hash value.
padding
The padding mode.
public
void
Clear​()
Inherited from AsymmetricAlgorithm
Releases all resources used by the <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> class.
public
void
Dispose​()
Inherited from AsymmetricAlgorithm
Releases all resources used by the current instance of the <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> class.
public
byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan<​byte> passwordBytes,
PbeParameters pbeParameters)
Inherited from AsymmetricAlgorithm
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password.
Returns A byte array containing the PKCS#8 EncryptedPrivateKeyInfo representation of this key.
passwordBytes
The bytes to use as a password when encrypting the key material.
pbeParameters
The password-based encryption (PBE) parameters to use when encrypting the key material.
public
byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan<​char> password,
PbeParameters pbeParameters)
Inherited from AsymmetricAlgorithm
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password.
Returns A byte array containing the PKCS#8 EncryptedPrivateKeyInfo representation of this key.
password
The password to use when encrypting the key material.
pbeParameters
The password-based encryption (PBE) parameters to use when encrypting the key material.
public
string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan<​byte> passwordBytes,
PbeParameters pbeParameters)
Inherited from AsymmetricAlgorithm
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password, PEM encoded.
Returns A string containing the PEM-encoded PKCS#8 EncryptedPrivateKeyInfo.
passwordBytes
The bytes to use as a password when encrypting the key material.
pbeParameters
The password-based encryption (PBE) parameters to use when encrypting the key material.
public
string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan<​char> password,
PbeParameters pbeParameters)
Inherited from AsymmetricAlgorithm
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password, PEM encoded.
Returns A string containing the PEM-encoded PKCS#8 EncryptedPrivateKeyInfo.
password
The password to use when encrypting the key material.
pbeParameters
The password-based encryption (PBE) parameters to use when encrypting the key material.
public
byte[]
ExportPkcs8PrivateKey​()
Inherited from AsymmetricAlgorithm
Exports the current key in the PKCS#8 PrivateKeyInfo format.
Returns A byte array containing the PKCS#8 PrivateKeyInfo representation of this key.
public
string
ExportPkcs8PrivateKeyPem​()
Inherited from AsymmetricAlgorithm
Exports the current key in the PKCS#8 PrivateKeyInfo format, PEM encoded.
Returns A string containing the PEM-encoded PKCS#8 PrivateKeyInfo.
public
byte[]
ExportSubjectPublicKeyInfo​()
Inherited from AsymmetricAlgorithm
Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format.
Returns A byte array containing the X.509 SubjectPublicKeyInfo representation of the public-key portion of this key.
public
string
ExportSubjectPublicKeyInfoPem​()
Inherited from AsymmetricAlgorithm
Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format, PEM encoded.
Returns A string containing the PEM-encoded X.509 SubjectPublicKeyInfo.
public
bool
TryExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan<​byte> passwordBytes,
PbeParameters pbeParameters,
Span<​char> destination,
Int32& charsWritten)
Inherited from AsymmetricAlgorithm
public
bool
TryExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan<​char> password,
PbeParameters pbeParameters,
Span<​char> destination,
Int32& charsWritten)
Inherited from AsymmetricAlgorithm
public
bool
TryExportPkcs8PrivateKeyPem​(Span<​char> destination,
Int32& charsWritten)
Inherited from AsymmetricAlgorithm
public
bool
TryExportSubjectPublicKeyInfoPem​(Span<​char> destination,
Int32& charsWritten)
Inherited from AsymmetricAlgorithm
public
bool
Equals​(object obj)
Inherited from object
protected
void
Finalize​()
Inherited from object
public
int
GetHashCode​()
Inherited from object
protected
object
MemberwiseClone​()
Inherited from object
public
string
ToString​()
Inherited from object