Package org.gudy.bouncycastle.util
Class BigIntegers
- java.lang.Object
-
- org.gudy.bouncycastle.util.BigIntegers
-
public final class BigIntegers extends java.lang.Object
BigInteger utilities.
-
-
Field Summary
Fields Modifier and Type Field Description private static int
MAX_ITERATIONS
private static java.math.BigInteger
ZERO
-
Constructor Summary
Constructors Constructor Description BigIntegers()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static byte[]
asUnsignedByteArray(java.math.BigInteger value)
Return the passed in value as an unsigned byte array.static java.math.BigInteger
createRandomInRange(java.math.BigInteger min, java.math.BigInteger max, java.security.SecureRandom random)
Return a random BigInteger not less than 'min' and not greater than 'max'
-
-
-
Field Detail
-
MAX_ITERATIONS
private static final int MAX_ITERATIONS
- See Also:
- Constant Field Values
-
ZERO
private static final java.math.BigInteger ZERO
-
-
Method Detail
-
asUnsignedByteArray
public static byte[] asUnsignedByteArray(java.math.BigInteger value)
Return the passed in value as an unsigned byte array.- Parameters:
value
- value to be converted.- Returns:
- a byte array without a leading zero byte if present in the signed encoding.
-
createRandomInRange
public static java.math.BigInteger createRandomInRange(java.math.BigInteger min, java.math.BigInteger max, java.security.SecureRandom random)
Return a random BigInteger not less than 'min' and not greater than 'max'- Parameters:
min
- the least value that may be generatedmax
- the greatest value that may be generatedrandom
- the source of randomness- Returns:
- a random BigInteger value in the range [min,max]
-
-