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.​AsymmetricAlgorithm
Assembly: System.Security.Cryptography
Inheritance: object → AsymmetricAlgorithm
Represents the abstract base class from which all implementations of asymmetric algorithms must inherit.
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
string
KeyExchangeAlgorithm
When overridden in a derived class, gets the name of the key exchange algorithm. Otherwise, throws an <see cref="T:System.NotImplementedException" /> .
public
int
KeySize
Gets or sets the size, in bits, of the key modulus used by the asymmetric algorithm.
public
KeySizes[]
LegalKeySizes
Gets the key sizes that are supported by the asymmetric algorithm.
public
string
SignatureAlgorithm
When implemented in a derived class, gets the name of the signature algorithm. Otherwise, always throws a <see cref="T:System.NotImplementedException" /> .
Methods
public
void
Clear​()
Releases all resources used by the <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> class.
public
void
Dispose​()
Releases all resources used by the current instance of the <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> class.
protected
void
Dispose​(bool disposing)
disposing
<see langword="true" /> to release both managed and unmanaged resources; <see langword="false" /> to release only unmanaged resources.
Releases the unmanaged resources used by the <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> class and optionally releases the managed resources.
public
byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 passwordBytes,
PbeParameters pbeParameters)
public
byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password,
PbeParameters pbeParameters)
public
string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 passwordBytes,
PbeParameters pbeParameters)
public
string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 password,
PbeParameters pbeParameters)
public
byte[]
ExportPkcs8PrivateKey​() Returns A byte array containing the PKCS#8 PrivateKeyInfo representation of this key.
Exports the current key in the PKCS#8 PrivateKeyInfo format.
public
string
ExportPkcs8PrivateKeyPem​() Returns A string containing the PEM-encoded PKCS#8 PrivateKeyInfo.
Exports the current key in the PKCS#8 PrivateKeyInfo format, PEM encoded.
public
byte[]
ExportSubjectPublicKeyInfo​() Returns A byte array containing the X.509 SubjectPublicKeyInfo representation of the public-key portion of this key.
Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format.
public
string
ExportSubjectPublicKeyInfoPem​() Returns A string containing the PEM-encoded X.509 SubjectPublicKeyInfo.
Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format, PEM encoded.
public
void
FromXmlString​(string xmlString)
xmlString
The XML string to use to reconstruct the <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> object.
When overridden in a derived class, reconstructs an <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> object from an XML string. Otherwise, throws a <see cref="T:System.NotImplementedException" /> .
public
void
ImportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 passwordBytes,
ReadOnlySpan`1 source,
Int32& bytesRead)
public
void
ImportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password,
ReadOnlySpan`1 source,
Int32& bytesRead)
public
void
ImportFromEncryptedPem​(ReadOnlySpan`1 input,
ReadOnlySpan`1 passwordBytes)
public
string
ToXmlString​(bool includePrivateParameters)
includePrivateParameters
<see langword="true" /> to include private parameters; otherwise, <see langword="false" /> .
Returns An XML string encoding of the current <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> object.
When overridden in a derived class, creates and returns an XML string representation of the current <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> object. Otherwise, throws a <see cref="T:System.NotImplementedException" /> .
public
bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 passwordBytes,
PbeParameters pbeParameters,
Span`1 destination,
Int32& bytesWritten)
public
bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password,
PbeParameters pbeParameters,
Span`1 destination,
Int32& bytesWritten)
public
bool
TryExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 passwordBytes,
PbeParameters pbeParameters,
Span`1 destination,
Int32& charsWritten)
public
bool
TryExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 password,
PbeParameters pbeParameters,
Span`1 destination,
Int32& charsWritten)
public
bool
TryExportSubjectPublicKeyInfoPem​(Span`1 destination,
Int32& charsWritten)
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