Package net.i2p.crypto.eddsa
Class RedDSAEngine
java.lang.Object
java.security.SignatureSpi
java.security.Signature
net.i2p.crypto.eddsa.EdDSAEngine
net.i2p.crypto.eddsa.RedDSAEngine
public final class RedDSAEngine extends EdDSAEngine
Signing and verification for REdDSA using SHA-512 and the Ed25519 curve.
Ref: Zcash Protocol Specification, Version 2018.0-beta-33 [Overwinter+Sapling]
Sections 4.1.6.1, 4.1.6.2, 5.4.6
The EdDSA sign and verify algorithms do not interact well with the Java Signature API, as one or more update() methods must be called before sign() or verify(). Using the standard API, this implementation must copy and buffer all data passed in via update().
This implementation offers two ways to avoid this copying, but only if all data to be signed or verified is available in a single byte array.
Option 1:
- Call initSign() or initVerify() as usual.
- Call setParameter(ONE_SHOT_MODE)
- Call update(byte[]) or update(byte[], int, int) exactly once
- Call sign() or verify() as usual.
- If doing additional one-shot signs or verifies with this object, you must call setParameter(ONE_SHOT_MODE) each time
Option 2:
- Call initSign() or initVerify() as usual.
- Call one of the signOneShot() or verifyOneShot() methods.
- If doing additional one-shot signs or verifies with this object, just call signOneShot() or verifyOneShot() again.
- Since:
- 0.9.39
-
Field Summary
Fields inherited from class net.i2p.crypto.eddsa.EdDSAEngine
digest, ONE_SHOT_MODE, SIGNATURE_ALGORITHM
-
Constructor Summary
Constructors Constructor Description RedDSAEngine()
No specific EdDSA-internal hash requested, allows any EdDSA key.RedDSAEngine(MessageDigest digest)
Specific EdDSA-internal hash requested, only matching keys will be allowed. -
Method Summary
Modifier and Type Method Description protected void
digestInitSign(EdDSAPrivateKey privKey)
Methods inherited from class net.i2p.crypto.eddsa.EdDSAEngine
engineGetParameter, engineInitSign, engineInitVerify, engineSetParameter, engineSetParameter, engineSign, engineUpdate, engineUpdate, engineVerify, signOneShot, signOneShot, verifyOneShot, verifyOneShot, verifyOneShot, verifyOneShot
Methods inherited from class java.security.Signature
clone, getAlgorithm, getInstance, getInstance, getInstance, getParameter, getParameters, getProvider, initSign, initSign, initVerify, initVerify, setParameter, setParameter, sign, sign, toString, update, update, update, update, verify, verify
Methods inherited from class java.security.SignatureSpi
engineGetParameters, engineInitSign, engineSign, engineUpdate, engineVerify
-
Constructor Details
-
RedDSAEngine
public RedDSAEngine()No specific EdDSA-internal hash requested, allows any EdDSA key. -
RedDSAEngine
Specific EdDSA-internal hash requested, only matching keys will be allowed.- Parameters:
digest
- the hash algorithm that keys must have to sign or verify.
-
-
Method Details
-
digestInitSign
- Overrides:
digestInitSign
in classEdDSAEngine
-