Package org.keycloak.jose.jwk
Class JWKUtil
java.lang.Object
org.keycloak.jose.jwk.JWKUtil
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
toIntegerBytes
(BigInteger bigInt) CovertsBigInteger
to 64-byte array removing the sign byte if necessary.static byte[]
toIntegerBytes
(BigInteger bigInt, int bitlen) CovertsBigInteger
to 64-byte array but maintaining the length to bitlen as specified in rfc7518 for certain fields (X and Y parameter for EC keys).
-
Constructor Details
-
JWKUtil
public JWKUtil()
-
-
Method Details
-
toIntegerBytes
CovertsBigInteger
to 64-byte array removing the sign byte if necessary.- Parameters:
bigInt
-BigInteger
to be converted- Returns:
- Byte array representation of the BigInteger parameter
-
toIntegerBytes
CovertsBigInteger
to 64-byte array but maintaining the length to bitlen as specified in rfc7518 for certain fields (X and Y parameter for EC keys).- Parameters:
bigInt
-BigInteger
to be convertedbitlen
- The bit length size of the integer (for example 521 for EC P-521)- Returns:
- Byte array representation of the BigInteger parameter with length (bitlen + 7) / 8
- Throws:
IllegalStateException
- if the big integer is longer than bitlen
-