Methods Summary |
---|
public boolean | equals(java.lang.Object o)
if (o == this)
{
return true;
}
if (!(o instanceof DEREncodable))
{
return false;
}
DERObject dObj = ((DEREncodable)o).getDERObject();
if (!(dObj instanceof ASN1Sequence))
{
return false;
}
ASN1Sequence other = (ASN1Sequence)dObj;
if (this.size() != other.size())
{
return false;
}
Enumeration s1 = this.getObjects();
Enumeration s2 = other.getObjects();
while (s1.hasMoreElements())
{
Object o1 = s1.nextElement();
Object o2 = s2.nextElement();
if (o1 != null && o2 != null)
{
if (!o1.equals(o2))
{
return false;
}
}
else if (o1 == null && o2 == null)
{
continue;
}
else
{
return false;
}
}
return true;
|
public static org.bouncycastle.asn1.ASN1Sequence | getInstance(java.lang.Object obj)return an ASN1Sequence from the given object.
if (obj == null || obj instanceof ASN1Sequence)
{
return (ASN1Sequence)obj;
}
throw new IllegalArgumentException("unknown object in getInstance");
|
public static org.bouncycastle.asn1.ASN1Sequence | getInstance(ASN1TaggedObject obj, boolean explicit)Return an ASN1 sequence from a tagged object. There is a special
case here, if an object appears to have been explicitly tagged on
reading but we were expecting it to be implictly tagged in the
normal course of events it indicates that we lost the surrounding
sequence - so we need to add it back (this will happen if the tagged
object is a sequence that contains other sequences). If you are
dealing with implicitly tagged sequences you really should
be using this method.
if (explicit)
{
if (!obj.isExplicit())
{
throw new IllegalArgumentException("object implicit - explicit expected.");
}
return (ASN1Sequence)obj.getObject();
}
else
{
//
// constructed object which appears to be explicitly tagged
// when it should be implicit means we have to add the
// surrounding sequence.
//
if (obj.isExplicit())
{
if (obj instanceof BERTaggedObject)
{
return new BERSequence(obj.getObject());
}
else
{
return new DERSequence(obj.getObject());
}
}
else
{
if (obj.getObject() instanceof ASN1Sequence)
{
return (ASN1Sequence)obj.getObject();
}
}
}
throw new IllegalArgumentException(
"unknown object in getInstanceFromTagged");
|