Package org.bouncycastle.asn1.x509

Examples of org.bouncycastle.asn1.x509.GeneralNames


 
  @Override
  public DEREncodable getValue(final UserDataVO subject, final CA ca, final CertificateProfile certProfile, final PublicKey userPublicKey, final PublicKey caPublicKey ) throws CertificateExtentionConfigurationException, CertificateExtensionException {
    DERSequence ret = null;
    final String names = certProfile.getQCStatementRAName();
    final GeneralNames san = CertTools.getGeneralNamesFromAltName(names);
    SemanticsInformation si = null;
    if (san != null) {
      if (StringUtils.isNotEmpty(certProfile.getQCSemanticsId())) {
        si = new SemanticsInformation(new DERObjectIdentifier(certProfile.getQCSemanticsId()), san.getNames());
      } else {
        si = new SemanticsInformation(san.getNames());                    
      }
    } else if (StringUtils.isNotEmpty(certProfile.getQCSemanticsId())) {
      si = new SemanticsInformation(new DERObjectIdentifier(certProfile.getQCSemanticsId()));                
    }
    final ArrayList<QCStatement> qcs = new ArrayList<QCStatement>();
View Full Code Here


        if (log.isDebugEnabled()) {
          log.debug("Added CRL distpoint: "+uri);
        }
        final ASN1EncodableVector vec = new ASN1EncodableVector();
        vec.add(gn);
        final GeneralNames gns = new GeneralNames(new DERSequence(vec));
        final DistributionPointName dpn = new DistributionPointName(0, gns);
        dpns.add(dpn);
      }             
    }
    // CRL issuer works much like Dist point URI. If separated by ; it is put in the same global distPoint as the URI,
    // if there is more of one of them, the one with more is put in an own global distPoint.
    final ArrayList<GeneralNames> issuers = new ArrayList<GeneralNames>();
    if (StringUtils.isNotEmpty(crlissuer)) {
      final StringTokenizer tokenizer = new StringTokenizer(crlissuer, ";", false);
      while (tokenizer.hasMoreTokens()) {
        final String issuer = tokenizer.nextToken();
        final GeneralName gn = new GeneralName(new X509Name(issuer));
        if (log.isDebugEnabled()) {
          log.debug("Added CRL issuer: "+issuer);
        }
        final ASN1EncodableVector vec = new ASN1EncodableVector();
        vec.add(gn);
        final GeneralNames gns = new GeneralNames(new DERSequence(vec));
        issuers.add(gns);
      }             
    }
    final ArrayList<DistributionPoint> distpoints = new ArrayList<DistributionPoint>();
    if ( (!issuers.isEmpty()) || (!dpns.isEmpty()) ) {
      int i = dpns.size();
      if (issuers.size() > i) {
        i = issuers.size();
      }
      for (int j = 0; j < i; j++) {
        DistributionPointName dpn = null;
        GeneralNames issuer = null;
        if (dpns.size() > j) {
          dpn = (DistributionPointName)dpns.get(j);
        }
        if (issuers.size() > j) {
          issuer = (GeneralNames)issuers.get(j);
View Full Code Here

                if (log.isDebugEnabled()) {
                  log.debug("Added freshest CRL distpoint: "+uri);
                }
                final ASN1EncodableVector vec = new ASN1EncodableVector();
                vec.add(gn);
                final GeneralNames gns = new GeneralNames(new DERSequence(vec));
                final DistributionPointName dpn = new DistributionPointName(0, gns);
                distpoints.add(new DistributionPoint(dpn, null, null));
            }
            if (!distpoints.isEmpty()) {
                ret = new CRLDistPoint((DistributionPoint[])distpoints.toArray(new DistributionPoint[distpoints.size()]));
View Full Code Here

    super.setCriticalFlag(certProf.getSubjectAlternativeNameCritical());
  }
 
  @Override
  public DEREncodable getValue(final UserDataVO subject, final CA ca, final CertificateProfile certProfile, final PublicKey userPublicKey, final PublicKey caPublicKey ) throws CertificateExtentionConfigurationException, CertificateExtensionException {
    GeneralNames ret = null;
        String altName = subject.getSubjectAltName();
        if(certProfile.getUseSubjectAltNameSubSet()){
          altName = certProfile.createSubjectAltNameSubSet(altName);
        }
        if ( (altName != null) && (altName.length() > 0) ) {
View Full Code Here

                GeneralName          genName = new GeneralName(PrincipalUtil.getSubjectX509Principal(certificate));
                SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(
                        (ASN1Sequence)new ASN1InputStream(certificate.getPublicKey().getEncoded()).readObject());
               
                return (ASN1Sequence)new AuthorityKeyIdentifier(
                               info, new GeneralNames(genName), certificate.getSerialNumber()).toASN1Object();
            }
            else
            {
                GeneralName             genName = new GeneralName(PrincipalUtil.getSubjectX509Principal(certificate));
               
                byte[]                  ext = certificate.getExtensionValue(X509Extensions.SubjectKeyIdentifier.getId());
               
                if (ext != null)
                {
                    ASN1OctetString     str = (ASN1OctetString)X509ExtensionUtil.fromExtensionValue(ext);
               
                    return (ASN1Sequence)new AuthorityKeyIdentifier(
                                    str.getOctets(), new GeneralNames(genName), certificate.getSerialNumber()).toASN1Object();
                }
                else
                {
                    SubjectPublicKeyInfo info = new SubjectPublicKeyInfo(
                            (ASN1Sequence)new ASN1InputStream(certificate.getPublicKey().getEncoded()).readObject());
                   
                    return (ASN1Sequence)new AuthorityKeyIdentifier(
                            info, new GeneralNames(genName), certificate.getSerialNumber()).toASN1Object();
                }
            }
        }
        catch (Exception e)
        {
View Full Code Here

    }
   
    public AttributeCertificateIssuer(
        X509Principal principal)
    {       
        form = new V2Form(new GeneralNames(new DERSequence(new GeneralName(principal))));
    }
View Full Code Here

        form = new V2Form(new GeneralNames(new DERSequence(new GeneralName(principal))));
    }
   
    private Object[] getNames()
    {
        GeneralNames    name;
       
        if (form instanceof V2Form)
        {
            name = ((V2Form)form).getIssuerName();
        }
        else
        {
            name = (GeneralNames)form;
        }
       
        GeneralName[]   names = name.getNames();
       
        List        l = new ArrayList(names.length);
       
        for (int i = 0; i != names.length; i++)
        {
View Full Code Here

            {
                return issuer.getBaseCertificateID().getSerial().getValue().equals(x509Cert.getSerialNumber())
                    && matchesDN(x509Cert.getIssuerX500Principal(), issuer.getBaseCertificateID().getIssuer());
            }
           
            GeneralNames name = issuer.getIssuerName();
            if (matchesDN(x509Cert.getSubjectX500Principal(), name))
            {
                return true;
            }
        }
        else
        {
            GeneralNames name = (GeneralNames)form;
            if (matchesDN(x509Cert.getSubjectX500Principal(), name))
            {
                return true;
            }
        }
View Full Code Here

        }
    }
   
    private GeneralNames generateGeneralNames(X509Principal principal)
    {
        return new GeneralNames(new DERSequence(new GeneralName(principal)));
    }
View Full Code Here

      }
      if (crlDistPoints != null) {
        final DistributionPoint[] distPoints = crlDistPoints.getDistributionPoints();
        distPoint: for (DistributionPoint dp : distPoints) {
          final DistributionPointName dpName = dp.getDistributionPoint();
          final GeneralNames generalNames = (GeneralNames) dpName.getName();
          if (generalNames != null) {
            final GeneralName[] generalNameArr = generalNames.getNames();
            if (generalNameArr != null) {
              for (final GeneralName generalName : generalNameArr) {
                if (generalName.getTagNo() == GeneralName.uniformResourceIdentifier) {
                  final DERString derString = (DERString) generalName.getName();
                  final String uri = derString.getString();
View Full Code Here

TOP

Related Classes of org.bouncycastle.asn1.x509.GeneralNames

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.