PKCS#11 stuff: "sign-only" vs "crypto-accelerator"

Evan Hunt each at isc.org
Wed Feb 10 18:09:10 UTC 2010


> But if I build openssl in "crypto-accelerator" mode I stumble on
> dnssec-keyfromlabel:
> 
> mango:/tmp#pkcs11-list 
> Enter Pin: 
> mango:/tmp#pkcs11-keygen -b 2048 -l johani.se-ksk
> Enter Pin: 
> mango:/tmp#pkcs11-keygen -b 1024 -l johani.se-zsk
> Enter Pin: 
> mango:/tmp#pkcs11-list 
> Enter Pin: 
> object[0]: handle 4 class 2 label[13] 'johani.se-zsk' id[0] 
> object[1]: handle 3 class 3 label[13] 'johani.se-zsk' id[0] 
> object[2]: handle 2 class 2 label[13] 'johani.se-ksk' id[0] 
> object[3]: handle 1 class 3 label[13] 'johani.se-ksk' id[0] 
> mango:/tmp#dnssec-keyfromlabel -l johani.se-ksk -f KSK johani.se
> dnssec-keyfromlabel: fatal: failed to get key johani.se/RSASHA1: not found

What kind of HSM are you using?

As a shot in the dark, I would try specifying the engine on the
dnssec-keyfromlabel command line--"pkcs11:johani.se-ksk".  (That
shouldn't be necessary, but if it was using the wrong engine for
some reason then "not found" is the error I'd expect to get.)

> 2. In "sign-only" mode the contents of the K*.key and K*.private is different. Now I don't understand the format of the .private file, but I am curious as to what data is in there as it surely cannot be the private key and it doesn't seem to be the public key. Is it the public key in another format?

In HSM keys, the private file doesn't store the private key data; it stores
the information needed to find the key in the HSM--those are the lines
labeled "Engine:" and "Label:".  It also stores the modulus and public key
exponent, and the key lifecycle metadata.

> I understand the first paragraph. I think I understand the second
> paragraph. What I don't understand is what OTHER operations there are in
> a DNSSEC zone generation context than "key generation" and "zone
> signing". I.e. more precisely, what is the difference between the two
> modes?

In crypto-accelerator mode, it's assumed that the hardware device is faster
than your CPU at carrying out all cryptographic operations--signing,
validating against private or public keys, encrypting with private or
public keys, decrypting with private or public keys, hashing, generating
random numbers... everything CPU-intensive gets offloaded onto the HSM.

In sign-only mode it's assumed that your CPU is going to be better at
computational tasks, so any operation that doesn't require access to the
private key (encrypting/decrypting/validating with public key, hashing)
will be done there.

> dnssec-keyfromlabel: warning: dns_dnssec_findmatchingkeys: error reading key file Kjohani.se.+005+21432.private: not found
> Kjohani.se.+005+28461
> mem.c:1093: INSIST(ctx->stats[i].gets == 0U) failed, back trace

This kind of INSIST means there was a memory leak.  The program ran
the way it was supposed to, but we forgot to free some memory before
exiting, and hadn't noticed because we never hit that particular error
case in our testing, I suppose.  It's annoying, but functionally
harmless; bug report it and we'll fix it in the next release.

--
Evan Hunt -- each at isc.org
Internet Systems Consortium, Inc.



More information about the bind-workers mailing list