Methods Summary |
---|
public java.lang.Object | decode(BerInputStream in)
in.readOID();
if (in.isVerify) {
return null;
}
return getDecodedObject(in);
|
public void | encodeContent(BerOutputStream out)
out.encodeOID();
|
public java.lang.Object | getDecodedObject(BerInputStream in)Extracts array of integers from BER input stream.
// Allocate and decode
int oidElement = in.oidElement;
int[] oid = new int[oidElement];
for (int id = 1, i = 0; id < oid.length; id++, i++) {
int octet = in.buffer[in.contentOffset + i];
oidElement = octet & 0x7F;
while ((octet & 0x80) != 0) {
i++;
octet = in.buffer[in.contentOffset + i];
oidElement = oidElement << 7 | (octet & 0x7f);
}
oid[id] = oidElement;
}
// Special handling for the first packed OID element
if (oid[1] > 79) {
oid[0] = 2;
oid[1] = oid[1] - 80;
} else {
oid[0] = oid[1] / 40;
oid[1] = oid[1] % 40;
}
return oid;
|
public static org.apache.harmony.security.asn1.ASN1Oid | getInstance()Returns ASN.1 Object Identifier type default implementation
The default implementation works with encoding
that is represented as array of integers.
return ASN1;
|
public static org.apache.harmony.security.asn1.ASN1Oid | getInstanceForString()Returns ASN.1 Object Identifier type implementation
This implementation works with encoding
that is mapped to java.lang.String object.
return STRING_OID;
|
public void | setEncodingContent(BerOutputStream out)
int[] oid = (int[]) out.content;
int length = 0;
// first subidentifier
int elem = oid[0] * 40 + oid[1];
if (elem == 0) {
length = 1;
} else {
for (; elem > 0; elem = elem >> 7) {
length++;
}
}
// the rest of subidentifiers
for (int i = 2; i < oid.length; i++) {
if (oid[i] == 0) {
length++;
continue;
}
for (elem = oid[i]; elem > 0; elem = elem >> 7) {
length++;
}
}
out.length = length;
|