Package org.apache.sshd.common.kex
Class MLKEM.Server
- java.lang.Object
-
- org.apache.sshd.common.kex.MLKEM.Server
-
- All Implemented Interfaces:
KeyEncapsulationMethod.Server
- Enclosing class:
- MLKEM
private static class MLKEM.Server extends java.lang.Object implements KeyEncapsulationMethod.Server
-
-
Field Summary
Fields Modifier and Type Field Description private MLKEM.Parametersparametersprivate org.bouncycastle.crypto.SecretWithEncapsulationvalue
-
Constructor Summary
Constructors Constructor Description Server(MLKEM.Parameters parameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]getEncapsulation()Retrieves the encapsulation of the secret.intgetPublicKeyLength()Retrieves the required length of the KEM public key, in bytes.byte[]getSecret()Retrieves the secret.byte[]init(byte[] publicKey)Initializes the KEM with a public key received from a client and prepares an encapsulated secret.
-
-
-
Field Detail
-
parameters
private final MLKEM.Parameters parameters
-
value
private org.bouncycastle.crypto.SecretWithEncapsulation value
-
-
Constructor Detail
-
Server
Server(MLKEM.Parameters parameters)
-
-
Method Detail
-
getPublicKeyLength
public int getPublicKeyLength()
Description copied from interface:KeyEncapsulationMethod.ServerRetrieves the required length of the KEM public key, in bytes.- Specified by:
getPublicKeyLengthin interfaceKeyEncapsulationMethod.Server- Returns:
- the length of the key
-
init
public byte[] init(byte[] publicKey)
Description copied from interface:KeyEncapsulationMethod.ServerInitializes the KEM with a public key received from a client and prepares an encapsulated secret.- Specified by:
initin interfaceKeyEncapsulationMethod.Server- 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
-
getSecret
public byte[] getSecret()
Description copied from interface:KeyEncapsulationMethod.ServerRetrieves the secret.- Specified by:
getSecretin interfaceKeyEncapsulationMethod.Server- Returns:
- the secret, not encapsulated
-
getEncapsulation
public byte[] getEncapsulation()
Description copied from interface:KeyEncapsulationMethod.ServerRetrieves the encapsulation of the secret.- Specified by:
getEncapsulationin interfaceKeyEncapsulationMethod.Server- Returns:
- the encapsulation of the secret that may be sent to the client
-
-