public boolean equals( Object o) { if (!(o instanceof Extension)) { return false; } Extension other = (Extension)o; return other.getExtnValue().equals(this.getExtnValue()) && (other.isCritical() == this.isCritical()); }
/** * Constructor which will take an extension * * @param extension a X509Extension object containing an AuthorityKeyIdentifier. */ public AuthorityKeyIdentifierStructure( Extension extension) { super((ASN1Sequence)extension.getParsedValue()); }
public static Extension getInstance(Object obj) { if (obj instanceof Extension) { return (Extension)obj; } else if (obj != null) { return new Extension(ASN1Sequence.getInstance(obj)); } return null; }
public boolean equals( Object o) { if (!(o instanceof Extension)) { return false; } Extension other = (Extension)o; return other.getExtnId().equals(this.getExtnId()) && other.getExtnValue().equals(this.getExtnValue()) && (other.isCritical() == this.isCritical()); }
/** * Constructor from ASN1Sequence. * <p> * The extensions are a list of constructed sequences, either with (OID, OctetString) or (OID, Boolean, OctetString) * </p> */ private Extensions( ASN1Sequence seq) { Enumeration e = seq.getObjects(); while (e.hasMoreElements()) { Extension ext = Extension.getInstance(e.nextElement()); if (extensions.containsKey(ext.getExtnId())) { throw new IllegalArgumentException("repeated extension found: " + ext.getExtnId()); } extensions.put(ext.getExtnId(), ext); ordering.addElement(ext.getExtnId()); } }
public byte[] getExtensionValue(String oid) { Extension ext = getExtension(new ASN1ObjectIdentifier(oid)); if (ext != null) { try { return ext.getExtnValue().getEncoded(); } catch (Exception e) { throw new RuntimeException("error encoding " + e.toString()); } } return null; }
private ASN1ObjectIdentifier[] getExtensionOIDs(boolean isCritical) { Vector oidVec = new Vector(); for (int i = 0; i != ordering.size(); i++) { Object oid = ordering.elementAt(i); if (((Extension)extensions.get(oid)).isCritical() == isCritical) { oidVec.addElement(oid); } } return toOidArray(oidVec); }
if (!ext.isCritical()) ExtendedKeyUsage extKey = ExtendedKeyUsage.getInstance(ext.getParsedValue());
public ASN1Encodable getParsedValue() { return convertValueToObject(this); }
public byte[] getExtensionValue(String oid) { Extension ext = getExtension(new ASN1ObjectIdentifier(oid)); if (ext != null) { try { return ext.getExtnValue().getEncoded(); } catch (Exception e) { throw new IllegalStateException("Exception encoding: " + e.toString()); } } return null; }
public void setExtensions( Extensions extensions) { this.extensions = extensions; if (extensions != null) { Extension altName = extensions.getExtension(Extension.subjectAlternativeName); if (altName != null && altName.isCritical()) { altNamePresentAndCritical = true; } } }
public int hashCode() { if (this.isCritical()) { return this.getExtnValue().hashCode() ^ this.getExtnId().hashCode(); } return ~(this.getExtnValue().hashCode() ^ this.getExtnId().hashCode()); }
if (!ext.isCritical()) ExtendedKeyUsage extKey = ExtendedKeyUsage.getInstance(ext.getParsedValue());
public ASN1Encodable getParsedValue() { return convertValueToObject(this); }
public int hashCode() { if (this.isCritical()) { return this.getExtnValue().hashCode(); } return ~this.getExtnValue().hashCode(); }
/** * Convert the value of the passed in extension to an object * @param ext the extension to parse * @return the object the value string contains * @exception IllegalArgumentException if conversion is not possible */ private static ASN1Primitive convertValueToObject( Extension ext) throws IllegalArgumentException { try { return ASN1Primitive.fromByteArray(ext.getExtnValue().getOctets()); } catch (IOException e) { throw new IllegalArgumentException("can't convert extension: " + e); } } }
/** * Constructor which will take an extension * * @param extension a X509Extension object containing an AuthorityKeyIdentifier. */ public AuthorityKeyIdentifierStructure( Extension extension) { super((ASN1Sequence)extension.getParsedValue()); }
public void setExtensions( Extensions extensions) { this.extensions = extensions; if (extensions != null) { Extension altName = extensions.getExtension(Extension.subjectAlternativeName); if (altName != null && altName.isCritical()) { altNamePresentAndCritical = true; } } }