Well well! It´s work, but not erase my problems. I receive a "java.security.cert.X509Certificate", not a "org.mozilla.jss.crypto.X509Certificate" neither a "org.mozilla.jss.pkix.cert." In this case i receiva a Sun Certificate from other module of my software.
exactly not having decided my problems, I would like to be thankful. "glen beasley" <[EMAIL PROTECTED]> escreveu na mensagem news:[EMAIL PROTECTED] > David Stutzman wrote: >> shinigami wrote: >>> Hi, >>> E want install a cert in a db. But my cert when i receive from outside >>> is a java.security.cert.X509Certificate, and the method importCertToPerm >>> can´t do it. I need to cast this cert to >>> org.mozilla.jss.crypto.X509Certificate. Or exist other way to do this?? >> >> Try these 2 methods: >> >> call getEncoded on the java.security.cert.X509Certificate (method >> inherited from java.security.cert.Certificate) to get the encoded DER of >> the cert >> http://java.sun.com/j2se/1.5.0/docs/api/java/security/cert/Certificate.html#getEncoded() >> >> And then importCertPackage to create a >> org.mozilla.jss.crypto.X509Certificate: >> http://www.mozilla.org/projects/security/pki/jss/javadoc/org/mozilla/jss/CryptoManager.html#importCertPackage(byte[],%20java.lang.String) >> > http://www.mozilla.org/projects/security/pki/jss/faq.html > > How do I convert org.mozilla.jss.crypto.X509Certificate to > org.mozilla.jss.pkix.cert.Certificate? > > import java.io.ByteArrayInputStream; > > [...] > > Certificate cert = (Certificate) ASN1Util.decode( > Certificate.getTemplate(),x509Cert.getEncoded() ); > > > and some of the test/example progams in > http://lxr.mozilla.org/mozilla/source/security/jss/org/mozilla/jss/tests > > note: if you want to add to these example/tests please do so. > > -glen > >> Dave >> _______________________________________________ >> dev-tech-crypto mailing list >> dev-tech-crypto@lists.mozilla.org >> https://lists.mozilla.org/listinfo/dev-tech-crypto > _______________________________________________ dev-tech-crypto mailing list dev-tech-crypto@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-crypto