Top Description Inners Methods
org.apache.sshd.common.kex

public Interface KeyEncapsulationMethod

Known Direct Implementers
org.apache.sshd.common.kex.BuiltinKEM

General interface for key encapsulation methods (KEM).

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
KeyEncapsulationMethod.Client

Client-side KEM operations.

public static interface
KeyEncapsulationMethod.Server

Server-side KEM operations.

Method Summary

Modifier and TypeMethod and Description
public KeyEncapsulationMethod.Client
public KeyEncapsulationMethod.Server

Method Detail

getClientback to summary
public KeyEncapsulationMethod.Client getClient()
getServerback to summary
public KeyEncapsulationMethod.Server getServer()
org.apache.sshd.common.kex back to summary

public Interface KeyEncapsulationMethod.Client

Known Direct Implementers
org.apache.sshd.common.kex.MLKEM.Client, org.apache.sshd.common.kex.SNTRUP761.Client

Client-side KEM operations.

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

the secret from an encapsulation ciphertext.
extractSecret
(byte[]
ciphertext to process.
encapsulated
)

Extracts the secret from an encapsulation ciphertext.

public int

Returns:

the length required for a valid encapsulation ciphertext.
getEncapsulationLength
()

Gets the required encapsulation length in bytes.

public byte[]

Returns:

the KEM public key.
getPublicKey
()

Gets the KEM public key.

public void
init()

Initializes the KEM and generates a new key pair.

Method Detail

extractSecretback to summary
public byte[] extractSecret(byte[] encapsulated)

Extracts the secret from an encapsulation ciphertext.

Parameters
encapsulated:byte[]

ciphertext to process.

Returns:byte[]

the secret from an encapsulation ciphertext.

Exceptions
IllegalArgumentException:
if encapsulated doesn't have the expected length
NullPointerException:
if encapsulated == null
getEncapsulationLengthback to summary
public int getEncapsulationLength()

Gets the required encapsulation length in bytes.

Returns:int

the length required for a valid encapsulation ciphertext.

getPublicKeyback to summary
public byte[] getPublicKey()

Gets the KEM public key.

Returns:byte[]

the KEM public key.

initback to summary
public void init()

Initializes the KEM and generates a new key pair.

org.apache.sshd.common.kex back to summary

public Interface KeyEncapsulationMethod.Server

Known Direct Implementers
org.apache.sshd.common.kex.MLKEM.Server, org.apache.sshd.common.kex.SNTRUP761.Server

Server-side KEM operations.

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

the encapsulation of the secret that may be sent to the client
getEncapsulation
()

Retrieves the encapsulation of the secret.

public int

Returns:

the length of the key
getPublicKeyLength
()

Retrieves the required length of the KEM public key, in bytes.

public byte[]

Returns:

the secret, not encapsulated
getSecret
()

Retrieves the secret.

public byte[]

Returns:

the remaining bytes of publicKey after the public key
init
(byte[]
data received from the client, expected to contain the public key at the start
publicKey
)

Initializes the KEM with a public key received from a client and prepares an encapsulated secret.

Method Detail

getEncapsulationback to summary
public byte[] getEncapsulation()

Retrieves the encapsulation of the secret.

Returns:byte[]

the encapsulation of the secret that may be sent to the client

getPublicKeyLengthback to summary
public int getPublicKeyLength()

Retrieves the required length of the KEM public key, in bytes.

Returns:int

the length of the key

getSecretback to summary
public byte[] getSecret()

Retrieves the secret.

Returns:byte[]

the secret, not encapsulated

initback to summary
public byte[] init(byte[] publicKey)

Initializes the KEM with a public key received from a client and prepares an encapsulated secret.

Parameters
publicKey:byte[]

data received from the client, expected to contain the public key at the start

Returns:byte[]

the remaining bytes of publicKey after the public key

Exceptions
IllegalArgumentException:
if publicKey does not have enough bytes for a valid public key
NullPointerException:
if publicKey == null