<PackageReference Include="Microsoft.Bcl.Cryptography" Version="11.0.0-preview.7.26381.103" />

System.Security.Cryptography.X25519DiffieHellman

public abstract class X25519DiffieHellman : IDisposable
Represents an X25519 Diffie-Hellman key.
namespace System.Security.Cryptography { public abstract class X25519DiffieHellman : IDisposable { private protected delegate void WriteKeyFunc<TState> (TState state, Span<byte> destination); public const int SecretAgreementSizeInBytes = 32; public const int PrivateKeySizeInBytes = 32; public const int PublicKeySizeInBytes = 32; public static bool IsSupported { get; } public byte[] DeriveRawSecretAgreement(X25519DiffieHellman otherParty); public byte[] DeriveRawSecretAgreement(byte[] otherPartyPublicKey); public void DeriveRawSecretAgreement(X25519DiffieHellman otherParty, Span<byte> destination); public void DeriveRawSecretAgreement(ReadOnlySpan<byte> otherPartyPublicKey, Span<byte> destination); public static X25519DiffieHellman GenerateKey(); public byte[] ExportPrivateKey(); public void ExportPrivateKey(Span<byte> destination); public byte[] ExportPublicKey(); public void ExportPublicKey(Span<byte> destination); public bool TryExportSubjectPublicKeyInfo(Span<byte> destination, out int bytesWritten); public byte[] ExportSubjectPublicKeyInfo(); public string ExportSubjectPublicKeyInfoPem(); public bool TryExportPkcs8PrivateKey(Span<byte> destination, out int bytesWritten); public byte[] ExportPkcs8PrivateKey(); public string ExportPkcs8PrivateKeyPem(); public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten); public bool TryExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten); public bool TryExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeParameters, Span<byte> destination, out int bytesWritten); public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters); public byte[] ExportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, PbeParameters pbeParameters); public byte[] ExportEncryptedPkcs8PrivateKey(string password, PbeParameters pbeParameters); public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<byte> passwordBytes, PbeParameters pbeParameters); public string ExportEncryptedPkcs8PrivateKeyPem(ReadOnlySpan<char> password, PbeParameters pbeParameters); public string ExportEncryptedPkcs8PrivateKeyPem(string password, PbeParameters pbeParameters); protected abstract void DeriveRawSecretAgreementCore(X25519DiffieHellman otherParty, Span<byte> destination); protected abstract void DeriveRawSecretAgreementCore(ReadOnlySpan<byte> otherPartyPublicKey, Span<byte> destination); protected abstract void ExportPrivateKeyCore(Span<byte> destination); protected abstract void ExportPublicKeyCore(Span<byte> destination); protected abstract bool TryExportPkcs8PrivateKeyCore(Span<byte> destination, out int bytesWritten); public static X25519DiffieHellman ImportPrivateKey(byte[] source); public static X25519DiffieHellman ImportPrivateKey(ReadOnlySpan<byte> source); public static X25519DiffieHellman ImportPublicKey(byte[] source); public static X25519DiffieHellman ImportPublicKey(ReadOnlySpan<byte> source); public static X25519DiffieHellman ImportSubjectPublicKeyInfo(ReadOnlySpan<byte> source); public static X25519DiffieHellman ImportSubjectPublicKeyInfo(byte[] source); public static X25519DiffieHellman ImportPkcs8PrivateKey(ReadOnlySpan<byte> source); public static X25519DiffieHellman ImportPkcs8PrivateKey(byte[] source); public static X25519DiffieHellman ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<byte> passwordBytes, ReadOnlySpan<byte> source); public static X25519DiffieHellman ImportEncryptedPkcs8PrivateKey(ReadOnlySpan<char> password, ReadOnlySpan<byte> source); public static X25519DiffieHellman ImportEncryptedPkcs8PrivateKey(string password, byte[] source); public static X25519DiffieHellman ImportFromPem(ReadOnlySpan<char> source); public static X25519DiffieHellman ImportFromPem(string source); public static X25519DiffieHellman ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<char> password); public static X25519DiffieHellman ImportFromEncryptedPem(ReadOnlySpan<char> source, ReadOnlySpan<byte> passwordBytes); public static X25519DiffieHellman ImportFromEncryptedPem(string source, string password); public static X25519DiffieHellman ImportFromEncryptedPem(string source, byte[] passwordBytes); public void Dispose(); protected virtual void Dispose(bool disposing); protected X25519DiffieHellman(); } }