This implementation is heavily based on the reference implementation in SUPERCOP, the main difference being the digests used for message hashing and tree construction are now configurable (within limits...) and that the implementation produces detached signatures.
The SPHINCS reference implementation is public domain, as per the statement in the second last paragraph of section 1 in https://eprint.iacr.org/2014/795.pdf
| Modifier and Type | Field and Description |
|---|---|
| private final HashFunctions | |
| private byte[] |
| Access | Constructor and Description |
|---|---|
| public | SPHINCS256Signer(Digest
the "n-digest" must produce 32 bytes of output - used for tree construction. nDigest, Digest the "2n-digest" must produce 64 bytes of output - used for initial message/key/seed hashing. twoNDigest)Base constructor. |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv static void | compute_authpath_wots(HashFunctions hs, byte[] root, byte[] authpath, int authOff, Tree.
|
| pack-priv byte[] | |
| public byte[] | generateSignature(byte[]
the message to be signed. message)Implements org. |
| public void | init(boolean
true if we are generating a signature, false
otherwise. forSigning, CipherParameters key parameters for signature generation. param)Implements org. |
| pack-priv static void | validate_authpath(HashFunctions hs, byte[] root, byte[] leaf, int leafidx, byte[] authpath, int auOff, byte[] masks, int height)
|
| pack-priv boolean | |
| public boolean | verifySignature(byte[]
the message that was supposed to have been signed. message, byte[] the signature of the message signature)Implements org. |
| private void |
| hashFunctions | back to summary |
|---|---|
| private final HashFunctions hashFunctions | |
| keyData | back to summary |
|---|---|
| private byte[] keyData | |
| SPHINCS256Signer | back to summary |
|---|---|
| public SPHINCS256Signer(Digest nDigest, Digest twoNDigest) Base constructor. | |
| compute_authpath_wots | back to summary |
|---|---|
| pack-priv static void compute_authpath_wots(HashFunctions hs, byte[] root, byte[] authpath, int authOff, Tree. | |
| crypto_sign | back to summary |
|---|---|
| pack-priv byte[] crypto_sign(HashFunctions hs, byte[] m, byte[] sk) | |
| generateSignature | back to summary |
|---|---|
| public byte[] generateSignature(byte[] message) Implements org. Doc from org. sign the passed in message (usually the output of a hash function).
| |
| init | back to summary |
|---|---|
| public void init(boolean forSigning, CipherParameters param) Implements org. Doc from org. initialise the signer for signature generation or signature verification.
| |
| validate_authpath | back to summary |
|---|---|
| pack-priv static void validate_authpath(HashFunctions hs, byte[] root, byte[] leaf, int leafidx, byte[] authpath, int auOff, byte[] masks, int height) | |
| verify | back to summary |
|---|---|
| pack-priv boolean verify(HashFunctions hs, byte[] m, byte[] sm, byte[] pk) | |
| verifySignature | back to summary |
|---|---|
| public boolean verifySignature(byte[] message, byte[] signature) Implements org. Doc from org. verify the message message against the signature value.
| |
| zerobytes | back to summary |
|---|---|
| private void zerobytes(byte[] tsk, int off, int cryptoSecretkeybytes) | |