Fields Summary |
---|
private static final org.apache.harmony.security.utils.ObjectIdentifier | C |
private static final org.apache.harmony.security.utils.ObjectIdentifier | CN |
private static final org.apache.harmony.security.utils.ObjectIdentifier | DC |
private static final org.apache.harmony.security.utils.ObjectIdentifier | DNQ |
private static final org.apache.harmony.security.utils.ObjectIdentifier | DNQUALIFIER |
private static final org.apache.harmony.security.utils.ObjectIdentifier | EMAILADDRESS |
private static final org.apache.harmony.security.utils.ObjectIdentifier | GENERATION |
private static final org.apache.harmony.security.utils.ObjectIdentifier | GIVENNAME |
private static final org.apache.harmony.security.utils.ObjectIdentifier | INITIALS |
private static final org.apache.harmony.security.utils.ObjectIdentifier | L |
private static final org.apache.harmony.security.utils.ObjectIdentifier | O |
private static final org.apache.harmony.security.utils.ObjectIdentifier | OU |
private static final org.apache.harmony.security.utils.ObjectIdentifier | SERIALNUMBER |
private static final org.apache.harmony.security.utils.ObjectIdentifier | ST |
private static final org.apache.harmony.security.utils.ObjectIdentifier | STREET |
private static final org.apache.harmony.security.utils.ObjectIdentifier | SURNAME |
private static final org.apache.harmony.security.utils.ObjectIdentifier | T |
private static final org.apache.harmony.security.utils.ObjectIdentifier | UID |
private static final int | CAPACITY |
private static final int | SIZE |
private static final org.apache.harmony.security.utils.ObjectIdentifier[] | KNOWN_OIDS |
private static final HashMap | KNOWN_NAMES |
private static final HashMap | RFC1779_NAMES |
private static final HashMap | RFC2253_NAMES |
private static final HashMap | RFC2459_NAMES |
private final org.apache.harmony.security.utils.ObjectIdentifier | oid |
private AttributeValue | value |
public static org.apache.harmony.security.asn1.ASN1Type | AttributeValueAccording to RFC 3280 (http://www.ietf.org/rfc/rfc3280.txt)
X.501 AttributeTypeAndValue structure is defined as follows:
AttributeTypeAndValue ::= SEQUENCE {
type AttributeType,
value AttributeValue }
AttributeType ::= OBJECT IDENTIFIER
AttributeValue ::= ANY DEFINED BY AttributeType
...
DirectoryString ::= CHOICE {
teletexString TeletexString (SIZE (1..MAX)),
printableString PrintableString (SIZE (1..MAX)),
universalString UniversalString (SIZE (1..MAX)),
utf8String UTF8String (SIZE (1.. MAX)),
bmpString BMPString (SIZE (1..MAX)) } |
public static final org.apache.harmony.security.asn1.ASN1Sequence | ASN1 |
Methods Summary |
---|
private static void | addOID(org.apache.harmony.security.utils.ObjectIdentifier oid)
int[] newOid = oid.getOid();
int index = hashIntArray(newOid) % CAPACITY;
// look for OID in the pool
ObjectIdentifier[] list = KNOWN_OIDS[index];
int i = 0;
for (; list[i] != null; i++) {
// check wrong static initialization: no duplicate OIDs
if (Arrays.equals(newOid, list[i].getOid())) {
throw new Error(Messages.getString("security.17B", //$NON-NLS-1$
oid.getName(), list[i].getName()));
}
}
// check : to avoid NPE
if (i == (CAPACITY - 1)) {
throw new Error(Messages.getString("security.17C")); //$NON-NLS-1$
}
list[i] = oid;
|
public void | appendName(java.lang.String attrFormat, java.lang.StringBuffer buf)Appends AttributeTypeAndValue string representation
boolean hexFormat = false;
if (attrFormat == X500Principal.RFC1779) {
if (RFC1779_NAMES == oid.getGroup()) {
buf.append(oid.getName());
} else {
buf.append(oid.toOIDString());
}
buf.append('=");
if (value.escapedString == value.getHexString()) {
//FIXME all chars in upper case
buf.append(value.getHexString().toUpperCase());
} else if (value.escapedString.length() != value.rawString.length()) {
// was escaped
value.appendQEString(buf);
} else {
buf.append(value.escapedString);
}
} else {
Object group = oid.getGroup();
// RFC2253 includes names from RFC1779
if (RFC1779_NAMES == group || RFC2253_NAMES == group) {
buf.append(oid.getName());
if (attrFormat == X500Principal.CANONICAL) {
// only PrintableString and UTF8String in string format
// all others are output in hex format
int tag = value.getTag();
if (!ASN1StringType.UTF8STRING.checkTag(tag)
&& !ASN1StringType.PRINTABLESTRING.checkTag(tag)) {
hexFormat = true;
}
}
} else {
buf.append(oid.toString());
hexFormat = true;
}
buf.append('=");
if (hexFormat) {
buf.append(value.getHexString());
} else {
if (attrFormat == X500Principal.CANONICAL) {
buf.append(value.makeCanonical());
} else {
buf.append(value.escapedString);
}
}
}
|
private static org.apache.harmony.security.utils.ObjectIdentifier | getOID(int[] oid)
// returns known OID or null
int index = hashIntArray(oid) % CAPACITY;
// look for OID in the pool
ObjectIdentifier[] list = KNOWN_OIDS[index];
for (int i = 0; list[i] != null; i++) {
if (Arrays.equals(oid, list[i].getOid())) {
return list[i];
}
}
return null;
|
public org.apache.harmony.security.utils.ObjectIdentifier | getType()Gets type of the AttributeTypeAndValue
return oid;
|
private static int | hashIntArray(int[] oid)
int intHash = 0;
for (int i = 0; i < oid.length && i < 4; i++) {
intHash += oid[i] << (8 * i); //TODO what about to find better one?
}
return intHash & 0x7FFFFFFF; // only positive
|