java.lang.Object
net.i2p.crypto.eddsa.EdDSABlinding
Utilities for EdDSA key blinding operations. Provides methods to blind and unblind EdDSA keys for privacy protection.
Field Summary
Modifier and TypeFieldDescriptionprivate static final FieldThe field the curve's points live in.private static final byte[]-1 mod l, little endian; used by unblind to subtract alpha.private static final byte[]The value 1, little-endian, for scalar arithmetic.static final BigIntegerOrder of the Ed25519 prime-order subgroup, as used to reduce exponents.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionstatic EdDSAPrivateKeyblind(EdDSAPrivateKey key, EdDSAPrivateKey alpha) Blind an EdDSA private key.static EdDSAPublicKeyblind(EdDSAPublicKey key, EdDSAPrivateKey alpha) Blind an EdDSA key.static byte[]reduce(byte[] b) Reduce a 64-byte value modulo l.private static byte[]Encode a positive BigInteger below 2^256 as 32 little-endian bytes.static EdDSAPrivateKeyunblind(EdDSAPrivateKey key, EdDSAPrivateKey alpha) Unblind an EdDSA private key using alpha, the inverse ofblind(EdDSAPrivateKey, EdDSAPrivateKey): subtracts alpha from the blinded scalar mod l.
Field Details
ORDER
Order of the Ed25519 prime-order subgroup, as used to reduce exponents.ONE
private static final byte[] ONEThe value 1, little-endian, for scalar arithmetic.MINUS_ONE
private static final byte[] MINUS_ONE-1 mod l, little endian; used by unblind to subtract alpha.CURVE_FIELD
The field the curve's points live in.
Constructor Details
EdDSABlinding
private EdDSABlinding()Utility class, not intended for instantiation.
Method Details
blind
Blind an EdDSA key. Only for SigType EdDSA_SHA512_Ed25519.- Parameters:
key- must be SigType EdDSA_SHA512_Ed25519alpha- generated from hash of secret data- Returns:
- the blinded public key
- Throws:
UnsupportedOperationException- for an unsupported group representation
blind
Blind an EdDSA private key. Only for SigType EdDSA_SHA512_Ed25519.- Parameters:
key- must be SigType EdDSA_SHA512_Ed25519alpha- generated from hash of secret data- Returns:
- the blinded private key
- Throws:
UnsupportedOperationException- for an unsupported curve
unblind
Unblind an EdDSA private key using alpha, the inverse ofblind(EdDSAPrivateKey, EdDSAPrivateKey): subtracts alpha from the blinded scalar mod l. The recovered scalar is the original scalar reduced mod l; it yields the same public key point and signatures as the original.- Parameters:
key- must be SigType EdDSA_SHA512_Ed25519alpha- the same alpha used to blind the key- Returns:
- the unblinded private key
toLittleEndian
Encode a positive BigInteger below 2^256 as 32 little-endian bytes.- Parameters:
v- the value to encode- Returns:
- the value as 32 little-endian bytes, zero-padded
reduce
public static byte[] reduce(byte[] b) Reduce a 64-byte value modulo l. Use to generate alpha.- Parameters:
b- 64 bytes little endian of random- Returns:
- 32 bytes little endian mod l