public DataStructure createDataStructure() throws DataFormatException {
   SigningPublicKey publicKey = new SigningPublicKey();
   byte data[] = new byte[SigningPublicKey.KEYSIZE_BYTES];
   for (int i = 0; i < data.length; i++) data[i] = (byte) (i % 16);
   publicKey.setData(data);
   return publicKey;
 }
  public void testNullEquals() {
    SigningPublicKey publicKey = new SigningPublicKey();
    byte data[] = new byte[SigningPublicKey.KEYSIZE_BYTES];
    for (int i = 0; i < data.length; i++) data[i] = (byte) (i % 56);
    publicKey.setData(data);

    assertFalse(publicKey.equals(null));
  }
  public void testBase64Constructor() throws Exception {
    SigningPublicKey publicKey = new SigningPublicKey();
    byte data[] = new byte[SigningPublicKey.KEYSIZE_BYTES];
    for (int i = 0; i < data.length; i++) data[i] = (byte) (i % 56);
    publicKey.setData(data);

    SigningPublicKey key2 = new SigningPublicKey(publicKey.toBase64());
    assertEquals(publicKey, key2);
  }
 public void testShortRead() throws Exception {
   SigningPublicKey publicKey = new SigningPublicKey();
   ByteArrayInputStream in =
       new ByteArrayInputStream("six times nine equals forty-two".getBytes());
   boolean error = false;
   try {
     publicKey.readBytes(in);
   } catch (DataFormatException dfe) {
     error = true;
   }
   assertTrue(error);
 }
  public void testNullData() throws Exception {
    SigningPublicKey publicKey = new SigningPublicKey();
    publicKey.toString();

    boolean error = false;
    try {
      publicKey.writeBytes(new ByteArrayOutputStream());
    } catch (DataFormatException dfe) {
      error = true;
    }
    assertTrue(error);
  }
  public void testShortData() throws Exception {
    SigningPublicKey publicKey = new SigningPublicKey();
    byte data[] = new byte[56];
    for (int i = 0; i < data.length; i++) data[i] = (byte) (i);

    boolean error = false;
    try {
      publicKey.setData(data);
      publicKey.writeBytes(new ByteArrayOutputStream());
    } catch (DataFormatException dfe) {
      error = true;
    } catch (IllegalArgumentException exc) {
      error = true;
    }

    assertTrue(error);
  }