Package org.apache.sshd.common.kex
Interface KeyEncapsulationMethod.Server
- Enclosing interface:
KeyEncapsulationMethod
public static interface KeyEncapsulationMethod.Server
Server-side KEM operations.
-
Method Summary
Modifier and TypeMethodDescriptionbyte[]Retrieves the encapsulation of the secret.intRetrieves the required length of the KEM public key, in bytes.byte[]Retrieves the secret.byte[]init(byte[] publicKey) Initializes the KEM with a public key received from a client and prepares an encapsulated secret.
-
Method Details
-
getPublicKeyLength
int getPublicKeyLength()Retrieves the required length of the KEM public key, in bytes.- Returns:
- the length of the key
-
init
byte[] init(byte[] publicKey) Initializes the KEM with a public key received from a client and prepares an encapsulated secret.- Parameters:
publicKey- data received from the client, expected to contain the public key at the start- Returns:
- the remaining bytes of
publicKeyafter the public key - Throws:
IllegalArgumentException- ifpublicKeydoes not have enough bytes for a valid public keyNullPointerException- ifpublicKey == null
-
getSecret
byte[] getSecret()Retrieves the secret.- Returns:
- the secret, not encapsulated
-
getEncapsulation
byte[] getEncapsulation()Retrieves the encapsulation of the secret.- Returns:
- the encapsulation of the secret that may be sent to the client
-