[security-dev 01752]: Re: alias in KeyPairGenerator - was: '\0' in alias name of a pkcs11 keystore

2010-03-31 Thread Valerie (Yu-Ching) Peng
If the default PKCS11 config is used, I'd expect that KeyPairGenerator to generate a "session" key and then SunPKCS11 keystore impl will do a C_CopyObject(...) w/ the desired alias. Is a custom PKCS11 config file used here? If yes, perhaps it specifies that token key be generated for key gen

[security-dev 01751]: Re: alias in KeyPairGenerator - was: '\0' in alias name of a pkcs11 keystore

2010-03-31 Thread Michael StJohns
This may actually be a bug in the PKCS11 provider. KeyPairGenerator should be generating a "Session" key pair. When you write the key store object, the underlying function should do a C_CopyObject from the Session object to a Token object. (Or from a software key to a Token object). At tha

[security-dev 01750]: Re: alias in KeyPairGenerator - was: '\0' in alias name of a pkcs11 keystore

2010-03-31 Thread Tomas Gustavsson
Hi, Sorry if I misunderstood you. That is actually exactly how we do it, 1. Use KeyPairGenerator with P11 provider to generate key pair. 2. Create a keystore with the P11 provier. 3. Generate a self signed certificate. 4. keystore.setKeyEntry(myalias, privateKey, null, cert). The keys work fin