<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF">
<div id="compose-container" itemscope="" itemtype="https://schema.org/EmailMessage" style="direction:ltr">
<span itemprop="creator" itemscope="" itemtype="https://schema.org/Organization"><span itemprop="name"></span></span>
<div>
<div style="direction:ltr">
<div style="direction:ltr">It is however very likely that the HSM does not accept/allow/implement arbitrary curves which it does not know how to handle and optimize the arithmetics. Especially not when it also needs to create points. (And some vendors sell
 them for a premium...)</div>
</div>
<div><br>
</div>
<div style="direction:ltr">Safenet HSMs seem to only accept parameters if opt in (which turns FIPS mode off) - and those curves can be used for a limited set of mechanisms. But then again they also claim to offer named brainpool curves in recent firmwares..</div>
<div><br>
</div>
<div class="acompli_signature">
<div>Gruss</div>
<div>Bernd</div>
<div>-- </div>
<div>http://bernd.eckenfels.net</div>
</div>
</div>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> security-dev <security-dev-bounces@openjdk.java.net> on behalf of Adam Petcher <adam.petcher@oracle.com><br>
<b>Sent:</b> Wednesday, December 6, 2017 8:38:35 PM<br>
<b>To:</b> security-dev@openjdk.java.net<br>
<b>Subject:</b> Re: Support for ECParameters with explicit (not named) parameter spec</font>
<div> </div>
</div>
<div>
<p>On 12/6/2017 11:39 AM, Max Fichtelmann wrote:<br>
</p>
<blockquote type="cite"><font size="2" face="sans-serif">We use a HSM to generate ECDSA Keys and are required to use the curve brainpoolP256r1.</font><br>
<br>
<font size="2" face="sans-serif">Although the HSM does not specifically support brainpool, it is possible to generate these keys by providing the specific Curve Parameters. These curve parameters are then saved in CKA_EC_PARAMS...
</font></blockquote>
<snip><br>
<blockquote type="cite"><font size="2" face="sans-serif">When using SunPKCS11 to load the KeyPair, ECParams is used with the value of CKA_EC_PARAMS which then fails.</font><br>
<br>
<font size="2" face="sans-serif">So there are not many options I see - either patching JDK or getting the HSM-Vendor to add support for brainpool...</font><br>
</blockquote>
<br>
<font size="2">I think this problem is pretty good motivation for enhancing this code to support specified domain parameters. So if you are going to write code to fix this, please consider submitting a patch.
<br>
<br>
There may be another way to fix this problem without patching the JDK. You could develop (or locate) a JCA provider including an AlgorithmParameters service for "EC" that has this desired functionality. Install[1] this provider with a preference higher than
 SunEC, and it will be used to decode the CKA_EC_PARAMS. But note that this may also change other (unrelated) crypto behavior in your application. 
<br>
<br>
[1] <a class="moz-txt-link-freetext" href="https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec.html#ProviderInstalling">
https://docs.oracle.com/javase/8/docs/technotes/guides/security/crypto/CryptoSpec.html#ProviderInstalling</a><br>
</font></div>
</body>
</html>