1 package org.bouncycastle.asn1;
5 public class DEROctetString
11 * @param string the octets making up the octet string.
13 public DEROctetString(
19 public DEROctetString(
24 ByteArrayOutputStream bOut = new ByteArrayOutputStream();
25 DEROutputStream dOut = new DEROutputStream(bOut);
27 dOut.writeObject(obj);
30 this.string = bOut.toByteArray();
34 throw new IllegalArgumentException("Error processing object : " + e.toString());
38 public DEROctetString(
41 this(obj.getDERObject());
44 public byte[] getOctets()
53 out.writeEncoded(OCTET_STRING, string);
58 byte[] b = this.getOctets();
61 for (int i = 0; i != b.length; i++)
63 value ^= (b[i] & 0xff) << (i % 4);
69 public boolean equals(
72 if (o == null || !(o instanceof DEROctetString))
77 DEROctetString other = (DEROctetString)o;
79 if (other.getOctets().length != this.getOctets().length)
84 byte[] b1 = other.getOctets();
85 byte[] b2 = this.getOctets();
87 for (int i = 0; i != b1.length; i++)