Package org.forgerock.json.jose.utils
Class BigIntegerUtils
- java.lang.Object
-
- org.forgerock.json.jose.utils.BigIntegerUtils
-
public final class BigIntegerUtils extends Object
Utils to complement bit operations not covered by the BigInteger functions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BigInteger
base64UrlDecode(String magnitudeBase64UrlEncoded)
Decode a big-endian base64 url encoding of a magnitude big integer and transform it as a positive big integer.static String
base64UrlEncodeUnsignedBigEndian(BigInteger number)
Encode a big integer into a base 64 url encoded unsigned big endian.static byte[]
toBytesUnsigned(BigInteger x)
Returns the unsigned big-endian byte array of a big integer.
-
-
-
Method Detail
-
toBytesUnsigned
public static byte[] toBytesUnsigned(BigInteger x)
Returns the unsigned big-endian byte array of a big integer. Any leading zero sign byte is removed.- Parameters:
x
- a big integer- Returns:
- the unsigned big-endian byte array of x
-
base64UrlDecode
public static BigInteger base64UrlDecode(String magnitudeBase64UrlEncoded)
Decode a big-endian base64 url encoding of a magnitude big integer and transform it as a positive big integer.- Parameters:
magnitudeBase64UrlEncoded
- big-endian base64 url encoding of a big integer magnitude- Returns:
- a positive big integer with the decoded magnitude.
-
base64UrlEncodeUnsignedBigEndian
public static String base64UrlEncodeUnsignedBigEndian(BigInteger number)
Encode a big integer into a base 64 url encoded unsigned big endian.- Parameters:
number
- a big integer- Returns:
- big-endian base64 url encoding of a big integer magnitude
-
-