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.​ECDiffieHellmanOpenSsl

Assembly: System.Security.Cryptography

Inheritance: object → AsymmetricAlgorithmECAlgorithmECDiffieHellman → ECDiffieHellmanOpenSsl

Provides an implementation of the Elliptic Curve Diffie-Hellman (ECDH) algorithm backed by OpenSSL.

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

PublicKey
Gets the public key that can be used by another <see cref="T:System.Security.Cryptography.ECDiffieHellman" /> object to generate a shared secret agreement.
public string
KeyExchangeAlgorithm
Gets the name of the key exchange algorithm.
public string
SignatureAlgorithm
Gets the name of the signature algorithm.
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.

Methods

DuplicateKeyHandle​()
Returns A <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" /> representation of the cryptographic key.
Gets a <see cref="T:System.Security.Cryptography.SafeEvpPKeyHandle" /> representation of the cryptographic key.
public ECParameters
ExportParameters​(bool includePrivateParameters)
includePrivateParameters <see langword="true" /> to include private parameters; otherwise, <see langword="false" /> .
Returns The key and named curve parameters used by the <see cref="T:System.Security.Cryptography.ECCurve" /> object.
Exports the key used by the <see cref="T:System.Security.Cryptography.ECCurve" /> object into an <see cref="T:System.Security.Cryptography.ECParameters" /> object.
public void
ImportParameters​(ECParameters parameters)
parameters The curve's parameters to import.
Imports the specified parameters for an <see cref="T:System.Security.Cryptography.ECCurve" /> object as a key into the current instance.
public byte[]
DeriveKeyFromHash​(ECDiffieHellmanPublicKey otherPartyPublicKey, HashAlgorithmName hashAlgorithm)
Inherited from ECDiffieHellman
otherPartyPublicKey The other party's public key.
hashAlgorithm The hash algorithm to use to derive the key material.
Returns The hash of the shared secret.
Performs key derivation using a specified hash algorithm.
public byte[]
DeriveKeyFromHash​(ECDiffieHellmanPublicKey otherPartyPublicKey, HashAlgorithmName hashAlgorithm, byte[] secretPrepend, byte[] secretAppend)
Inherited from ECDiffieHellman
otherPartyPublicKey The other party's public key.
hashAlgorithm The hash algorithm to use to derive the key material.
secretPrepend A value to prepend to the derived secret before hashing.
secretAppend A value to append to the derived secret before hashing.
Returns The hash of the shared secret after prepending or appending data as requested.
When implemented in a derived class, performs key derivation using a specified hash algorithm with optional prepended or appended data.
public byte[]
DeriveKeyFromHmac​(ECDiffieHellmanPublicKey otherPartyPublicKey, HashAlgorithmName hashAlgorithm, byte[] hmacKey)
Inherited from ECDiffieHellman
otherPartyPublicKey The other party's public key.
hashAlgorithm The hash algorithm to use to derive the key material.
hmacKey The key for the HMAC.
Returns The HMAC of the shared secret.
Performs key derivation using a specified HMAC (Hash-based Message Authentication Code) algorithm.
public byte[]
DeriveKeyFromHmac​(ECDiffieHellmanPublicKey otherPartyPublicKey, HashAlgorithmName hashAlgorithm, byte[] hmacKey, byte[] secretPrepend, byte[] secretAppend)
Inherited from ECDiffieHellman
otherPartyPublicKey The other party's public key.
hashAlgorithm The hash algorithm to use to derive the key material.
hmacKey The key for the HMAC.
secretPrepend A value to prepend to the derived secret before hashing.
secretAppend A value to append to the derived secret before hashing.
Returns The HMAC of the shared secret after prepending or appending data as requested.
When implemented in a derived class, performs key derivation using a specified HMAC (Hash-based Message Authentication Code) algorithm with optional prepended or appended data.
public byte[]
DeriveKeyMaterial​(ECDiffieHellmanPublicKey otherPartyPublicKey)
Inherited from ECDiffieHellman
otherPartyPublicKey The other party's public key.
Returns The result of the key derivation function, using the shared secret as an input.
When implemented in a derived class, performs a key derivation on the shared secret.
public byte[]
DeriveKeyTls​(ECDiffieHellmanPublicKey otherPartyPublicKey, byte[] prfLabel, byte[] prfSeed)
Inherited from ECDiffieHellman
otherPartyPublicKey The other party's public key.
prfLabel The ASCII-encoded PRF label.
prfSeed The 64-byte PRF seed.
Returns The first 48 bytes from the TLS 1.1 PRF, using the shared secret as the key.
When implemented in a derived class, performs key derivation using the TLS (Transport Layer Security) 1.1 PRF (Pseudo-Random Function).
public byte[]
DeriveRawSecretAgreement​(ECDiffieHellmanPublicKey otherPartyPublicKey)
Inherited from ECDiffieHellman
otherPartyPublicKey The public key of the party with which to derive a mutual secret.
Returns The raw key agreement.
Derive raw key material.
public void
FromXmlString​(string xmlString)
Inherited from ECDiffieHellman
xmlString The XML string to use to reconstruct the <see cref="T:System.Security.Cryptography.AsymmetricAlgorithm" /> object.
This method throws in all cases.
public string
ToXmlString​(bool includePrivateParameters)
Inherited from ECDiffieHellman
includePrivateParameters <see langword="true" /> to include private parameters; otherwise, <see langword="false" /> .
Returns This method does not return a value.
This method throws in all cases.
public byte[]
ExportECPrivateKey​()
Inherited from ECAlgorithm
Returns A byte array containing the ECPrivateKey representation of this key.
Exports the current key in the ECPrivateKey format.
public string
ExportECPrivateKeyPem​()
Inherited from ECAlgorithm
Returns A string containing the PEM-encoded ECPrivateKey.
Exports the current key in the ECPrivateKey format, PEM encoded.
public ECParameters
ExportExplicitParameters​(bool includePrivateParameters)
Inherited from ECAlgorithm
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 void
GenerateKey​(ECCurve curve)
Inherited from ECAlgorithm
curve The curve to use.
When overridden in a derived class, generates a new public/private keypair for the specified curve.
public void
ImportECPrivateKey​(ReadOnlySpan`1 source, Int32& bytesRead)
Inherited from ECAlgorithm
public void
ImportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 passwordBytes, ReadOnlySpan`1 source, Int32& bytesRead)
Inherited from ECAlgorithm
public void
ImportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password, ReadOnlySpan`1 source, Int32& bytesRead)
Inherited from ECAlgorithm
public void
ImportFromEncryptedPem​(ReadOnlySpan`1 input, ReadOnlySpan`1 passwordBytes)
Inherited from ECAlgorithm
public void
ImportFromEncryptedPem​(ReadOnlySpan`1 input, ReadOnlySpan`1 password)
Inherited from ECAlgorithm
public void
ImportFromPem​(ReadOnlySpan`1 input)
Inherited from ECAlgorithm
public void
ImportPkcs8PrivateKey​(ReadOnlySpan`1 source, Int32& bytesRead)
Inherited from ECAlgorithm
public void
ImportSubjectPublicKeyInfo​(ReadOnlySpan`1 source, Int32& bytesRead)
Inherited from ECAlgorithm
public bool
TryExportECPrivateKey​(Span`1 destination, Int32& bytesWritten)
Inherited from ECAlgorithm
public bool
TryExportECPrivateKeyPem​(Span`1 destination, Int32& charsWritten)
Inherited from ECAlgorithm
public bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 passwordBytes, PbeParameters pbeParameters, Span`1 destination, Int32& bytesWritten)
Inherited from ECAlgorithm
public bool
TryExportEncryptedPkcs8PrivateKey​(ReadOnlySpan`1 password, PbeParameters pbeParameters, Span`1 destination, Int32& bytesWritten)
Inherited from ECAlgorithm
public bool
TryExportPkcs8PrivateKey​(Span`1 destination, Int32& bytesWritten)
Inherited from ECAlgorithm
public bool
TryExportSubjectPublicKeyInfo​(Span`1 destination, Int32& bytesWritten)
Inherited from ECAlgorithm
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.
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 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
public Type
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object