Class KemSender
java.lang.Object
net.jrodolfo.java_evolution.java21.key_encapsulation.KemSender
Represents the sender side of a Java 21 KEM exchange.
The sender receives the receiver's public key, creates a shared secret, and creates an encapsulation message. The sender keeps the shared secret locally and sends only the encapsulation message to the receiver.
-
Method Summary
Modifier and TypeMethodDescriptionCreates the sender-side secret and the encapsulation message.static KemSenderforReceiver(PublicKey receiverPublicKey) Creates a sender that can encapsulate a secret for the supplied receiver.Returns the provider name selected by the Java Cryptography Architecture.
-
Method Details
-
forReceiver
public static KemSender forReceiver(PublicKey receiverPublicKey) throws NoSuchAlgorithmException, InvalidKeyException Creates a sender that can encapsulate a secret for the supplied receiver.- Parameters:
receiverPublicKey- the public key published by the receiver- Returns:
- a sender bound to the receiver public key
- Throws:
NoSuchAlgorithmException- if DHKEM is not available from the active providersInvalidKeyException- if the public key cannot be used for DHKEM
-
encapsulate
Creates the sender-side secret and the encapsulation message.- Returns:
- the shared secret and the message that should be sent to the receiver
-
providerName
Returns the provider name selected by the Java Cryptography Architecture.- Returns:
- the provider that implements this KEM operation
-