Leonardo L. P. da Mata
2009-02-20 19:17:21 UTC
Hello,
I'm trying to use the pkcs11 interface to import keys into the ncipher
HSM for use with ejbca, since i have a secure way to create a key
externally. I was perfectly able to import keys into the hsm and see
those keys using the pkcs11 interface, but those keys are not
available when i use EJBCA. What happens is that EJBCA keys needs an
certificate.
In KeyStoreContainerBase.java, the generate method creates a keypair:
final KeyPair keyPair = kpg.generateKeyPair();
and then a certificate with this keypair:
chain[0] = getSelfCertificate("CN=some guy, L=around, C=US",
(long)30*24*60*60*365, sigAlgName, keyPair);
I don't know exactly what to do to use an external KeyPair from a file
and then generate the certificate.
I'm thinking about 3 possible solutions:
1-import the key into the HSM, externally generate a certificate
signed with this key and then import this certificate to HSM using
"PKCS11HSMKeyTool importcert"
2-create "PKCS11HSMKeyTool importkey" to get a keypair from a file,
import this key to the hsm and than import the certificate to hsm.
3-create "PKCS11HSMKeyTool generatecert" to read an imported keypair
from the hsm, and use this keypair to generate the certificate, so the
keypair become available to ejbca.
How hard is to implement one of these solutions? Can you show me the
path to build these solutions myself?
Besides security issues, what's the problem to use imported keys with
ejbca, since PKCS11HSMKeyTool doesn't have an import key tool
implemented ?
Why does generated keys with pkcs11 interface needs a certificate?
I'm trying to use the pkcs11 interface to import keys into the ncipher
HSM for use with ejbca, since i have a secure way to create a key
externally. I was perfectly able to import keys into the hsm and see
those keys using the pkcs11 interface, but those keys are not
available when i use EJBCA. What happens is that EJBCA keys needs an
certificate.
In KeyStoreContainerBase.java, the generate method creates a keypair:
final KeyPair keyPair = kpg.generateKeyPair();
and then a certificate with this keypair:
chain[0] = getSelfCertificate("CN=some guy, L=around, C=US",
(long)30*24*60*60*365, sigAlgName, keyPair);
I don't know exactly what to do to use an external KeyPair from a file
and then generate the certificate.
I'm thinking about 3 possible solutions:
1-import the key into the HSM, externally generate a certificate
signed with this key and then import this certificate to HSM using
"PKCS11HSMKeyTool importcert"
2-create "PKCS11HSMKeyTool importkey" to get a keypair from a file,
import this key to the hsm and than import the certificate to hsm.
3-create "PKCS11HSMKeyTool generatecert" to read an imported keypair
from the hsm, and use this keypair to generate the certificate, so the
keypair become available to ejbca.
How hard is to implement one of these solutions? Can you show me the
path to build these solutions myself?
Besides security issues, what's the problem to use imported keys with
ejbca, since PKCS11HSMKeyTool doesn't have an import key tool
implemented ?
Why does generated keys with pkcs11 interface needs a certificate?
--
Leonardo Luiz Padovani da Mata
***@gmail.com
"May the force be with you, always"
"Nerd Pride... eu tenho. Voce tem?"
Leonardo Luiz Padovani da Mata
***@gmail.com
"May the force be with you, always"
"Nerd Pride... eu tenho. Voce tem?"