I am writing code that exports and imports private keys from the 
internal key slot (using an EncryptedPrivateKeyInfo structure). I have 
the export working, the files written out seem to be readable by openssl 
so I think that side is fine.

The problem comes on import. If the key slot already contains the same 
private key that is being imported then 
PK11_ImportDERPrivateKeyInfoAndReturnKey returns a failure. The failure 
is a generic SECFailure so I cannot tell if it failed because the key 
already existed or if the data itself was faulty in some way. In 
addition some properties of the key that already exists are changed by 
the import (the nickname f.e.).

What I would like is to be able to tell if the key already exists before 
performing the import so I can avoid this, is there any way to go about 
that?

Dave
_______________________________________________
dev-tech-crypto mailing list
dev-tech-crypto@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-crypto

Reply via email to