RFR: 8325513: Export method for Cipher [v3]
Weijun Wang
weijun at openjdk.org
Wed May 15 00:05:04 UTC 2024
On Fri, 10 May 2024 14:00:55 GMT, Weijun Wang <weijun at openjdk.org> 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
More information about the security-dev
mailing list