Top Constructors Methods
org.keycloak.jose.jwk

public Class JWKUtil

extends Object
Class Inheritance
Imports
java.math.BigInteger, java.util.Arrays

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

Byte array representation of the BigInteger parameter
toIntegerBytes
(final BigInteger
BigInteger to be converted
bigInt
)

Coverts BigInteger to 64-byte array removing the sign byte if necessary.

public static byte[]

Returns:

Byte array representation of the BigInteger parameter with length (bitlen + 7) / 8
toIntegerBytes
(final BigInteger
BigInteger to be converted
bigInt
,
int
The bit length size of the integer (for example 521 for EC P-521)
bitlen
)

Coverts BigInteger to 64-byte array but maintaining the length to bitlen as specified in rfc7518 for certain fields (X and Y parameter for EC keys).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

JWKUtilback to summary
public JWKUtil()

Method Detail

toIntegerBytesback to summary
public static byte[] toIntegerBytes(final BigInteger bigInt)

Coverts BigInteger to 64-byte array removing the sign byte if necessary.

Parameters
bigInt:BigInteger

BigInteger to be converted

Returns:byte[]

Byte array representation of the BigInteger parameter

toIntegerBytesback to summary
public static byte[] toIntegerBytes(final BigInteger bigInt, int bitlen)

Coverts BigInteger 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

BigInteger to be converted

bitlen:int

The bit length size of the integer (for example 521 for EC P-521)

Returns:byte[]

Byte array representation of the BigInteger parameter with length (bitlen + 7) / 8

Exceptions
IllegalStateException:
if the big integer is longer than bitlen