Examples of Extensions


Examples of org.bouncycastle.asn1.x509.Extensions

    }

    static void validateKeyUsage(org.bouncycastle.asn1.x509.Certificate c, int keyUsageBits)
        throws IOException
    {
        Extensions exts = c.getTBSCertificate().getExtensions();
        if (exts != null)
        {
            KeyUsage ku = KeyUsage.fromExtensions(exts);
            if (ku != null)
            {
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Extensions

      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) {
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Extensions

      tbsCertificateGenerator.setSubject(tbsPart.getSubject());
      tbsCertificateGenerator.setSubjectPublicKeyInfo(tbsPart.getSubjectPublicKeyInfo());
      tbsCertificateGenerator.setIssuerUniqueID(tbsPart.getIssuerUniqueId());
      tbsCertificateGenerator.setSubjectUniqueID(tbsPart.getSubjectUniqueId());
      tbsCertificateGenerator.setExtensions(
          new Extensions(orderedExtensions.toArray(new Extension[]{})));
      return tbsCertificateGenerator.generateTBSCertificate();
    } catch (CertificateException e) {
      throw new CertificateTransparencyException("Certificate error: " + e.getMessage(), e);
    } catch (IOException e) {
      throw new CertificateTransparencyException("Error deleting extension: " + e.getMessage(), e);
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Extensions

    }
  }

  private static boolean hasX509AuthorityKeyIdentifier(
      org.bouncycastle.asn1.x509.Certificate cert) {
    Extensions extensions = cert.getTBSCertificate().getExtensions();
    return extensions.getExtension(new ASN1ObjectIdentifier(X509_AUTHORITY_KEY_IDENTIFIER)) != null;
  }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Extensions

    public Set getCriticalExtensionOIDs()
    {
        if (this.getVersion() == 3)
        {
            Set             set = new HashSet();
            Extensions  extensions = c.getTBSCertificate().getExtensions();

            if (extensions != null)
            {
                Enumeration     e = extensions.oids();

                while (e.hasMoreElements())
                {
                    ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement();
                    Extension       ext = extensions.getExtension(oid);

                    if (ext.isCritical())
                    {
                        set.add(oid.getId());
                    }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Extensions

        return null;
    }

    private byte[] getExtensionBytes(String oid)
    {
        Extensions exts = c.getTBSCertificate().getExtensions();

        if (exts != null)
        {
            Extension   ext = exts.getExtension(new ASN1ObjectIdentifier(oid));
            if (ext != null)
            {
                return ext.getExtnValue().getOctets();
            }
        }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Extensions

        return null;
    }

    public byte[] getExtensionValue(String oid)
    {
        Extensions exts = c.getTBSCertificate().getExtensions();

        if (exts != null)
        {
            Extension   ext = exts.getExtension(new ASN1ObjectIdentifier(oid));

            if (ext != null)
            {
                try
                {
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Extensions

    public Set getNonCriticalExtensionOIDs()
    {
        if (this.getVersion() == 3)
        {
            Set             set = new HashSet();
            Extensions  extensions = c.getTBSCertificate().getExtensions();

            if (extensions != null)
            {
                Enumeration     e = extensions.oids();

                while (e.hasMoreElements())
                {
                    ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement();
                    Extension       ext = extensions.getExtension(oid);

                    if (!ext.isCritical())
                    {
                        set.add(oid.getId());
                    }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Extensions

    public boolean hasUnsupportedCriticalExtension()
    {
        if (this.getVersion() == 3)
        {
            Extensions  extensions = c.getTBSCertificate().getExtensions();

            if (extensions != null)
            {
                Enumeration     e = extensions.oids();

                while (e.hasMoreElements())
                {
                    ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement();
                    String              oidId = oid.getId();

                    if (oidId.equals(RFC3280CertPathUtilities.KEY_USAGE)
                     || oidId.equals(RFC3280CertPathUtilities.CERTIFICATE_POLICIES)
                     || oidId.equals(RFC3280CertPathUtilities.POLICY_MAPPINGS)
                     || oidId.equals(RFC3280CertPathUtilities.INHIBIT_ANY_POLICY)
                     || oidId.equals(RFC3280CertPathUtilities.CRL_DISTRIBUTION_POINTS)
                     || oidId.equals(RFC3280CertPathUtilities.ISSUING_DISTRIBUTION_POINT)
                     || oidId.equals(RFC3280CertPathUtilities.DELTA_CRL_INDICATOR)
                     || oidId.equals(RFC3280CertPathUtilities.POLICY_CONSTRAINTS)
                     || oidId.equals(RFC3280CertPathUtilities.BASIC_CONSTRAINTS)
                     || oidId.equals(RFC3280CertPathUtilities.SUBJECT_ALTERNATIVE_NAME)
                     || oidId.equals(RFC3280CertPathUtilities.NAME_CONSTRAINTS))
                    {
                        continue;
                    }

                    Extension       ext = extensions.getExtension(oid);

                    if (ext.isCritical())
                    {
                        return true;
                    }
View Full Code Here

Examples of org.bouncycastle.asn1.x509.Extensions

            {
                buf.append("                       ").append(new String(Hex.encode(sig, i, sig.length - i))).append(nl);
            }
        }

        Extensions extensions = c.getTBSCertificate().getExtensions();

        if (extensions != null)
        {
            Enumeration     e = extensions.oids();

            if (e.hasMoreElements())
            {
                buf.append("       Extensions: \n");
            }

            while (e.hasMoreElements())
            {
                ASN1ObjectIdentifier     oid = (ASN1ObjectIdentifier)e.nextElement();
                Extension ext = extensions.getExtension(oid);

                if (ext.getExtnValue() != null)
                {
                    byte[]                  octs = ext.getExtnValue().getOctets();
                    ASN1InputStream         dIn = new ASN1InputStream(octs);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.