Code example for Certificate

Methods: getEncoded

0
  } 
 
  static IssuerInformation issuerInformationFromPreCertificateSigningCert( 
      Certificate certificate, byte[] keyHash) {
    try { 
      ASN1InputStream aIssuerIn = new ASN1InputStream(certificate.getEncoded());
      org.bouncycastle.asn1.x509.Certificate parsedIssuerCert =
          org.bouncycastle.asn1.x509.Certificate.getInstance(aIssuerIn.readObject());
 
      Extensions issuerExtensions = parsedIssuerCert.getTBSCertificate().getExtensions();
      Extension x509authorityKeyIdentifier = null;
      if (issuerExtensions != null) {
        x509authorityKeyIdentifier =
            issuerExtensions.getExtension(new ASN1ObjectIdentifier(X509_AUTHORITY_KEY_IDENTIFIER));
      } 
 
      return new IssuerInformation( 
          parsedIssuerCert.getIssuer(), keyHash, x509authorityKeyIdentifier, true);
    } catch (CertificateEncodingException e) {
      throw new CertificateTransparencyException( 
          "Certificate could not be encoded: " + e.getMessage(), e);