コード例 #1
0
  public VomsAttributeCertificateInfo(final ASN1Sequence seq) throws ProblemException {

    super(seq);

    ASN1Sequence attributes = getAttributes();

    for (int i = 0; i < attributes.size(); i++) {

      ASN1Sequence attribute = (ASN1Sequence) attributes.getObjectAt(i);
      DERObjectIdentifier id = (DERObjectIdentifier) attribute.getObjectAt(0);

      if (VomsCredentialInfo.VOMS_ATTR_OID.equals(id.getId())) {

        DERSet set = (DERSet) attribute.getObjectAt(1);

        for (int j = 0; j < set.size(); j++) {

          IetfAttrSyntax attr = new IetfAttrSyntax((ASN1Sequence) set.getObjectAt(j));
          ASN1Sequence paSeq = (ASN1Sequence) attr.getPolicyAuthority().getDERObject();
          GeneralName paGName = GeneralName.getInstance(paSeq.getObjectAt(0));
          String paString = ((DERIA5String) paGName.getName()).getString();

          int sep = paString.indexOf("://"); // $NON-NLS-1$
          if (sep != -1) {
            this.voNames.add(paString.substring(0, sep));
          }

          for (Object attrValue : attr.getValues()) {
            String fqanString = new String(((ASN1OctetString) attrValue).getOctets());
            this.fqans.add(FullyQualifiedAttributeName.getFqan(fqanString));
          }
        }
      }
    }
  }
コード例 #2
0
  /**
   * Returns a List of URL for Certificate Revocation List. Must have on or more<br>
   * Otherwise, returns <b>null</b>.<br>
   *
   * @return String
   * @throws IOException
   */
  public List<String> getCRLDistributionPoint() throws IOException {

    List<String> lcrS = new ArrayList<String>();
    // DERObject derObj =
    // getExtensionValue(X509Extensions.CRLDistributionPoints.getId());
    ASN1Object derObj = getExtensionValue(X509Extensions.CRLDistributionPoints.getId());
    if (derObj == null) {
      return null;
    }
    CRLDistPoint crlDistPoint = CRLDistPoint.getInstance(derObj);
    DistributionPoint[] dp = crlDistPoint.getDistributionPoints();
    for (int i = 0; i < dp.length; i++) {
      // @SuppressWarnings("resource")
      DERSequence seq = (DERSequence) dp[i].getDistributionPoint().getName().toASN1Primitive();
      GeneralName url = (GeneralName) seq.getObjectAt(0);
      lcrS.add(url.getName().toString());
    }
    return lcrS;
  }