Class XMSSMTSignatureSpi
- All Implemented Interfaces:
StateAwareSignature
- Direct Known Subclasses:
XMSSMTSignatureSpi.generic, XMSSMTSignatureSpi.withSha256, XMSSMTSignatureSpi.withSha256andPrehash, XMSSMTSignatureSpi.withSha512, XMSSMTSignatureSpi.withSha512andPrehash, XMSSMTSignatureSpi.withShake128, XMSSMTSignatureSpi.withShake128_512andPrehash, XMSSMTSignatureSpi.withShake128andPrehash, XMSSMTSignatureSpi.withShake256, XMSSMTSignatureSpi.withShake256_1024andPrehash, XMSSMTSignatureSpi.withShake256andPrehash
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic classstatic class -
Field Summary
Fields inherited from class Signature
SIGN, state, UNINITIALIZED, VERIFYFields inherited from class SignatureSpi
appRandom -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedXMSSMTSignatureSpi(String algorithm) protectedXMSSMTSignatureSpi(String sigName, Digest digest, XMSSMTSigner signer) protectedXMSSMTSignatureSpi(String sigName, Digest digest, XMSSMTSigner signer, ASN1ObjectIdentifier[] treeDigests) -
Method Summary
Modifier and TypeMethodDescriptionprotected ObjectengineGetParameter(String param) Deprecated.protected voidengineInitSign(PrivateKey privateKey) protected voidengineInitSign(PrivateKey privateKey, SecureRandom random) protected voidengineInitVerify(PublicKey publicKey) protected voidengineSetParameter(String param, Object value) Deprecated.replaced with #engineSetParameter(java.security.spec.AlgorithmParameterSpec)protected voidprotected byte[]protected voidengineUpdate(byte b) protected voidengineUpdate(byte[] b, int off, int len) protected booleanengineVerify(byte[] sigBytes) Return the current version of the private key with the updated state.booleanReturn true if this Signature object can be used for signing.Methods inherited from class Signature
clone, getAlgorithm, getInstance, getInstance, getInstance, getParameter, getParameters, getProvider, initSign, initSign, initVerify, initVerify, setParameter, setParameter, sign, sign, toString, update, update, update, update, verify, verifyMethods inherited from class SignatureSpi
engineGetParameters, engineSign, engineUpdate, engineVerifyMethods inherited from class Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface StateAwareSignature
getAlgorithm, initSign, initSign, initVerify, initVerify, sign, sign, update, update, update, update, verify, verify
-
Constructor Details
-
XMSSMTSignatureSpi
-
XMSSMTSignatureSpi
-
XMSSMTSignatureSpi
protected XMSSMTSignatureSpi(String sigName, Digest digest, XMSSMTSigner signer, ASN1ObjectIdentifier[] treeDigests)
-
-
Method Details
-
engineInitVerify
- Specified by:
engineInitVerifyin classSignatureSpi- Throws:
InvalidKeyException
-
engineInitSign
protected void engineInitSign(PrivateKey privateKey, SecureRandom random) throws InvalidKeyException - Overrides:
engineInitSignin classSignatureSpi- Throws:
InvalidKeyException
-
engineInitSign
- Specified by:
engineInitSignin classSignatureSpi- Throws:
InvalidKeyException
-
engineUpdate
- Specified by:
engineUpdatein classSignatureSpi- Throws:
SignatureException
-
engineUpdate
- Specified by:
engineUpdatein classSignatureSpi- Throws:
SignatureException
-
engineSign
- Specified by:
engineSignin classSignatureSpi- Throws:
SignatureException
-
engineVerify
- Specified by:
engineVerifyin classSignatureSpi- Throws:
SignatureException
-
engineSetParameter
- Overrides:
engineSetParameterin classSignatureSpi
-
engineSetParameter
Deprecated.replaced with #engineSetParameter(java.security.spec.AlgorithmParameterSpec)- Specified by:
engineSetParameterin classSignatureSpi
-
engineGetParameter
Deprecated.- Specified by:
engineGetParameterin classSignatureSpi
-
isSigningCapable
public boolean isSigningCapable()Description copied from interface:StateAwareSignatureReturn true if this Signature object can be used for signing. False otherwise.- Specified by:
isSigningCapablein interfaceStateAwareSignature- Returns:
- true if we are capable of making signatures.
-
getUpdatedPrivateKey
Description copied from interface:StateAwareSignatureReturn the current version of the private key with the updated state.Note: what this leaves behind depends on whether a signature has been generated since initSign(). After one, the key handed back is the key that signature spent and the Signature object keeps nothing: it cannot generate another signature without a further call to initSign(), and a second call to this method throws. Before one, the object keeps a single usage to sign with and hands back the rest, so it remains capable of exactly one signature - that is the whole point of collecting first, since the state a caller is obliged to persist is then durable before the one-time key covering it is spent. A second call in that state hands back the same key again rather than a further shard.
Collecting first and then signing joins the two: the signature spends the one usage the object kept, and a collection after it throws rather than handing that spent shard over. Everything the caller has to store it was given by the first collection, and the shard adds nothing to it - so a caller that collects in a finally beside an explicit collection is refused instead of overwriting the remainder with a key reporting nothing remaining.
The key that comes back may report no usages remaining - a Signature object initialised on a spent key still has state its caller has to store - so a non-null return is not on its own a statement that anything is left to sign with.
StateAwareSignature.isSigningCapable()is what answers that, and the two do differ in that case.- Specified by:
getUpdatedPrivateKeyin interfaceStateAwareSignature- Returns:
- an updated private key object, which can be used for later signature generation.
-