mirror of https://github.com/shred/acme4j
Accepting hmac key of all sizes
parent
0eb57839b9
commit
daa2c1ccaa
|
@ -245,7 +245,9 @@ public final class JoseUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
var size = macKey.getEncoded().length * 8;
|
var size = macKey.getEncoded().length * 8;
|
||||||
if (size >= 256) {
|
if(size < 256) {
|
||||||
|
throw new IllegalArgumentException("Bad key size: " + size);
|
||||||
|
}
|
||||||
if (size >= 512) {
|
if (size >= 512) {
|
||||||
return AlgorithmIdentifiers.HMAC_SHA512;
|
return AlgorithmIdentifiers.HMAC_SHA512;
|
||||||
} else if (size >= 384) {
|
} else if (size >= 384) {
|
||||||
|
@ -253,8 +255,5 @@ public final class JoseUtils {
|
||||||
} else {
|
} else {
|
||||||
return AlgorithmIdentifiers.HMAC_SHA256;
|
return AlgorithmIdentifiers.HMAC_SHA256;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("Bad key size: " + size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue