1 package org.bouncycastle.asn1;
5 public class DERObjectIdentifier
10 public DERObjectIdentifier(
13 this.identifier = identifier;
25 OIDTokenizer tok = new OIDTokenizer(identifier);
26 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
27 DEROutputStream dOut = new DEROutputStream(bOut);
29 // space for 5 7 bit numbers in an int
30 byte[] iBuf = new byte[5];
32 // FIXED by Adam Megacz -- GCJ doesn't handle evaluation order properly
33 String t1 = tok.nextToken();
34 String t2 = tok.nextToken();
35 dOut.write(Integer.parseInt(t1) * 40 + Integer.parseInt(t2));
37 while (tok.hasMoreTokens())
40 // translate into base 128
42 int value = Integer.parseInt(tok.nextToken());
43 int count = iBuf.length - 1;
45 iBuf[count--] = (byte)(value % 128);
50 iBuf[count--] = (byte)((value % 128) | 0x80);
53 dOut.write(iBuf, count + 1, iBuf.length - (count + 1));
58 byte[] bytes = bOut.toByteArray();
60 out.writeEncoded(OBJECT_IDENTIFIER, bytes);
65 return identifier.hashCode();
68 public boolean equals(
71 if ((o == null) || !(o instanceof DERObjectIdentifier))
76 return identifier.equals(((DERObjectIdentifier)o).identifier);