<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
<div dir="ltr" data-ogsc="" style="">
<div></div>
<div>
<div>BTW stupid - somewhat related - question, why does the nonce to be parsed out of a DER blob, shouldn’t there be an getter on the Parameter Spec object? Many protocols would need the raw array, is there a matching spec - or should we add one?</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">Gruss</div>
<div dir="ltr">Bernd</div>
<div class="ms-outlook-ios-signature" id="ms-outlook-mobile-signature">
<div style="direction: ltr">-- </div>
<div style="direction: ltr">http://bernd.eckenfels.net</div>
</div>
</div>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Von:</b> security-dev <security-dev-retn@openjdk.java.net> im Auftrag von Jamil Nimeh <jnimeh@openjdk.java.net><br>
<b>Gesendet:</b> Monday, December 7, 2020 9:05:16 PM<br>
<b>An:</b> security-dev@openjdk.java.net <security-dev@openjdk.java.net><br>
<b>Betreff:</b> Re: RFR: 8257769: Cipher.getParameters() throws NPE for ChaCha20-Poly1305 [v2]</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Mon, 7 Dec 2020 19:53:27 GMT, Valerie Peng <valeriep@openjdk.org> wrote:<br>
<br>
>> Jamil Nimeh has updated the pull request incrementally with one additional commit since the last revision:<br>
>> <br>
>>   pre-init getParameters nonce data is now a local variable<br>
><br>
> src/java.base/share/classes/com/sun/crypto/provider/ChaCha20Cipher.java line 232:<br>
> <br>
>> 230:             // this call should cause a random nonce to be generated, but<br>
>> 231:             // not attached to the object.<br>
>> 232:             byte[] nonceData = initialized ? nonce : createRandomNonce(null);<br>
> <br>
> The "initialized" variable is set to false in engineDoFinal() call. So, if users call getParameters() after finish cipher operation, this will return random nonces instead of the one used in previous doFinal operation. Will this be a little un-intuitive?<br>
<br>
Unintuitive is a charitable way to put it.  After doFinal the Cipher technically isn't in an uninitialized state per the spec, it's supposed to be in the state it would be immediately following init().  So the wrong behavior would happen in this use case. 
 Will fix.<br>
<br>
-------------<br>
<br>
PR: <a href="https://git.openjdk.java.net/jdk/pull/1644">https://git.openjdk.java.net/jdk/pull/1644</a><br>
</div>
</span></font></div>
</body>
</html>