public static X509Certificate createCertificateFromBytes(byte[] certBytes){
  X509Certificate cert=null;
  CertificateFactory certFactory;
  try {
    certFactory=CertificateFactory.getInstance("X.509");
    InputStream in=new ByteArrayInputStream(certBytes);
    cert=(X509Certificate)certFactory.generateCertificate(in);
  }
 catch (  CertificateException e) {
    logger.warn("Excpetion caught in CryptCore." + "createCertificateFromBytes, returning null",e);
  }
  return cert;
}

public static X509Certificate createCertificateFromBytes ( byte [ ] certBytes ) { X509Certificate cert = null ; CertificateFactory certFactory ; try { certFactory = CertificateFactory . getInstance ( "X.509" ) ; InputStream in = new ByteArrayInputStream ( certBytes ) ; cert = ( X509Certificate ) certFactory . generateCertificate ( in ) ; } catch ( CertificateException e ) { logger . warn ( "Excpetion caught in CryptCore." + "createCertificateFromBytes, returning null" , e ) ; } return cert ; }
creates an x509 certificate for a given byte array
