示例#1
0
 public String getSigAlgOID() {
   if (sigAlgId == null) {
     return null;
   }
   ObjectIdentifier oid = sigAlgId.getOID();
   return oid.toString();
 }
示例#2
0
 public String toString() {
   String s = "ObjectId: " + extensionId.toString();
   if (critical) {
     s += " Criticality=true\n";
   } else {
     s += " Criticality=false\n";
   }
   return (s);
 }
示例#3
0
 public int hashCode() {
   int h = 0;
   if (extensionValue != null) {
     byte[] val = extensionValue;
     int len = val.length;
     while (len > 0) {
       h += len * val[--len];
     }
   }
   h = h * hashMagic + extensionId.hashCode();
   h = h * hashMagic + (critical ? 1231 : 1237);
   return h;
 }
示例#4
0
  public byte[] getExtensionValue(String oid) {
    if (extensions == null) {
      return null;
    }
    try {
      String extAlias = OIDMap.getName(new ObjectIdentifier(oid));
      Extension crlExt = null;

      if (extAlias == null) {

        ObjectIdentifier findOID = new ObjectIdentifier(oid);
        Extension ex = null;
        ObjectIdentifier inCertOID;
        for (Enumeration<Extension> e = extensions.getElements(); e.hasMoreElements(); ) {
          ex = e.nextElement();
          inCertOID = ex.getExtensionId();
          if (inCertOID.equals((Object) findOID)) {
            crlExt = ex;
            break;
          }
        }
      } else {
        crlExt = extensions.get(extAlias);
      }
      if (crlExt == null) {
        return null;
      }
      byte[] extData = crlExt.getExtensionValue();
      if (extData == null) {
        return null;
      }
      DerOutputStream out = new DerOutputStream();
      out.putOctetString(extData);
      return out.toByteArray();
    } catch (Exception e) {
      return null;
    }
  }
示例#5
0
 public boolean equals(Object other) {
   if (this == other) {
     return true;
   }
   if (!(other instanceof Extension)) {
     return false;
   }
   Extension otherExt = (Extension) other;
   if (critical != otherExt.critical) {
     return false;
   }
   if (!extensionId.equals((Object) otherExt.extensionId)) {
     return false;
   }
   return Arrays.equals(extensionValue, otherExt.extensionValue);
 }
示例#6
0
 public String getId() {
   return extensionId.toString();
 }