resolve darcs stupidity
[org.ibex.core.git] / src / org / bouncycastle / asn1 / DEROctetString.java
index fd9f516..9ce9350 100644 (file)
@@ -3,47 +3,21 @@ package org.bouncycastle.asn1;
 import java.io.*;
 
 public class DEROctetString
-    extends DERObject
+    extends ASN1OctetString
 {
-    byte[]  string;
-
     /**
      * @param string the octets making up the octet string.
      */
     public DEROctetString(
         byte[]  string)
     {
-        this.string = string;
-    }
-
-    public DEROctetString(
-        DERObject  obj)
-    {
-        try
-        {
-            ByteArrayOutputStream   bOut = new ByteArrayOutputStream();
-            DEROutputStream         dOut = new DEROutputStream(bOut);
-
-            dOut.writeObject(obj);
-            dOut.close();
-
-            this.string = bOut.toByteArray();
-        }
-        catch (IOException e)
-        {
-            throw new IllegalArgumentException("Error processing object : " + e.toString());
-        }
+        super(string);
     }
 
     public DEROctetString(
         DEREncodable  obj)
     {
-        this(obj.getDERObject());
-    }
-
-    public byte[] getOctets()
-    {
-        return string;
+        super(obj);
     }
 
     void encode(
@@ -52,46 +26,4 @@ public class DEROctetString
     {
         out.writeEncoded(OCTET_STRING, string);
     }
-
-    public int hashCode()
-    {
-        byte[]  b = this.getOctets();
-        int     value = 0;
-
-        for (int i = 0; i != b.length; i++)
-        {
-            value ^= (b[i] & 0xff) << (i % 4);
-        }
-
-        return value;
-    }
-
-    public boolean equals(
-        Object  o)
-    {
-        if (o == null || !(o instanceof DEROctetString))
-        {
-            return false;
-        }
-
-        DEROctetString  other = (DEROctetString)o;
-
-        if (other.getOctets().length != this.getOctets().length)
-        {
-            return false;
-        }
-
-        byte[]  b1 = other.getOctets();
-        byte[]  b2 = this.getOctets();
-
-        for (int i = 0; i != b1.length; i++)
-        {
-            if (b1[i] != b2[i])
-            {
-                return false;
-            }
-        }
-
-        return true;
-    }
 }