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

public Class EdDSAOperations

extends Object
Class Inheritance
Imports
sun.security.ec.point.AffinePoint, .Point, sun.security.util.ArrayUtil, sun.security.util.math.IntegerFieldModuloP, .IntegerModuloP, .MutableIntegerModuloP, java.math.BigInteger, java.security.InvalidKeyException, .NoSuchAlgorithmException, .SecureRandom, .SignatureException, java.security.spec.EdDSAParameterSpec, .EdECPoint, java.util.Arrays, java.util.function.Function

Field Summary

Modifier and TypeField and Description
private final EdDSAParameters

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static EdECPoint
public EdECPoint
computePublic(byte[] privateKey)

public <T extends Throwable> AffinePoint
decodeAffinePoint(Function<String, T> exception, byte[] arr)

public <T extends Throwable> AffinePoint
private static byte[]
encode(int length, Point p)

private static byte[]
encode(int length, AffinePoint p)

public byte[]
public EdDSAParameters
private static int

Returns:

the number, in range [0,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 static void
prune(byte[]
an encoded scalar value
k
,
int
the number of bits in the scalar
bits
,
int
the base-2 logarithm of the co-factor
logCofactor
)

Prune an encoded scalar value by modifying it in place.

pack-priv void
prune(byte[] arr)

public byte[]
sign(EdDSAParameterSpec sigParams, byte[] privateKey, byte[] message)

public boolean
verify(EdDSAParameterSpec sigParams, AffinePoint affineA, byte[] publicKey, byte[] message, byte[] signature)

public boolean
verify(EdDSAParameterSpec sigParams, byte[] publicKey, byte[] message, byte[] signature)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

paramsback to summary
private final EdDSAParameters params

Constructor Detail

EdDSAOperationsback to summary
public EdDSAOperations(EdDSAParameters params) throws NoSuchAlgorithmException

Method Detail

asEdECPointback to summary
private static EdECPoint asEdECPoint(AffinePoint p)
computePublicback to summary
public EdECPoint computePublic(byte[] privateKey)
decodeAffinePointback to summary
public <T extends Throwable> AffinePoint decodeAffinePoint(Function<String, T> exception, byte[] arr) throws Function:T
decodeAffinePointback to summary
public <T extends Throwable> AffinePoint decodeAffinePoint(Function<String, T> exception, EdECPoint point) throws Function:T
encodeback to summary
private static byte[] encode(int length, Point p)
encodeback to summary
private static byte[] encode(int length, AffinePoint p)
generatePrivateback to summary
public byte[] generatePrivate(SecureRandom random)
getParametersback to summary
public EdDSAParameters getParameters()
maskHighOrderback to summary
private static int 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:int

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

pruneback to summary
private static void prune(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 it set, and the number is rounded down to a multiple of the co-factor.

Parameters
k:byte[]

an encoded scalar value

bits:int

the number of bits in the scalar

logCofactor:int

the base-2 logarithm of the co-factor

pruneback to summary
pack-priv void prune(byte[] arr)
signback to summary
public byte[] sign(EdDSAParameterSpec sigParams, byte[] privateKey, byte[] message)
verifyback to summary
public boolean verify(EdDSAParameterSpec sigParams, AffinePoint affineA, byte[] publicKey, byte[] message, byte[] signature) throws SignatureException
verifyback to summary
public boolean verify(EdDSAParameterSpec sigParams, byte[] publicKey, byte[] message, byte[] signature) throws InvalidKeyException, SignatureException