/** * Extract a private key that is a PKCS8 pem string (base64 encoded PKCS8) * * @param pem * @return * @throws Exception */ public static PrivateKey decodePrivateKey(String pem) throws Exception { byte[] der = pemToDer(pem); return DerUtils.decodePrivateKey(der); }
public static X509Certificate decodeCertificate(String cert) throws Exception { byte[] der = pemToDer(cert); ByteArrayInputStream bis = new ByteArrayInputStream(der); return DerUtils.decodeCertificate(bis); }