コード例 #1
0
ファイル: PublicKeyTest.java プロジェクト: anastiel/i2p.i2p
 public DataStructure createDataStructure() throws DataFormatException {
   PublicKey publicKey = new PublicKey();
   byte data[] = new byte[PublicKey.KEYSIZE_BYTES];
   for (int i = 0; i < data.length; i++) data[i] = (byte) (i % 16);
   publicKey.setData(data);
   return publicKey;
 }
コード例 #2
0
ファイル: PublicKeyTest.java プロジェクト: anastiel/i2p.i2p
  public void testNullEquals() {
    PublicKey publicKey = new PublicKey();
    byte data[] = new byte[PublicKey.KEYSIZE_BYTES];
    for (int i = 0; i < data.length; i++) data[i] = (byte) (i % 56);
    publicKey.setData(data);

    assertFalse(publicKey.equals(null));
  }
コード例 #3
0
ファイル: PublicKeyTest.java プロジェクト: anastiel/i2p.i2p
  public void testBase64Constructor() throws Exception {
    PublicKey publicKey = new PublicKey();
    byte data[] = new byte[PublicKey.KEYSIZE_BYTES];
    for (int i = 0; i < data.length; i++) data[i] = (byte) (i % 56);
    publicKey.setData(data);

    PublicKey key2 = new PublicKey(publicKey.toBase64());
    assertEquals(publicKey, key2);
  }
コード例 #4
0
ファイル: PublicKeyTest.java プロジェクト: anastiel/i2p.i2p
  public void testShortData() throws Exception {
    PublicKey publicKey = new PublicKey();
    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);
  }