On Fri, 10 May 2024 14:00:55 GMT, Weijun Wang <[email protected]> wrote:
>> Add `Cipher::export` API.
>
> Weijun Wang has updated the pull request incrementally with one additional
> commit since the last revision:
>
> change new method to non final
I don't think it's worth inventing a new cryptographic engine for HPKE and it
_is_ a cipher.
var g = KeyPairGenerator.getInstance("X25519");
var kp = g.generateKeyPair();
var sender = Cipher.getInstance("HPKE");
var params = HPKEParameterSpec.of()
.info("this_info".getBytes(StandardCharsets.UTF_8));
sender.init(Cipher.ENCRYPT_MODE, kp.getPublic(), params);
var receiver = Cipher.getInstance("HPKE");
receiver.init(Cipher.DECRYPT_MODE, kp.getPrivate(),
params.encapsulation(sender.getIV()));
var msg = "Hello World".getBytes(StandardCharsets.UTF_8);
var ct = sender.doFinal(msg);
var pt = receiver.doFinal(ct);
-------------
PR Comment: https://git.openjdk.org/jdk/pull/18409#issuecomment-2111349767