Top Description Fields Constructors Methods
org.bouncycastle.util

public final Class BigIntegers

extends Object
Class Inheritance
Imports
java.math.BigInteger, java.security.SecureRandom

BigInteger utilities.

Field Summary

Modifier and TypeField and Description
private static final int
public static final BigInteger
public static final BigInteger

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static byte[]

Returns:

a byte array without a leading zero byte if present in the signed encoding.
asUnsignedByteArray
(BigInteger
value to be converted.
value
)

Return the passed in value as an unsigned byte array.

public static byte[]

Returns:

a byte array without a leading zero byte if present in the signed encoding.
asUnsignedByteArray
(int length, BigInteger
value to be converted.
value
)

Return the passed in value as an unsigned byte array.

private static byte[]
createRandom(int bitLength, SecureRandom random)

public static BigInteger

Returns:

a positive BigInteger
createRandomBigInteger
(int
maximum bit length for the generated BigInteger.
bitLength
,
SecureRandom
a source of randomness.
random
)

Return a positive BigInteger in the range of 0 to 2**bitLength - 1.

public static BigInteger

Returns:

a random BigInteger value in the range [min,max]
createRandomInRange
(BigInteger
the least value that may be generated
min
,
BigInteger
the greatest value that may be generated
max
,
SecureRandom
the source of randomness
random
)

Return a random BigInteger not less than 'min' and not greater than 'max'

public static BigInteger
public static BigInteger
fromUnsignedByteArray(byte[] buf, int off, int length)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

MAX_ITERATIONSback to summary
private static final int MAX_ITERATIONS
ONEback to summary
public static final BigInteger ONE
ZEROback to summary
public static final BigInteger ZERO

Constructor Detail

BigIntegersback to summary
public BigIntegers()

Method Detail

asUnsignedByteArrayback to summary
public static byte[] asUnsignedByteArray(BigInteger value)

Return the passed in value as an unsigned byte array.

Parameters
value:BigInteger

value to be converted.

Returns:byte[]

a byte array without a leading zero byte if present in the signed encoding.

asUnsignedByteArrayback to summary
public static byte[] asUnsignedByteArray(int length, BigInteger value)

Return the passed in value as an unsigned byte array.

Parameters
value:BigInteger

value to be converted.

Returns:byte[]

a byte array without a leading zero byte if present in the signed encoding.

createRandomback to summary
private static byte[] createRandom(int bitLength, SecureRandom random) throws IllegalArgumentException
createRandomBigIntegerback to summary
public static BigInteger createRandomBigInteger(int bitLength, SecureRandom random)

Return a positive BigInteger in the range of 0 to 2**bitLength - 1.

Parameters
bitLength:int

maximum bit length for the generated BigInteger.

random:SecureRandom

a source of randomness.

Returns:BigInteger

a positive BigInteger

createRandomInRangeback to summary
public static BigInteger createRandomInRange(BigInteger min, BigInteger max, SecureRandom random)

Return a random BigInteger not less than 'min' and not greater than 'max'

Parameters
min:BigInteger

the least value that may be generated

max:BigInteger

the greatest value that may be generated

random:SecureRandom

the source of randomness

Returns:BigInteger

a random BigInteger value in the range [min,max]

fromUnsignedByteArrayback to summary
public static BigInteger fromUnsignedByteArray(byte[] buf)
fromUnsignedByteArrayback to summary
public static BigInteger fromUnsignedByteArray(byte[] buf, int off, int length)