/** * Returns the key used to identify the provider implementation in {@code nifi.properties}. * * @return the key to persist in the sibling property */ @Override public String getIdentifierKey() { return IMPLEMENTATION_KEY + getKeySize(Hex.toHexString(key.getEncoded())); }
@Test public void testUpdateWithRange() { BaseMAC hmac = initHmac(); // a leading and trailing byte to the plaintext byte[] plainText = new byte[PLAIN_TEXT.length + 2]; System.arraycopy(PLAIN_TEXT, 0, plainText, 1, PLAIN_TEXT.length); // update with the range from the second to penultimate byte hmac.update(plainText, 1, PLAIN_TEXT.length); assertThat(Hex.toHexString(hmac.doFinal()), is(EXPECTED_HMAC)); }
@Test public void testDoFinalWithInput() { BaseMAC hmac = initHmac(); assertThat(Hex.toHexString(hmac.doFinal(PLAIN_TEXT)), is(EXPECTED_HMAC)); }
@Test public void testDoFinalWithInput() { HMACSHA196 hmac = initHmac(); assertThat(Hex.toHexString(hmac.doFinal(PLAIN_TEXT)), is(EXPECTED_HMAC)); }
@Test public void testDoFinalWithInput() { HMACMD596 hmac = initHmac(); assertThat(Hex.toHexString(hmac.doFinal(PLAIN_TEXT)), is(EXPECTED_HMAC)); }
@Test public void testDoFinalWithInput() { HMACSHA2512 hmac = initHmac(); assertThat(Hex.toHexString(hmac.doFinal(PLAIN_TEXT)), is(EXPECTED_HMAC)); }
@Test public void testDoFinalWithInput() { HMACMD5 hmac = initHmac(); assertThat(Hex.toHexString(hmac.doFinal(PLAIN_TEXT)), is(EXPECTED_HMAC)); }
@Test public void testResizeTooBigKeys() { BaseMAC hmac = new HMACSHA1(); hmac.init((KEY + "foo").getBytes(CHARSET)); hmac.update(PLAIN_TEXT); assertThat(Hex.toHexString(hmac.doFinal()), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinal() { HMACMD596 hmac = initHmac(); hmac.update(PLAIN_TEXT); assertThat(Hex.toHexString(hmac.doFinal()), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinal() { HMACSHA2256 hmac = initHmac(); hmac.update(PLAIN_TEXT); assertThat(Hex.toHexString(hmac.doFinal()), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinalWithResultBuffer() { HMACSHA2256 hmac = initHmac(); byte[] resultBuf = new byte[32]; hmac.update(PLAIN_TEXT); hmac.doFinal(resultBuf, 0); assertThat(Hex.toHexString(resultBuf), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinalWithResultBuffer() { BaseMAC hmac = initHmac(); byte[] resultBuf = new byte[20]; hmac.update(PLAIN_TEXT); hmac.doFinal(resultBuf, 0); assertThat(Hex.toHexString(resultBuf), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinal() { HMACSHA1 hmac = initHmac(); hmac.update(PLAIN_TEXT); assertThat(Hex.toHexString(hmac.doFinal()), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinalWithResultBuffer() { HMACMD596 hmac = initHmac(); byte[] resultBuf = new byte[12]; hmac.update(PLAIN_TEXT); hmac.doFinal(resultBuf, 0); assertThat(Hex.toHexString(resultBuf), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinalWithResultBuffer() { HMACMD5 hmac = initHmac(); byte[] resultBuf = new byte[16]; hmac.update(PLAIN_TEXT); hmac.doFinal(resultBuf, 0); assertThat(Hex.toHexString(resultBuf), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinal() { BaseMAC hmac = initHmac(); hmac.update(PLAIN_TEXT); assertThat(Hex.toHexString(hmac.doFinal()), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinal() { HMACSHA196 hmac = initHmac(); hmac.update(PLAIN_TEXT); assertThat(Hex.toHexString(hmac.doFinal()), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinal() { HMACSHA2512 hmac = initHmac(); hmac.update(PLAIN_TEXT); assertThat(Hex.toHexString(hmac.doFinal()), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinalWithResultBuffer() { HMACSHA2512 hmac = initHmac(); byte[] resultBuf = new byte[64]; hmac.update(PLAIN_TEXT); hmac.doFinal(resultBuf, 0); assertThat(Hex.toHexString(resultBuf), is(EXPECTED_HMAC)); }
@Test public void testUpdateWithDoFinal() { HMACMD5 hmac = initHmac(); hmac.update(PLAIN_TEXT); assertThat(Hex.toHexString(hmac.doFinal()), is(EXPECTED_HMAC)); }