Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickfav committed Sep 30, 2017
1 parent 9dd5925 commit 10c104b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/at/favre/crypto/HKDF.java
Expand Up @@ -173,7 +173,7 @@ public static byte[] expand(HkdfMacFactory macFactory, byte[] pseudoRandomKey, b
* @return new byte array of output keying material (OKM)
*/
public static byte[] hkdfSha256(byte[] inputKeyingMaterial, byte[] saltExtract, byte[] infoExpand, int outLengthByte) {
return hkdf(HkdfMacFactory.Default.hmacSha256(), infoExpand, saltExtract, infoExpand, outLengthByte);
return hkdf(HkdfMacFactory.Default.hmacSha256(), inputKeyingMaterial, saltExtract, infoExpand, outLengthByte);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/at/favre/crypto/HKDFTest.java
Expand Up @@ -100,6 +100,8 @@ public void testExpandFailures() throws Exception {

@Test
public void hkdf() throws Exception {
checkLength(HKDF.hkdf(HkdfMacFactory.Default.hmacSha1(), RandomUtils.nextBytes(16), RandomUtils.nextBytes(16), null, 80), 80);
checkLength(HKDF.hkdfSha256(RandomUtils.nextBytes(16), RandomUtils.nextBytes(16), null, 80), 80);
}

@Test
Expand Down

0 comments on commit 10c104b

Please sign in to comment.