<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">On 3/22/2021 5:43 PM, Valerie Peng
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:H7cUOTRkQ0_-aWWCQYs3qGyz2HwrfEbUzW0mDi4gSvg=.961d0f75-b453-42a8-9d9f-659b0b5b9711@github.com">
<blockquote type="cite">
<pre class="moz-quote-pre" wrap="">This change updates SunJCE provider as below:
- updated existing AESWrap support with AES/KW/NoPadding cipher transformation.
- added support for AES/KWP/NoPadding and AES/KW/PKCS5Padding.
Existing AESWrap impl, i.e. AESWrapCipher class, is re-factored and renamed to KeyWrapCipher class. The W and W_inverse functions are moved to KWUtil class. The KW and KWP support are in the new AESKeyWrap and AESKeyWrapPadded classes which extend FeedbackCipher and used in KeyWrapCipher class. To minimize data copying, AESKeyWrap and AESKeyWrapPadded will do the crypto operation over the same input buffer which is allocated and managed by KeyWrapCipher class.
Also note that existing AESWrap impl does not take IV. However, the corresponding PKCS#11 mechanisms do, so I added support for accepting IVs to both KW and KWP.
Thanks,
Valerie
</pre>
</blockquote>
<pre class="moz-quote-pre" wrap="">
</pre>
</blockquote>
<br>
<blockquote type="cite"
cite="mid:H7cUOTRkQ0_-aWWCQYs3qGyz2HwrfEbUzW0mDi4gSvg=.961d0f75-b453-42a8-9d9f-659b0b5b9711@github.com">
<pre class="moz-quote-pre" wrap="">PR: <a class="moz-txt-link-freetext" href="https://git.openjdk.java.net/jdk/pull/2404">https://git.openjdk.java.net/jdk/pull/2404</a>
</pre>
</blockquote>
<p>KeyWrapCipher.java:<br>
<blockquote type="cite">
<pre> /**
212 * Sets the padding mechanism of this cipher. Currently, only
213 * "NoPadding" scheme is accepted for this cipher.
214 *
215 * @param padding the padding mechanism
216 *
217 * @exception NoSuchPaddingException if the requested padding mechanism
218 * does not match the supported padding scheme
219 */
220 @Override
221 protected void engineSetPadding(String padding)
222 throws NoSuchPaddingException {
223 if ((this.padding == null && !"NoPadding".equalsIgnoreCase(padding)) ||
224 this.padding instanceof PKCS5Padding &&
225 "PKCS5Padding".equalsIgnoreCase(padding)) {
226 throw new NoSuchPaddingException();
227 }
228 }</pre>
</blockquote>
</p>
<p>Shouldn't this be rejecting PKCS5Padding?</p>
<p>Actually, I keep wondering why this isn't AES/KW/NoPadding,
AES/KW/KWPPadding and AES/KW/AutoPadding where the latter doesn't
take a user provided IV, but figures out which of the two default
IV values to use based on whether the input is a multiple of the
blocksize or not? <br>
</p>
<p>Decrypting is similar - do the decryption, and check which IV you
get to figure out padded or not padded.</p>
<p>Mike</p>
<p><br>
</p>
</body>
</html>