<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">
Hi Martin.
<div><br>
</div>
<div>To be brief, we will be removing the length parameter from the deriveKey arguments list. There was some thought that there may be a use-case where the caller would not want to use all the generated entropy, but at this time, we have no valid use-case for
this in the current API design. </div>
<div><br>
</div>
<div>This version of the API reflects our intention for a stateless API design (or put another way, that the “deriveKey/deriveData” calls are one-and-done operations). </div>
<div><br>
</div>
<div>As for the PKCS#11 questions you pose: </div>
<div><br>
</div>
<div>1) The PRK is not required to be a byte[]. We have considered the PKCS#11 case, and the caller will not need to re-derive the PRK each time. </div>
<div><br>
</div>
<div>2) Furthermore, state does not need to be maintained between calls to the deriveKey/deriveData methods, since the parameters from an extract (including the PRK) can be passed to any successive expand calls.</div>
<div><br>
</div>
<div>Perhaps it will be helpful/demonstrative for us to include some finer details about the HKDFParameterSpec class in the JEP write-up. </div>
<div><br>
</div>
<div>More soon. </div>
<div><br>
</div>
<div>Thanks!</div>
<div>
<div><br class="Apple-interchange-newline">
<span><img alt="image001.png" src="cid:image001.png@01D9DC17.6017C7B0" width="86"></span><br style="font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica;">
<font face="OracleSans-Regular" style="font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0);"><span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Kevin
Driver</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Mobile:
+1.512.431.5690</span><br style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-variant-caps: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">Java
Security Libraries</span></font><br style="font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica;">
</div>
<div><br>
<blockquote type="cite">
<div>On Mar 12, 2024, at 4:25 PM, Martin Balao <mbalao@redhat.com> wrote:</div>
<br class="Apple-interchange-newline">
<div>
<div>Hi Kevin,<br>
<br>
When looking at the proposed API, I noticed that the length of a derived key or data can be potentially passed both as part of a KDFParameterSpec and as a KDF::deriveKey or KDF::deriveData parameter. This is the case for HKDF (HKDFParameterSpec) apparently.
Having a length value on two places makes me think about all the possible combinations. By just reading the API, one cannot tell what could happen if values were different. It may be handled by the KDF class implementation or passed through to the SPI. One
interpretation is that the length parameter (if valid) enforces a maximum to the output value in HKDFParameterSpec, and an error is thrown if the latter is smaller than the former. However, one of them could be invalid and that could lead to an error. Another
interpretation would be that there is a check preventing these values to be different. I would like to hear your thoughts on this issue. Perhaps it is worth exploring a way to remove ambiguity or adding a note to the JEP. E.g. do we need to specify a len parameter
or can we leave it for KDFParameterSpec to specify it and the key is built consuming all the output generated? Does it make sense to generate more output than what we are going to consume for a key? Looks like the extra output will be lost.<br>
<br>
For some security providers, it may be interesting to keep state between KDF::deriveKey or KDF::deriveData calls in the HKDF algorithm, particularly during the expansion phase. For example, PKCS #11 providers will need the PRK as a key ID for the native C_DeriveKey
call. If the HKDFParameterSpec forces the PRK to be a byte[], then each expansion call pays the cost of creating the key again in the token. This observation was made by @Francisco (on CC). Will the KDF class enforce the use of well-known KDFParameterSpec
implementations such as HKDFParameterSpec or will it be open to each provider —e.g. engineGetParameters type of API—? In the latter case, will the call from JSSE be such that we can keep/carry state between extraction and expansion?<br>
<br>
Thanks,<br>
Martin.-<br>
<br>
<br>
On 3/1/24 16:08, Kevin Driver wrote:<br>
<blockquote type="cite">Hi All,<br>
As discussed a few months ago [1], we are working on providing a new API for KDF (Key Derivation Functions). There will be a KDF class for users, a KDFSpi class for security providers, and several other parameter classes. We plan to add support for HKDF (RFC-5869).<br>
For more details, see the updated draft JEP at: https://openjdk.org/jeps/8189808 <https://openjdk.org/jeps/8189808><br>
As before, we look forward to your feedback on the proposal.<br>
[1] https://mail.openjdk.org/pipermail/security-dev/2023-July/036642.html <https://mail.openjdk.org/pipermail/security-dev/2023-July/036642.html><br>
Thanks,<br>
image001.png<br>
Kevin Driver<br>
Java Security Libraries<br>
</blockquote>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</body>
</html>