public static X509Certificate getCertfromPEM ( byte [ ] pemBytes ) throws IOException , CertificateException , NoSuchProviderException { InputStream inStrm = new java . io . ByteArrayInputStream ( pemBytes ) ; X509Certificate cert = getCertfromPEM ( inStrm ) ; return cert ; }
Reads a certificate in PEM - format from a byte array . The array may contain other things the first certificate in the array is read .