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];
33 Integer.parseInt(tok.nextToken()) * 40
34 + Integer.parseInt(tok.nextToken()));
36 while (tok.hasMoreTokens())
39 // translate into base 128
41 int value = Integer.parseInt(tok.nextToken());
42 int count = iBuf.length - 1;
44 iBuf[count--] = (byte)(value % 128);
49 iBuf[count--] = (byte)((value % 128) | 0x80);
52 dOut.write(iBuf, count + 1, iBuf.length - (count + 1));
57 byte[] bytes = bOut.toByteArray();
59 out.writeEncoded(OBJECT_IDENTIFIER, bytes);
64 return identifier.hashCode();
67 public boolean equals(
70 if ((o == null) || !(o instanceof DERObjectIdentifier))
75 return identifier.equals(((DERObjectIdentifier)o).identifier);