APIdia Launch Partner
Top Fields Constructors Methods
sun.security.ec

public Class XECOperations

extends Object
Class Inheritance
Imports
sun.security.util.math.IntegerFieldModuloP, .ImmutableIntegerModuloP, .IntegerModuloP, .MutableIntegerModuloP, .SmallValue, sun.security.util.math.intpoly.IntegerPolynomial25519, .IntegerPolynomial448, java.math.BigInteger, java.security.ProviderException, .SecureRandom

Field Summary

Modifier and TypeField and Description
private final SmallValue
private final ImmutableIntegerModuloP
private final IntegerFieldModuloP
private final ImmutableIntegerModuloP
private final XECParameters
private final ImmutableIntegerModuloP

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private int
bitAt(byte[] arr, int index)

public BigInteger
computePublic(byte[] k)

Compute a public key from an encoded private key.

private static void
private ImmutableIntegerModuloP
decodeU(byte[] u, int bits)

Return the field element corresponding to an encoded u-coordinate.

private ImmutableIntegerModuloP
decodeU(byte[] u)

public byte[]

Returns:

the encoded product
encodedPointMultiply
(byte[]
an encoded scalar
k
,
BigInteger
the u-coordinate of a point as a BigInteger
u
)

Multiply an encoded scalar with a point as a BigInteger and return an encoded point.

public byte[]

Returns:

the encoded product
encodedPointMultiply
(byte[]
an encoded scalar
k
,
byte[]
an encoded point
u
)

Multiply an encoded scalar with an encoded point and return an encoded point.

public byte[]
private static IntegerFieldModuloP
public XECParameters
private static byte

Returns:

the number, in range [1,8], of bits kept in the highest byte
maskHighOrder
(byte[]
an array containing an encoded integer
arr
,
int
the number of bits to keep
bits
)

Mask off the high order bits of an encoded integer in an array.

private IntegerModuloP
private static void
pruneK(byte[]
an encoded scalar value
k
,
int
the number of bits in the scalar
bits
,
int
the base-2 logarithm of the cofactor
logCofactor
)

Prune an encoded scalar value by modifying it in place.

private void
pruneK(byte[] k)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

a24back to summary
private final SmallValue a24
basePointback to summary
private final ImmutableIntegerModuloP basePoint
fieldback to summary
private final IntegerFieldModuloP field
oneback to summary
private final ImmutableIntegerModuloP one
paramsback to summary
private final XECParameters params
zeroback to summary
private final ImmutableIntegerModuloP zero

Constructor Detail

XECOperationsback to summary
public XECOperations(XECParameters c)

Method Detail

bitAtback to summary
private int bitAt(byte[] arr, int index)
computePublicback to summary
public BigInteger computePublic(byte[] k)

Compute a public key from an encoded private key. This method will modify the supplied array in order to prune it.

cswapback to summary
private static void cswap(int swap, MutableIntegerModuloP x1, MutableIntegerModuloP x2)
decodeUback to summary
private ImmutableIntegerModuloP decodeU(byte[] u, int bits)

Return the field element corresponding to an encoded u-coordinate. This method prunes u by modifying it in place.

decodeUback to summary
private ImmutableIntegerModuloP decodeU(byte[] u)
encodedPointMultiplyback to summary
public byte[] encodedPointMultiply(byte[] k, BigInteger u)

Multiply an encoded scalar with a point as a BigInteger and return an encoded point. The array k holding the scalar will be pruned by modifying it in place.

Parameters
k:byte[]

an encoded scalar

u:BigInteger

the u-coordinate of a point as a BigInteger

Returns:byte[]

the encoded product

encodedPointMultiplyback to summary
public byte[] encodedPointMultiply(byte[] k, byte[] u)

Multiply an encoded scalar with an encoded point and return an encoded point. The array k holding the scalar will be pruned by modifying it in place.

Parameters
k:byte[]

an encoded scalar

u:byte[]

an encoded point

Returns:byte[]

the encoded product

generatePrivateback to summary
public byte[] generatePrivate(SecureRandom random)
getIntegerFieldModuloback to summary
private static IntegerFieldModuloP getIntegerFieldModulo(BigInteger p)
getParametersback to summary
public XECParameters getParameters()
maskHighOrderback to summary
private static byte maskHighOrder(byte[] arr, int bits)

Mask off the high order bits of an encoded integer in an array. The array is modified in place.

Parameters
arr:byte[]

an array containing an encoded integer

bits:int

the number of bits to keep

Returns:byte

the number, in range [1,8], of bits kept in the highest byte

pointMultiplyback to summary
private IntegerModuloP pointMultiply(byte[] k, ImmutableIntegerModuloP u)
pruneKback to summary
private static void pruneK(byte[] k, int bits, int logCofactor)

Prune an encoded scalar value by modifying it in place. The extra high-order bits are masked off, the highest valid bit is set, and the number is rounded down to a multiple of the cofactor.

Parameters
k:byte[]

an encoded scalar value

bits:int

the number of bits in the scalar

logCofactor:int

the base-2 logarithm of the cofactor

pruneKback to summary
private void pruneK(byte[] k)