Example #1
0
  /** return the issuer of the given CRL as an X509PrincipalObject. */
  public static X509Principal getIssuerX509Principal(X509CRL crl) throws CRLException {
    try {
      TBSCertList tbsCertList =
          TBSCertList.getInstance(ASN1Object.fromByteArray(crl.getTBSCertList()));

      return new X509Principal(tbsCertList.getIssuer());
    } catch (IOException e) {
      throw new CRLException(e.toString());
    }
  }
Example #2
0
 /** return the subject of the given cert as an X509PrincipalObject. */
 public static X509Principal getSubjectX509Principal(X509Certificate cert)
     throws CertificateEncodingException {
   try {
     TBSCertificateStructure tbsCert =
         TBSCertificateStructure.getInstance(ASN1Object.fromByteArray(cert.getTBSCertificate()));
     return new X509Principal(tbsCert.getSubject());
   } catch (IOException e) {
     throw new CertificateEncodingException(e.toString());
   }
 }