예제 #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();
 }