Package org.keycloak.jose.jwk
Class JWKUtil
- java.lang.Object
-
- org.keycloak.jose.jwk.JWKUtil
-
public class JWKUtil extends Object
-
-
Constructor Summary
Constructors Constructor Description JWKUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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).
-
-
-
Method Detail
-
toIntegerBytes
public static byte[] toIntegerBytes(BigInteger bigInt)
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
public 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).- 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
-
-