Re: How do I convert org.mozilla.jss.pkix.cert to org.mozilla.jss.crypto.X509Certificate?

Ernie Kovak <[email protected]>
Newsgroups gmane.comp.mozilla.crypto
Message-ID <[email protected]>
Try this:

    /** Convert an NSS certificate to a Java X509Certificate */
	protected X509Certificate convertNssCertificate(org.mozilla.jss.crypto.X509Certificate cert) throws CertificateException {
		InputStream in = null;
		try {
			byte[] encodedCert = cert.getEncoded();
			in = new ByteArrayInputStream(encodedCert);
			X509Certificate x509Cert = (X509Certificate)CertificateFactory.getInstance("X.509").generateCertificate(in);
			return x509Cert;
		} finally {
			if (in != null) try { in.close(); } catch (IOException ignore) {}
		}
	}
-- 
dev-tech-crypto mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-crypto
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.