Take into account that this method (at least in jss3) won't return null on the
absence of a private key for a given certificate but it will throw an
exception, so you have to handle exceptions as program logic, something like
...
List certificatesWithMatchingPrivKey = ...;
try {
cryptoManager.findPrivKeyByCert(certificate)
certificatesWithMatchingPrivKey.add(certificate);
} catch (ObjectNotFoundException e) {
// no priv key
}
On Friday, March 2, 2007 3:39:48 AM UTC-5, j.fabre wrote:
> Yes!!
> I didn´t see this method, since I looked for it in PrivateKey and
> X509Certificate classes.
>
> Thanks a lot.
> Jesús el tuty.
>
> Dennis Sinelnikov wrote:
> > CryptoManager's findPrivKeyByCert(X509Certificate cert) might do the
> > trick.
> >
> >
> > hth,
> > Dennis
> >
> > j.fabre wrote:
> >> Hi all,
> >>
> >> I´m developing an applet with JSS 4, my intentions are to access
> >> Firefox´s certs repositories and recover the user certificates, and
> >> among them, only show to the user the certificates which have a
> >> private key associated with. This is done, in order to user can
> >> select only certificates which he/she can sign some code.
> >>
> >> I´m in trouble to achieve this, because I use the method
> >> "getCertificates()" of CertStore class, that, following JSS javadoc,
> >> recovers user certificates, which have a private key associated. But
> >> when I call getCertificates, it gives me all the certificates which
> >> are stored in a security device called: Software Security Device,
> >> unaware if they are user, with a private key associated or not, or
> >> root CA certificates... :-(
> >> Another problem that i found is that I don´t know how to associate a
> >> certificate with its corresponding private key, since I recover both
> >> collections separately (using getCertificates, and getPrivateKeys),
> >> and if I have, for example, this result from these operations,
> >> respectively:
> >> getCertificates() -->Cert A. Cert B. Cert C.
> >> getPrivateKeys() --> PrivKey X.
> >> ¿How I can know if privkey X corresponds to Cert A, B or C without
> >> doing any cryptograhic operations between keys and certs signatures?
> >>
> >> I´m thinking about what I´m missing or doing wrong, and what can I do
> >> to recover the real user certificates from Firefox certs store and
> >> retrieve their associated private keys.
> >>
> >> Any help will be appreciated.
> >> Thanks a lot for your time!!
> >>
> > _______________________________________________
> > dev-tech-crypto mailing list
> > [email protected]
> > https://lists.mozilla.org/listinfo/dev-tech-crypto
> >
--
dev-tech-crypto mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-crypto