System.Security.Cryptography.X25519DiffieHellman
Represents an X25519 Diffie-Hellman key.
The size of the private key, in bytes.
The size of the public key, in bytes.
The size of the secret agreement, in bytes.
Gets a value that indicates whether the algorithm is supported on the current platform.
protected X25519DiffieHellman()
Generates a new X25519 Diffie-Hellman key.
public static X25519DiffieHellman ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, ReadOnlySpan<byte> source)
Imports an X25519 Diffie-Hellman private key from a PKCS#8 EncryptedPrivateKeyInfo structure.
public static X25519DiffieHellman ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, ReadOnlySpan<byte> source)
Imports an X25519 Diffie-Hellman private key from a PKCS#8 EncryptedPrivateKeyInfo structure.
Imports an X25519 Diffie-Hellman private key from a PKCS#8 EncryptedPrivateKeyInfo structure.
public static X25519DiffieHellman ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<char> password)
Imports an X25519 Diffie-Hellman key from an encrypted RFC 7468 PEM-encoded string.
public static X25519DiffieHellman ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<byte> passwordBytes)
Imports an X25519 Diffie-Hellman key from an encrypted RFC 7468 PEM-encoded string.
Imports an X25519 Diffie-Hellman key from an RFC 7468 PEM-encoded string.
Imports an X25519 Diffie-Hellman private key from a PKCS#8 PrivateKeyInfo structure.
Imports an X25519 Diffie-Hellman key from a private key.
Imports an X25519 Diffie-Hellman key from a private key.
Imports an X25519 Diffie-Hellman key from a public key.
Imports an X25519 Diffie-Hellman key from a public key.
Imports an X25519 Diffie-Hellman key from an X.509 SubjectPublicKeyInfo structure.
Derives a raw secret agreement with the other party's key.
Derives a raw secret agreement with the other party's public key.
Derives a raw secret agreement with the other party's key, writing it into the provided buffer.
public void DeriveRawSecretAgreement(ReadOnlySpan<byte> otherPartyPublicKey, Span<byte> destination)
Derives a raw secret agreement with the other party's public key, writing it into the provided buffer.
protected abstract void DeriveRawSecretAgreementCore(X25519DiffieHellman otherParty, Span<byte> destination)
When overridden in a derived class, derives a raw secret agreement with the other party's key,
writing it into the provided buffer.
protected abstract void DeriveRawSecretAgreementCore(ReadOnlySpan<byte> otherPartyPublicKey, Span<byte> destination)
When overridden in a derived class, derives a raw secret agreement with the other party's public key,
writing it into the provided buffer.
Releases all resources used by the X25519DiffieHellman class.
Called by the Dispose() and Finalize() methods to release the managed and unmanaged
resources used by the current instance of the X25519DiffieHellman class.
public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters)
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a byte-based password.
public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbeParameters pbeParameters)
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a char-based password.
Exports the current key in the PKCS#8 EncryptedPrivateKeyInfo format with a string password.
public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters)
Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo
format, using a byte-based password.
public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, PbeParameters pbeParameters)
Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo
format, using a char-based password.
Exports the current key in a PEM-encoded representation of the PKCS#8 EncryptedPrivateKeyInfo
format, using a string password.
Exports the current key in the PKCS#8 PrivateKeyInfo format.
Exports the current key in a PEM-encoded representation of the PKCS#8 PrivateKeyInfo format.
Exports the private key.
Exports the private key into the provided buffer.
When overridden in a derived class, exports the private key into the provided buffer.
Exports the public key.
Exports the public key into the provided buffer.
When overridden in a derived class, exports the public key into the provided buffer.
Exports the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format.
Exports the public-key portion of the current key in a PEM-encoded representation of
the X.509 SubjectPublicKeyInfo format.
public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten)
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer,
using a byte-based password.
public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten)
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer,
using a char-based password.
public bool TryExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten)
Attempts to export the current key in the PKCS#8 EncryptedPrivateKeyInfo format into a provided buffer,
using a string password.
Attempts to export the current key in the PKCS#8 PrivateKeyInfo format
into the provided buffer.
When overridden in a derived class, attempts to export the current key in the PKCS#8 PrivateKeyInfo format
into the provided buffer.
Attempts to export the public-key portion of the current key in the X.509 SubjectPublicKeyInfo format
into the provided buffer.