code: public static byte[] toByteArray(ASN1Primitive obj)
  	throws IOException {
  	ByteArrayOutputStream bout = new ByteArrayOutputStream();
  	DEROutputStream der = new DEROutputStream(bout);
  	der.writeObject(obj);
  	return bout.toByteArray();
      }
docs: Converts given <code>DERObject</code> into
  a DER-encoded byte array.
  
  @param obj DERObject to convert.
  @return the DER-encoded byte array
  @exception IOException if conversion fails