use of org.bouncycastle.asn1.DERObjectIdentifier in project XobotOS by xamarin.
the class CertPathValidatorUtilities method processCertD1ii.
protected static void processCertD1ii(int index, List[] policyNodes, DERObjectIdentifier _poid, Set _pq) {
List policyNodeVec = policyNodes[index - 1];
for (int j = 0; j < policyNodeVec.size(); j++) {
PKIXPolicyNode _node = (PKIXPolicyNode) policyNodeVec.get(j);
if (ANY_POLICY.equals(_node.getValidPolicy())) {
Set _childExpectedPolicies = new HashSet();
_childExpectedPolicies.add(_poid.getId());
PKIXPolicyNode _child = new PKIXPolicyNode(new ArrayList(), index, _childExpectedPolicies, _node, _pq, _poid.getId(), false);
_node.addChild(_child);
policyNodes[index].add(_child);
return;
}
}
}
use of org.bouncycastle.asn1.DERObjectIdentifier in project XobotOS by xamarin.
the class X509Name method equals.
/**
* test for equality - note: case is ignored.
*/
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof X509Name || obj instanceof ASN1Sequence)) {
return false;
}
DERObject derO = ((DEREncodable) obj).getDERObject();
if (this.getDERObject().equals(derO)) {
return true;
}
X509Name other;
try {
other = X509Name.getInstance(obj);
} catch (IllegalArgumentException e) {
return false;
}
int orderingSize = ordering.size();
if (orderingSize != other.ordering.size()) {
return false;
}
boolean[] indexes = new boolean[orderingSize];
int start, end, delta;
if (// guess forward
ordering.elementAt(0).equals(other.ordering.elementAt(0))) {
start = 0;
end = orderingSize;
delta = 1;
} else // guess reversed - most common problem
{
start = orderingSize - 1;
end = -1;
delta = -1;
}
for (int i = start; i != end; i += delta) {
boolean found = false;
DERObjectIdentifier oid = (DERObjectIdentifier) ordering.elementAt(i);
String value = (String) values.elementAt(i);
for (int j = 0; j < orderingSize; j++) {
if (indexes[j]) {
continue;
}
DERObjectIdentifier oOid = (DERObjectIdentifier) other.ordering.elementAt(j);
if (oid.equals(oOid)) {
String oValue = (String) other.values.elementAt(j);
if (equivalentStrings(value, oValue)) {
indexes[j] = true;
found = true;
break;
}
}
}
if (!found) {
return false;
}
}
return true;
}
use of org.bouncycastle.asn1.DERObjectIdentifier in project XobotOS by xamarin.
the class X509Name method equals.
/**
* @param inOrder if true the order of both X509 names must be the same,
* as well as the values associated with each element.
*/
public boolean equals(Object obj, boolean inOrder) {
if (!inOrder) {
return this.equals(obj);
}
if (obj == this) {
return true;
}
if (!(obj instanceof X509Name || obj instanceof ASN1Sequence)) {
return false;
}
DERObject derO = ((DEREncodable) obj).getDERObject();
if (this.getDERObject().equals(derO)) {
return true;
}
X509Name other;
try {
other = X509Name.getInstance(obj);
} catch (IllegalArgumentException e) {
return false;
}
int orderingSize = ordering.size();
if (orderingSize != other.ordering.size()) {
return false;
}
for (int i = 0; i < orderingSize; i++) {
DERObjectIdentifier oid = (DERObjectIdentifier) ordering.elementAt(i);
DERObjectIdentifier oOid = (DERObjectIdentifier) other.ordering.elementAt(i);
if (oid.equals(oOid)) {
String value = (String) values.elementAt(i);
String oValue = (String) other.values.elementAt(i);
if (!equivalentStrings(value, oValue)) {
return false;
}
} else {
return false;
}
}
return true;
}
use of org.bouncycastle.asn1.DERObjectIdentifier in project XobotOS by xamarin.
the class X509Name method toASN1Object.
public DERObject toASN1Object() {
if (seq == null) {
ASN1EncodableVector vec = new ASN1EncodableVector();
ASN1EncodableVector sVec = new ASN1EncodableVector();
DERObjectIdentifier lstOid = null;
for (int i = 0; i != ordering.size(); i++) {
ASN1EncodableVector v = new ASN1EncodableVector();
DERObjectIdentifier oid = (DERObjectIdentifier) ordering.elementAt(i);
v.add(oid);
String str = (String) values.elementAt(i);
v.add(converter.getConvertedValue(oid, str));
if (lstOid == null || ((Boolean) this.added.elementAt(i)).booleanValue()) {
sVec.add(new DERSequence(v));
} else {
vec.add(new DERSet(sVec));
sVec = new ASN1EncodableVector();
sVec.add(new DERSequence(v));
}
lstOid = oid;
}
vec.add(new DERSet(sVec));
seq = new DERSequence(vec);
}
return seq;
}
use of org.bouncycastle.asn1.DERObjectIdentifier in project XobotOS by xamarin.
the class X509Name method toString.
/**
* convert the structure to a string - if reverse is true the
* oids and values are listed out starting with the last element
* in the sequence (ala RFC 2253), otherwise the string will begin
* with the first element of the structure. If no string definition
* for the oid is found in oidSymbols the string value of the oid is
* added. Two standard symbol tables are provided DefaultSymbols, and
* RFC2253Symbols as part of this class.
*
* @param reverse if true start at the end of the sequence and work back.
* @param oidSymbols look up table strings for oids.
*/
public String toString(boolean reverse, Hashtable oidSymbols) {
StringBuffer buf = new StringBuffer();
Vector components = new Vector();
boolean first = true;
StringBuffer ava = null;
for (int i = 0; i < ordering.size(); i++) {
if (((Boolean) added.elementAt(i)).booleanValue()) {
ava.append('+');
appendValue(ava, oidSymbols, (DERObjectIdentifier) ordering.elementAt(i), (String) values.elementAt(i));
} else {
ava = new StringBuffer();
appendValue(ava, oidSymbols, (DERObjectIdentifier) ordering.elementAt(i), (String) values.elementAt(i));
components.addElement(ava);
}
}
if (reverse) {
for (int i = components.size() - 1; i >= 0; i--) {
if (first) {
first = false;
} else {
buf.append(',');
}
buf.append(components.elementAt(i).toString());
}
} else {
for (int i = 0; i < components.size(); i++) {
if (first) {
first = false;
} else {
buf.append(',');
}
buf.append(components.elementAt(i).toString());
}
}
return buf.toString();
}
Aggregations