public static X509Certificate convertCertificate(Certificate certIn) throws CryptoException {
  try {
    CertificateFactory cf=CertificateFactory.getInstance(X509_CERT_TYPE,BOUNCY_CASTLE.jce());
    ByteArrayInputStream bais=new ByteArrayInputStream(certIn.getEncoded());
    return (X509Certificate)cf.generateCertificate(bais);
  }
 catch (  CertificateException e) {
    throw new CryptoException(res.getString("NoConvertCertificate.exception.message"),e);
  }
catch (  NoSuchProviderException e) {
    throw new CryptoException(res.getString("NoConvertCertificate.exception.message"),e);
  }
}

public static X509Certificate convertCertificate ( Certificate certIn ) throws CryptoException { try { CertificateFactory cf = CertificateFactory . getInstance ( X509_CERT_TYPE , BOUNCY_CASTLE . jce ( ) ) ; ByteArrayInputStream bais = new ByteArrayInputStream ( certIn . getEncoded ( ) ) ; return ( X509Certificate ) cf . generateCertificate ( bais ) ; } catch ( CertificateException e ) { throw new CryptoException ( res . getString ( "NoConvertCertificate.exception.message" ) , e ) ; } catch ( NoSuchProviderException e ) { throw new CryptoException ( res . getString ( "NoConvertCertificate.exception.message" ) , e ) ; } }
convert the supplied certificate object into an x509certificate object .
