APIdia Launch Partner
Top Description Inners Methods
sun.security.util.math

public Interface IntegerModuloP

Known Direct Subinterfaces
sun.security.util.math.MutableIntegerModuloP, sun.security.util.math.ImmutableIntegerModuloP
Known Direct Implementers
sun.security.util.math.intpoly.IntegerPolynomial.Element
Imports
sun.security.util.math.intpoly.IntegerPolynomialP256, .P256OrderField, java.math.BigInteger

The base interface for integers modulo a prime value. Objects of this type may be either mutable or immutable, and subinterfaces can be used to specify that an object is mutable or immutable. This type should never be used to declare local/member variables, but it may be used for formal parameters of a method. None of the methods in this interface modify the value of arguments or this. The behavior of this interface depends on the particular implementation. For example, some implementations only support a limited number of add operations before each multiply operation. See the documentation of the implementation for details.
See Also
ImmutableIntegerModuloP, MutableIntegerModuloP

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface

Method Summary

Modifier and TypeMethod and Description
public ImmutableIntegerModuloP

Returns:

this + b
add
(IntegerModuloP
the sumand
b
)

Add this field element with the supplied element and return the result.

public ImmutableIntegerModuloP

Returns:

the addditiveInverse (0 - this)
additiveInverse
()

Compute the additive inverse of the field element

public default byte[]

Returns:

a byte array of length len containing the result
addModPowerTwo
(IntegerModuloP
the sumand
b
,
int
the length of the desired array
len
)

Perform an addition modulo a power of two and return the little-endian encoding of the result.

public void
addModPowerTwo(IntegerModuloP
the sumand
b
,
byte[]
an array which stores the result upon return
result
)

Perform an addition modulo a power of two and store the little-endian encoding of the result in the supplied array.

public BigInteger

Returns:

the value as a BigInteger
asBigInteger
()

Get the canonical value of this element as a BigInteger.

public default byte[]

Returns:

a byte array of length len containing the result
asByteArray
(int
the length of the desired array
len
)

Returns the little-endian encoding of this' % 2^(8 * len), where this' is the canonical integer value equivalent to this.

public void
asByteArray(byte[]
an array which stores the result upon return
result
)

Places the little-endian encoding of this' % 2^(8 * result.length) into the supplied array, where this' is the canonical integer value equivalent to this.

public ImmutableIntegerModuloP

Returns:

a fixed element with the same value
fixed
()

Return this value as a fixed (immutable) element.

public IntegerFieldModuloP

Returns:

the field
getField
()

Get the field associated with this element.

public long[]
getLimbs()

Break encapsulation, used for IntrinsicCandidate functions

public default ImmutableIntegerModuloP

Returns:

the multiplicative inverse (1 / this)
multiplicativeInverse
()

Compute the multiplicative inverse of this field element.

public ImmutableIntegerModuloP

Returns:

this * b
multiply
(IntegerModuloP
the multiplicand
b
)

Multiply this field element with the supplied element and return the result.

public MutableIntegerModuloP

Returns:

a mutable element with the same value
mutable
()

Return this value as a mutable element.

public default ImmutableIntegerModuloP

Returns:

the value of this^b
pow
(BigInteger
the exponent
b
)

Calculate the power this^b and return the result.

public default ImmutableIntegerModuloP

Returns:

the product (this * this)
square
()

Calculate the square of this element and return the result.

public default ImmutableIntegerModuloP

Returns:

the difference (this - b)
subtract
(IntegerModuloP
the subtrahend
b
)

Subtract the supplied element from this one and return the result.

Method Detail

addback to summary
public ImmutableIntegerModuloP add(IntegerModuloP b)

Add this field element with the supplied element and return the result.

Parameters
b:IntegerModuloP

the sumand

Returns:ImmutableIntegerModuloP

this + b

additiveInverseback to summary
public ImmutableIntegerModuloP additiveInverse()

Compute the additive inverse of the field element

Returns:ImmutableIntegerModuloP

the addditiveInverse (0 - this)

addModPowerTwoback to summary
public default byte[] addModPowerTwo(IntegerModuloP b, int len)

Perform an addition modulo a power of two and return the little-endian encoding of the result. The value is (this' + b') % 2^(8 * len), where this' and b' are the canonical integer values equivalent to this and b.

Parameters
b:IntegerModuloP

the sumand

len:int

the length of the desired array

Returns:byte[]

a byte array of length len containing the result

addModPowerTwoback to summary
public void addModPowerTwo(IntegerModuloP b, byte[] result)

Perform an addition modulo a power of two and store the little-endian encoding of the result in the supplied array. The value is (this' + b') % 2^(8 * result.length), where this' and b' are the canonical integer values equivalent to this and b.

Parameters
b:IntegerModuloP

the sumand

result:byte[]

an array which stores the result upon return

asBigIntegerback to summary
public BigInteger asBigInteger()

Get the canonical value of this element as a BigInteger. This value will always be in the range [0, p), where p is the prime that defines the field. This method performs reduction and other computation to produce the result.

Returns:BigInteger

the value as a BigInteger

asByteArrayback to summary
public default byte[] asByteArray(int len)

Returns the little-endian encoding of this' % 2^(8 * len), where this' is the canonical integer value equivalent to this.

Parameters
len:int

the length of the desired array

Returns:byte[]

a byte array of length len containing the result

asByteArrayback to summary
public void asByteArray(byte[] result)

Places the little-endian encoding of this' % 2^(8 * result.length) into the supplied array, where this' is the canonical integer value equivalent to this.

Parameters
result:byte[]

an array which stores the result upon return

fixedback to summary
public ImmutableIntegerModuloP fixed()

Return this value as a fixed (immutable) element. This method will copy the underlying representation if the object is mutable.

Returns:ImmutableIntegerModuloP

a fixed element with the same value

getFieldback to summary
public IntegerFieldModuloP getField()

Get the field associated with this element.

Returns:IntegerFieldModuloP

the field

getLimbsback to summary
public long[] getLimbs()

Break encapsulation, used for IntrinsicCandidate functions

multiplicativeInverseback to summary
public default ImmutableIntegerModuloP multiplicativeInverse()

Compute the multiplicative inverse of this field element.

Returns:ImmutableIntegerModuloP

the multiplicative inverse (1 / this)

multiplyback to summary
public ImmutableIntegerModuloP multiply(IntegerModuloP b)

Multiply this field element with the supplied element and return the result.

Parameters
b:IntegerModuloP

the multiplicand

Returns:ImmutableIntegerModuloP

this * b

mutableback to summary
public MutableIntegerModuloP mutable()

Return this value as a mutable element. This method will always copy the underlying representation.

Returns:MutableIntegerModuloP

a mutable element with the same value

powback to summary
public default ImmutableIntegerModuloP pow(BigInteger b)

Calculate the power this^b and return the result.

Parameters
b:BigInteger

the exponent

Returns:ImmutableIntegerModuloP

the value of this^b

squareback to summary
public default ImmutableIntegerModuloP square()

Calculate the square of this element and return the result. This method should be used instead of a.multiply(a) because implementations may include optimizations that only apply to squaring.

Returns:ImmutableIntegerModuloP

the product (this * this)

subtractback to summary
public default ImmutableIntegerModuloP subtract(IntegerModuloP b)

Subtract the supplied element from this one and return the result.

Parameters
b:IntegerModuloP

the subtrahend

Returns:ImmutableIntegerModuloP

the difference (this - b)

sun.security.util.math back to summary

public sealed Interface IntegerModuloP.MultiplicativeInverser

permits Default, Secp256R1, Secp256R1Field
Known Direct Implementers
sun.security.util.math.IntegerModuloP.MultiplicativeInverser.Default, sun.security.util.math.IntegerModuloP.MultiplicativeInverser.Secp256R1, sun.security.util.math.IntegerModuloP.MultiplicativeInverser.Secp256R1Field

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
public static class
public static class

Method Summary

Modifier and TypeMethod and Description
public ImmutableIntegerModuloP

Returns:

the multiplicative inverse (1 / imp)
inverse
(IntegerModuloP imp)

Compute the multiplicative inverse of imp.

public static IntegerModuloP.MultiplicativeInverser

Method Detail

inverseback to summary
public ImmutableIntegerModuloP inverse(IntegerModuloP imp)

Compute the multiplicative inverse of imp.

Returns:ImmutableIntegerModuloP

the multiplicative inverse (1 / imp)

ofback to summary
public static IntegerModuloP.MultiplicativeInverser of(BigInteger m)
sun.security.util.math back to summary

public final Class IntegerModuloP.MultiplicativeInverser.Default

extends Object
implements MultiplicativeInverser
Class Inheritance
  • java.lang.Object
  • sun.security.util.math.IntegerModuloP.MultiplicativeInverser.Default
All Implemented Interfaces
sun.security.util.math.IntegerModuloP.MultiplicativeInverser

Field Summary

Modifier and TypeField and Description
private final BigInteger
b

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public ImmutableIntegerModuloP
inverse(IntegerModuloP imp)

Implements sun.security.util.math.IntegerModuloP.MultiplicativeInverser.inverse.

Compute the multiplicative inverse of imp.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bback to summary
private final BigInteger b

Constructor Detail

Defaultback to summary
pack-priv Default(BigInteger b)
sun.security.util.math back to summary

public final Class IntegerModuloP.MultiplicativeInverser.Secp256R1

extends Object
implements MultiplicativeInverser
Class Inheritance
  • java.lang.Object
  • sun.security.util.math.IntegerModuloP.MultiplicativeInverser.Secp256R1
All Implemented Interfaces
sun.security.util.math.IntegerModuloP.MultiplicativeInverser

Field Summary

Modifier and TypeField and Description
private static final IntegerModuloP.MultiplicativeInverser.Secp256R1

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ImmutableIntegerModuloP
inverse(IntegerModuloP imp)

Implements sun.security.util.math.IntegerModuloP.MultiplicativeInverser.inverse.

Compute the multiplicative inverse of imp.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

instanceback to summary
private static final IntegerModuloP.MultiplicativeInverser.Secp256R1 instance

Constructor Detail

Secp256R1back to summary
public Secp256R1()
sun.security.util.math back to summary

public final Class IntegerModuloP.MultiplicativeInverser.Secp256R1Field

extends Object
implements MultiplicativeInverser
Class Inheritance
  • java.lang.Object
  • sun.security.util.math.IntegerModuloP.MultiplicativeInverser.Secp256R1Field
All Implemented Interfaces
sun.security.util.math.IntegerModuloP.MultiplicativeInverser

Field Summary

Modifier and TypeField and Description
private static final BigInteger
b

private static final IntegerModuloP.MultiplicativeInverser.Secp256R1Field

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public ImmutableIntegerModuloP
inverse(IntegerModuloP imp)

Implements sun.security.util.math.IntegerModuloP.MultiplicativeInverser.inverse.

Compute the multiplicative inverse of imp.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bback to summary
private static final BigInteger b
instanceback to summary
private static final IntegerModuloP.MultiplicativeInverser.Secp256R1Field instance

Constructor Detail

Secp256R1Fieldback to summary
public Secp256R1Field()