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.​ECAlgorithm
Assembly: System.Security.Cryptography
Inheritance: object → AsymmetricAlgorithm → ECAlgorithm
Represents the abstract class from which elliptic-curve asymmetric algorithms can 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
byte[]
ExportECPrivateKey​() Returns A byte array containing the ECPrivateKey representation of this key.
Exports the current key in the ECPrivateKey format.
public
string
ExportECPrivateKeyPem​() Returns A string containing the PEM-encoded ECPrivateKey.
Exports the current key in the ECPrivateKey format, PEM encoded.
public
ECParameters
ExportExplicitParameters​(bool includePrivateParameters)
includePrivateParameters
<see langword="true" /> to include private parameters, otherwise, <see langword="false" /> .
Returns The exported explicit parameters.
When overridden in a derived class, exports the explicit <see cref="T:System.Security.Cryptography.ECParameters" /> for an ECCurve.
public
ECParameters
ExportParameters​(bool includePrivateParameters)
includePrivateParameters
<see langword="true" /> to include private parameters, otherwise, <see langword="false" /> .
Returns The exported parameters.
When overridden in a derived class, exports the named or explicit <see cref="T:System.Security.Cryptography.ECParameters" /> for an ECCurve.
If the curve has a name, the Curve property will contain named curve parameters otherwise it will contain explicit parameters.
When overridden in a derived class, generates a new public/private keypair for the specified curve.
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
void
ImportParameters​(ECParameters parameters)
parameters
The curve parameters.
When overridden in a derived class, imports the specified <see cref="T:System.Security.Cryptography.ECParameters" /> .
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)
Releases all resources used by the <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> class.
Releases all resources used by the current instance of the <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> class.
protected
void
Dispose​(bool disposing)
Inherited from AsymmetricAlgorithm
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)
Inherited from AsymmetricAlgorithm
public
byte[]
ExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password,
PbeParameters pbeParameters)
Inherited from AsymmetricAlgorithm
public
string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 passwordBytes,
PbeParameters pbeParameters)
Inherited from AsymmetricAlgorithm
public
string
ExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 password,
PbeParameters pbeParameters)
Inherited from AsymmetricAlgorithm
public
byte[]
ExportPkcs8PrivateKey​()
Inherited from AsymmetricAlgorithm
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​()
Inherited from AsymmetricAlgorithm
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​()
Inherited from AsymmetricAlgorithm
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​()
Inherited from AsymmetricAlgorithm
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)
Inherited from AsymmetricAlgorithm
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
string
ToXmlString​(bool includePrivateParameters)
Inherited from AsymmetricAlgorithm
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
TryExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 passwordBytes,
PbeParameters pbeParameters,
Span`1 destination,
Int32& charsWritten)
Inherited from AsymmetricAlgorithm
public
bool
TryExportEncryptedPkcs8PrivateKeyPem​(ReadOnlySpan`1 password,
PbeParameters pbeParameters,
Span`1 destination,
Int32& charsWritten)
Inherited from AsymmetricAlgorithm
public
bool
TryExportPkcs8PrivateKeyPem​(Span`1 destination,
Int32& charsWritten)
Inherited from AsymmetricAlgorithm
public
bool
TryExportSubjectPublicKeyInfoPem​(Span`1 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