Hello,

I am trying to obtain the private key from a certificate stored within
Netscape so that I can create a Signature object and sign some data.  After
obtaining a X509 certificate from the certificate store I get an error when
calling findPrivKeyByCert().

The last line of this code snippet fails:
            CryptoManager.InitializationValues vals = new
CryptoManager.InitializationValues(dbdir);
            CryptoManager.initialize(vals);
            manager = CryptoManager.getInstance();
            org.mozilla.jss.crypto.X509Certificate[] certs =
manager.getPermCerts();
            org.mozilla.jss.crypto.X509Certificate cert;
            cert =
(org.mozilla.jss.crypto.X509Certificate)certs[iSelectedCert];
            //get private key
            org.mozilla.jss.crypto.PrivateKey pkey =
manager.findPrivKeyByCert(cert);

The stack trace is:
org.mozilla.jss.crypto.ObjectNotFoundException
 at org.mozilla.jss.CryptoManager.findPrivKeyByCertNative(Native Method)
 at org.mozilla.jss.CryptoManager.findPrivKeyByCert(CryptoManager.java:1193)

Can anyone help me out?  I am beginning to get really lost in all this JSS
stuff.

Anthony









Reply via email to