Package gnu.java.security.x509.ext

Examples of gnu.java.security.x509.ext.CertificatePolicies


    for (int i = index - 1; i > 0; i--)
      {
        if (! path[i].getIssuerDN().equals(path[i].getSubjectDN()))
          pathLen++;
      }
    Extension e = null;
    if (cert instanceof GnuPKIExtension)
      {
        e = ((GnuPKIExtension) cert).getExtension(BasicConstraints.ID);
      }
    else
      {
        try
          {
            e = new Extension(cert.getExtensionValue(BasicConstraints.ID.toString()));
          }
        catch (Exception x)
          {
          }
      }
    if (e == null)
      throw new CertPathValidatorException("no basicConstraints");
    BasicConstraints bc = (BasicConstraints) e.getValue();
    if (! bc.isCA())
      throw new CertPathValidatorException(
          "certificate cannot be used to verify signatures");
    if (bc.getPathLengthConstraint() >= 0
        && bc.getPathLengthConstraint() < pathLen)
View Full Code Here


              }
          }
      }
    while (! stack.isEmpty());

    Extension e = null;
    CertificatePolicies policies = null;
    List qualifierInfos = null;
    if (cert instanceof GnuPKIExtension)
      {
        e = ((GnuPKIExtension) cert).getExtension(CertificatePolicies.ID);
        if (e != null)
          policies = (CertificatePolicies) e.getValue();
      }

    List cp = null;
    if (policies != null)
      cp = policies.getPolicies();
View Full Code Here

    if (pathToNames != null)
      {
        NameConstraints nc = null;
        if (cert instanceof GnuPKIExtension)
          {
            Extension e =
              ((GnuPKIExtension) cert).getExtension(NameConstraints.ID);
            if (e != null)
              nc = (NameConstraints) e.getValue();
          }
        else
          {
            byte[] b = cert.getExtensionValue(NameConstraints.ID.toString());
            if (b != null)
View Full Code Here

      case x400Address:
      case otherName:
        throw new IOException("cannot decode string representation of "
                              + kind);
    }
    return new GeneralName(kind, nameBytes);
  }
View Full Code Here

   * @param name The DER-encoded bytes of the name to match.
   * @throws IOException If the name DER is malformed.
   */
  public void addPathToName(int id, byte[] name) throws IOException
  {
    GeneralName generalName = new GeneralName(GeneralName.Kind.forTag(id), name);
    if (pathToNames == null)
      pathToNames = new LinkedList<GeneralName>();
    pathToNames.add(generalName);
  }
View Full Code Here

   * @param name The name.
   * @throws IOException If the name cannot be decoded.
   */
  public void addPathToName(int id, String name) throws IOException
  {
    GeneralName generalName = makeName(id, name);
    if (pathToNames == null)
      pathToNames = new LinkedList<GeneralName>();
    pathToNames.add(generalName);
  }
View Full Code Here

   * @throws IOException If the name is not a valid DER sequence.
   */
  public void addSubjectAlternativeName(int id, byte[] name)
    throws IOException
  {
    GeneralName generalName = new GeneralName(GeneralName.Kind.forTag(id), name);
    if (altNames == null)
      altNames = new LinkedList<GeneralName>();
    altNames.add(generalName);
  }
View Full Code Here

   *   is null.
   */
  public void addSubjectAlternativeName(int id, String name)
    throws IOException
  {
    GeneralName generalName = makeName(id, name);
    if (altNames == null)
      altNames = new LinkedList<GeneralName>();
    altNames.add(generalName);
  }
View Full Code Here

              {
                try
                  {
                    Integer id = (Integer) list.get(0);
                    Object val = list.get(1);
                    GeneralName n = null;
                    if (val instanceof String)
                      n = makeName(id, (String) val);
                    else if (val instanceof byte[])
                      {
                        n = new GeneralName(GeneralName.Kind.forTag(id),
                                            (byte[]) val);
                      }
                    else
                      continue;
                    if (name.equals(n))
View Full Code Here

    List<GeneralName> l = new ArrayList<GeneralName>(altNames.size());
    for (List<?> list : altNames)
      {
        Integer id = (Integer) list.get(0);
        Object value = list.get(1);
        GeneralName name = null;
        if (value instanceof String)
          name = makeName(id, (String) value);
        else if (value instanceof byte[])
          name = new GeneralName(GeneralName.Kind.forTag(id), (byte[]) value);
        else
          throw new IOException("invalid name type: " + value.getClass().getName());
        l.add(name);
      }
    this.altNames = l;
View Full Code Here

TOP

Related Classes of gnu.java.security.x509.ext.CertificatePolicies

Copyright © 2018 www.massapicom. 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.