Skip to content

Commit

Permalink
the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wangweij committed Mar 20, 2024
1 parent 7231fd7 commit 0cbd952
Show file tree
Hide file tree
Showing 5 changed files with 1,036 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ private static byte[] concat(byte[]... inputs) {
return o.toByteArray();
}

private static byte[] I2OSP(int n, int w) {
assert n < 256;
public static byte[] I2OSP(int n, int w) {
assert n < 65536;
assert w == 1 || w == 2;
if (w == 1) {
return new byte[] { (byte) n };
Expand All @@ -378,14 +378,14 @@ private static byte[] I2OSP(int n, int w) {
}
}

private static SecretKey LabeledExtract(HKDF kdf, byte[] suite_id,
public static SecretKey LabeledExtract(HKDF kdf, byte[] suite_id,
byte[] salt, byte[] label, byte[] ikm) throws InvalidKeyException {
return kdf.extract(salt,
new SecretKeySpec(concat(HPKE_V1, suite_id, label, ikm), "IKM"),
"HKDF-PRK");
}

private static byte[] LabeledExpand(HKDF kdf, byte[] suite_id,
public static byte[] LabeledExpand(HKDF kdf, byte[] suite_id,
SecretKey prk, byte[] label, byte[] info, int L)
throws InvalidKeyException {
byte[] labeled_info = concat(I2OSP(L, 2), HPKE_V1,
Expand Down
Loading

0 comments on commit 0cbd952

Please sign in to comment.