<div dir="ltr">On Fri, Dec 5, 2014 at 8:09 AM, Roland van Rijswijk - Deij <span dir="ltr"><<a href="mailto:Roland.vanRijswijk@surfnet.nl" target="_blank">Roland.vanRijswijk@surfnet.nl</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Roko,<br>
<span class=""><br>
roko wrote:<br>
> I'm getting this error:<br>
</span>> Caused by: sun.security.pkcs11.wrapper.PKCS11Exception: CKR_DATA_LEN_RANGE<br>
<span class="">><br>
> Is this maybe a known limitation for softhsm2 ? there is some workaround<br>
> ? Thx for your help.<br>
<br>
</span>I've had a quick look at the code, and this seems to be a bug;<br>
C_EncryptUpdate always checks if the input block adheres to the cipher's<br>
required block size. It should only do this if the cipher is used in ECB<br>
mode. I have created SOFTHSM-107<br>
(<a href="https://issues.opendnssec.org/browse/SOFTHSM-107" target="_blank">https://issues.opendnssec.org/browse/SOFTHSM-107</a>) in our issue tracking<br>
system for this bug, it will be addressed in the next version of SoftHSM<br>
v2.<br></blockquote><div><br></div><div>We currently only support ECB and CBC. They require full block when not padding. Could add support for CKM_DES_CBC_PAD, CKM_DES3_CBC_PAD, and CKM_AES_CBC_PAD.</div><div><br></div><div>You are trying to use CKM_AES_CBC_PAD (AES/CBC/PKCS5Padding) which is currently not supported. The error indicate that the Java implementation is trying to use CKM_AES_CBC and not CKM_AES_CBC_PAD, which would have returned CKR_MECHANISM_INVALID.</div><div><br></div><div>// Rickard</div></div></div></div>