Class XMSSSignatureSpi
- java.lang.Object
-
- java.security.SignatureSpi
-
- java.security.Signature
-
- org.bouncycastle.pqc.jcajce.provider.xmss.XMSSSignatureSpi
-
- All Implemented Interfaces:
StateAwareSignature
- Direct Known Subclasses:
XMSSSignatureSpi.generic,XMSSSignatureSpi.withSha256,XMSSSignatureSpi.withSha256andPrehash,XMSSSignatureSpi.withSha512,XMSSSignatureSpi.withSha512andPrehash,XMSSSignatureSpi.withShake128,XMSSSignatureSpi.withShake128_512andPrehash,XMSSSignatureSpi.withShake128andPrehash,XMSSSignatureSpi.withShake256,XMSSSignatureSpi.withShake256_1024andPrehash,XMSSSignatureSpi.withShake256andPrehash
public class XMSSSignatureSpi extends java.security.Signature implements StateAwareSignature
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXMSSSignatureSpi.genericstatic classXMSSSignatureSpi.withSha256static classXMSSSignatureSpi.withSha256andPrehashstatic classXMSSSignatureSpi.withSha512static classXMSSSignatureSpi.withSha512andPrehashstatic classXMSSSignatureSpi.withShake128static classXMSSSignatureSpi.withShake128_512andPrehashstatic classXMSSSignatureSpi.withShake128andPrehashstatic classXMSSSignatureSpi.withShake256static classXMSSSignatureSpi.withShake256_1024andPrehashstatic classXMSSSignatureSpi.withShake256andPrehash
-
Constructor Summary
Constructors Modifier Constructor Description protectedXMSSSignatureSpi(java.lang.String algorithm)protectedXMSSSignatureSpi(java.lang.String sigName, Digest digest, XMSSSigner signer)protectedXMSSSignatureSpi(java.lang.String sigName, Digest digest, XMSSSigner signer, ASN1ObjectIdentifier[] treeDigests)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected java.lang.ObjectengineGetParameter(java.lang.String param)Deprecated.protected voidengineInitSign(java.security.PrivateKey privateKey)protected voidengineInitSign(java.security.PrivateKey privateKey, java.security.SecureRandom random)protected voidengineInitVerify(java.security.PublicKey publicKey)protected voidengineSetParameter(java.lang.String param, java.lang.Object value)Deprecated.replaced with #engineSetParameter(java.security.spec.AlgorithmParameterSpec)protected voidengineSetParameter(java.security.spec.AlgorithmParameterSpec params)protected byte[]engineSign()protected voidengineUpdate(byte b)protected voidengineUpdate(byte[] b, int off, int len)protected booleanengineVerify(byte[] sigBytes)java.security.PrivateKeygetUpdatedPrivateKey()Return the current version of the private key with the updated state.booleanisSigningCapable()Return true if this Signature object can be used for signing.-
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, engineSign, engineUpdate, engineVerify
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.bouncycastle.pqc.jcajce.interfaces.StateAwareSignature
getAlgorithm, initSign, initSign, initVerify, initVerify, sign, sign, update, update, update, update, verify, verify
-
-
-
-
Constructor Detail
-
XMSSSignatureSpi
protected XMSSSignatureSpi(java.lang.String algorithm)
-
XMSSSignatureSpi
protected XMSSSignatureSpi(java.lang.String sigName, Digest digest, XMSSSigner signer)
-
XMSSSignatureSpi
protected XMSSSignatureSpi(java.lang.String sigName, Digest digest, XMSSSigner signer, ASN1ObjectIdentifier[] treeDigests)
-
-
Method Detail
-
engineInitVerify
protected void engineInitVerify(java.security.PublicKey publicKey) throws java.security.InvalidKeyException- Specified by:
engineInitVerifyin classjava.security.SignatureSpi- Throws:
java.security.InvalidKeyException
-
engineInitSign
protected void engineInitSign(java.security.PrivateKey privateKey, java.security.SecureRandom random) throws java.security.InvalidKeyException- Overrides:
engineInitSignin classjava.security.SignatureSpi- Throws:
java.security.InvalidKeyException
-
engineInitSign
protected void engineInitSign(java.security.PrivateKey privateKey) throws java.security.InvalidKeyException- Specified by:
engineInitSignin classjava.security.SignatureSpi- Throws:
java.security.InvalidKeyException
-
engineUpdate
protected void engineUpdate(byte b) throws java.security.SignatureException- Specified by:
engineUpdatein classjava.security.SignatureSpi- Throws:
java.security.SignatureException
-
engineUpdate
protected void engineUpdate(byte[] b, int off, int len) throws java.security.SignatureException- Specified by:
engineUpdatein classjava.security.SignatureSpi- Throws:
java.security.SignatureException
-
engineSign
protected byte[] engineSign() throws java.security.SignatureException- Specified by:
engineSignin classjava.security.SignatureSpi- Throws:
java.security.SignatureException
-
engineVerify
protected boolean engineVerify(byte[] sigBytes) throws java.security.SignatureException- Specified by:
engineVerifyin classjava.security.SignatureSpi- Throws:
java.security.SignatureException
-
engineSetParameter
protected void engineSetParameter(java.security.spec.AlgorithmParameterSpec params)
- Overrides:
engineSetParameterin classjava.security.SignatureSpi
-
engineSetParameter
protected void engineSetParameter(java.lang.String param, java.lang.Object value)Deprecated.replaced with #engineSetParameter(java.security.spec.AlgorithmParameterSpec)- Specified by:
engineSetParameterin classjava.security.SignatureSpi
-
engineGetParameter
protected java.lang.Object engineGetParameter(java.lang.String param)
Deprecated.- Specified by:
engineGetParameterin classjava.security.SignatureSpi
-
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
public java.security.PrivateKey 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.
-
-