Methods Summary |
---|
protected void | setUp()
super.setUp();
mTestStream1 = new ByteArrayInputStream(TEST_STRING_1);
|
public void | testString1Authenticate_NullTag_Failure()
Mac mac = Mac.getInstance("HMAC-SHA1");
mac.init(HMAC_KEY_1);
MacAuthenticatedInputStream is = new MacAuthenticatedInputStream(mTestStream1, mac);
assertTrue(Arrays.equals(TEST_STRING_1, Streams.readFully(is)));
assertFalse(is.isTagEqual(null));
|
public void | testString1Authenticate_ReadSingleByte_Success()
Mac mac = Mac.getInstance("HMAC-SHA1");
mac.init(HMAC_KEY_1);
MacAuthenticatedInputStream is = new MacAuthenticatedInputStream(mTestStream1, mac);
int numRead = 0;
while (is.read() != -1) {
numRead++;
if (numRead > TEST_STRING_1.length) {
fail("read too many bytes");
}
}
assertEquals(TEST_STRING_1.length, numRead);
assertTrue(is.isTagEqual(TEST_STRING_1_MAC));
|
public void | testString1Authenticate_Success()
Mac mac = Mac.getInstance("HMAC-SHA1");
mac.init(HMAC_KEY_1);
MacAuthenticatedInputStream is = new MacAuthenticatedInputStream(mTestStream1, mac);
assertTrue(Arrays.equals(TEST_STRING_1, Streams.readFully(is)));
assertTrue(is.isTagEqual(TEST_STRING_1_MAC));
|
public void | testString1Authenticate_WrongTag_Failure()
Mac mac = Mac.getInstance("HMAC-SHA1");
mac.init(HMAC_KEY_1);
MacAuthenticatedInputStream is = new MacAuthenticatedInputStream(mTestStream1, mac);
assertTrue(Arrays.equals(TEST_STRING_1, Streams.readFully(is)));
assertFalse(is.isTagEqual(TEST_STRING_1_MAC_BROKEN));
|