<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Apr 15, 2014 at 7:11 PM, Aki Tuomi <span dir="ltr"><<a href="mailto:cmouse@cmouse.fi" target="_blank">cmouse@cmouse.fi</a>></span> wrote:<br><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">
<div class=""><div class="h5"><span style="color:rgb(34,34,34)">Also. I tested that the database ends up in VERY different state when one</span><br></div></div>
performs<br>
<br>
--export<br>
--init-token<br>
--import<br>
<br>
than it does with C_GenerateKeyPair()<br>
<br>
Is there something else one needs to do after C_GenerateKeyPair that I am<br>
not currently doing?</blockquote><div><br></div><div>The import command uses another template than what you have in your code. See the code here:</div><div><a href="https://github.com/opendnssec/SoftHSMv1/blob/develop/src/bin/softhsm.cpp#L686">https://github.com/opendnssec/SoftHSMv1/blob/develop/src/bin/softhsm.cpp#L686</a><br>
</div><div><br></div><div>E.g. CKA_TOKEN is set to true (if not present, SoftHSM will set it to false), thus keeping the public key object. The export/import commands are only handling the key material. They are simple commands and you, as a user, can only set the label and the id.</div>
<div><br></div><div>Please read more in the PKCS#11 document (<a href="ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20/pkcs-11v2-20.pdf">ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-11/v2-20/pkcs-11v2-20.pdf</a>) for more details on attributes, default values, and how objects are handled using C_CreateObject / C_GenerateKeyPair.</div>
<div><br></div><div>// Rickard</div></div></div></div>