System.Security.Cryptography.Hpke
Represents a Hybrid Public Key Encryption (HPKE) key.
Gets the cipher suite associated with this key.
Initializes a new instance of the Hpke class with the specified cipher suite.
Derives an HPKE key for the specified cipher suite from input keying material.
Derives an HPKE key for the specified cipher suite from input keying material.
Generates a new HPKE key for the specified cipher suite.
Imports an HPKE key pair from a serialized decapsulation key.
Imports an HPKE key pair from a serialized decapsulation key.
Imports an HPKE key from a serialized encapsulation key.
Imports an HPKE key from a serialized encapsulation key.
Determines whether the specified cipher suite is supported on the current platform.
public HpkeRecipient CreatePskRecipient(ReadOnlySpan<byte> encapsulatedSecret, ReadOnlySpan<byte> psk, ReadOnlySpan<byte> pskId, ReadOnlySpan<byte> info = default)
Creates an HPKE recipient context using a pre-shared key.
public HpkeRecipient CreatePskRecipient(byte[] encapsulatedSecret, byte[] psk, byte[] pskId, byte[] info = null)
Creates an HPKE recipient context using a pre-shared key.
protected abstract HpkeRecipient CreatePskRecipientCore(ReadOnlySpan<byte> encapsulatedSecret, ReadOnlySpan<byte> info, ReadOnlySpan<byte> psk, ReadOnlySpan<byte> pskId)
When overridden in a derived class, creates an HPKE recipient context using a pre-shared key.
public HpkeSender CreatePskSender(ReadOnlySpan<byte> psk, ReadOnlySpan<byte> pskId, out byte encapsulatedSecret, ReadOnlySpan<byte> info = default)
Creates an HPKE sender context using a pre-shared key.
public HpkeSender CreatePskSender(byte[] psk, byte[] pskId, out byte encapsulatedSecret, byte[] info = null)
Creates an HPKE sender context using a pre-shared key.
public HpkeSender CreatePskSender(ReadOnlySpan<byte> psk, ReadOnlySpan<byte> pskId, Span<byte> encapsulatedSecret, ReadOnlySpan<byte> info = default)
Creates an HPKE sender context using a pre-shared key and writes the encapsulated secret into the provided buffer.
protected abstract HpkeSender CreatePskSenderCore(Span<byte> encapsulatedSecret, ReadOnlySpan<byte> info, ReadOnlySpan<byte> psk, ReadOnlySpan<byte> pskId)
When overridden in a derived class, creates an HPKE sender context using a pre-shared key.
public HpkeRecipient CreateRecipient(ReadOnlySpan<byte> encapsulatedSecret, ReadOnlySpan<byte> info = default)
Creates an HPKE recipient context using Base mode.
Creates an HPKE recipient context using Base mode.
protected abstract HpkeRecipient CreateRecipientCore(ReadOnlySpan<byte> encapsulatedSecret, ReadOnlySpan<byte> info)
When overridden in a derived class, creates an HPKE recipient context using Base mode.
Creates an HPKE sender context using Base mode.
Creates an HPKE sender context using Base mode and writes the encapsulated secret
into the provided buffer.
protected abstract HpkeSender CreateSenderCore(Span<byte> encapsulatedSecret, ReadOnlySpan<byte> info)
When overridden in a derived class, creates an HPKE sender context using Base mode.
Releases all resources used by the Hpke class.
Called by the Dispose() and Finalize() methods to release the managed and unmanaged
resources used by the current instance of the Hpke class.
Exports the decapsulation key.
Exports the decapsulation key into the provided buffer.
When overridden in a derived class, exports the decapsulation key into the provided buffer.
Exports the encapsulation key.
Exports the encapsulation key into the provided buffer.
When overridden in a derived class, exports the encapsulation key into the provided buffer.
public byte[] Open(ReadOnlySpan<byte> encapsulatedSecret, ReadOnlySpan<byte> ciphertext, ReadOnlySpan<byte> associatedData = default, ReadOnlySpan<byte> info = default)
Decrypts a single HPKE ciphertext using Base mode.
public byte[] Open(byte[] encapsulatedSecret, byte[] ciphertext, byte[] associatedData = null, byte[] info = null)
Decrypts a single HPKE ciphertext using Base mode.
public void Open(ReadOnlySpan<byte> encapsulatedSecret, ReadOnlySpan<byte> ciphertext, Span<byte> plaintext, ReadOnlySpan<byte> associatedData = default, ReadOnlySpan<byte> info = default)
Decrypts a single HPKE ciphertext into the provided buffer using Base mode.
protected abstract void OpenCore(ReadOnlySpan<byte> encapsulatedSecret, ReadOnlySpan<byte> ciphertext, Span<byte> plaintext, ReadOnlySpan<byte> associatedData, ReadOnlySpan<byte> info)
When overridden in a derived class, decrypts a single HPKE ciphertext
using Base mode.
public void Seal(ReadOnlySpan<byte> plaintext, out byte encapsulatedSecret, out byte ciphertext, ReadOnlySpan<byte> associatedData = default, ReadOnlySpan<byte> info = default)
Encrypts a single message using Base mode.
public void Seal(byte[] plaintext, out byte encapsulatedSecret, out byte ciphertext, byte[] associatedData = null, byte[] info = null)
Encrypts a single message using Base mode.
public void Seal(ReadOnlySpan<byte> plaintext, Span<byte> encapsulatedSecret, Span<byte> ciphertext, ReadOnlySpan<byte> associatedData = default, ReadOnlySpan<byte> info = default)
Encrypts a single message into the provided buffers using Base mode.
protected abstract void SealCore(ReadOnlySpan<byte> plaintext, Span<byte> encapsulatedSecret, Span<byte> ciphertext, ReadOnlySpan<byte> associatedData, ReadOnlySpan<byte> info)
When overridden in a derived class, encrypts a single message using Base mode.