Interface StateAwareSignature
-
- All Known Implementing Classes:
XMSSMTSignatureSpi,XMSSMTSignatureSpi.generic,XMSSMTSignatureSpi.withSha256,XMSSMTSignatureSpi.withSha256andPrehash,XMSSMTSignatureSpi.withSha512,XMSSMTSignatureSpi.withSha512andPrehash,XMSSMTSignatureSpi.withShake128,XMSSMTSignatureSpi.withShake128_512andPrehash,XMSSMTSignatureSpi.withShake128andPrehash,XMSSMTSignatureSpi.withShake256,XMSSMTSignatureSpi.withShake256_1024andPrehash,XMSSMTSignatureSpi.withShake256andPrehash,XMSSSignatureSpi,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 interface StateAwareSignatureDeprecated.it's better to avoid this and use extractKeyShard methods where possible.This interface is implemented by Signature classes returned by the PQC provider where the signature algorithm is one where the private key is updated for each signature generated. Examples of these are algorithms such as GMSS, XMSS, and XMSS^MT.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description java.lang.StringgetAlgorithm()Deprecated.java.security.PrivateKeygetUpdatedPrivateKey()Deprecated.Return the current version of the private key with the updated state.voidinitSign(java.security.PrivateKey privateKey)Deprecated.voidinitSign(java.security.PrivateKey privateKey, java.security.SecureRandom random)Deprecated.voidinitVerify(java.security.cert.Certificate certificate)Deprecated.voidinitVerify(java.security.PublicKey publicKey)Deprecated.booleanisSigningCapable()Deprecated.Return true if this Signature object can be used for signing.byte[]sign()Deprecated.intsign(byte[] outbuf, int offset, int len)Deprecated.voidupdate(byte b)Deprecated.voidupdate(byte[] data)Deprecated.voidupdate(byte[] data, int off, int len)Deprecated.voidupdate(java.nio.ByteBuffer data)Deprecated.booleanverify(byte[] signature)Deprecated.booleanverify(byte[] signature, int offset, int length)Deprecated.
-
-
-
Method Detail
-
initVerify
void initVerify(java.security.PublicKey publicKey) throws java.security.InvalidKeyExceptionDeprecated.- Throws:
java.security.InvalidKeyException
-
initVerify
void initVerify(java.security.cert.Certificate certificate) throws java.security.InvalidKeyExceptionDeprecated.- Throws:
java.security.InvalidKeyException
-
initSign
void initSign(java.security.PrivateKey privateKey) throws java.security.InvalidKeyExceptionDeprecated.- Throws:
java.security.InvalidKeyException
-
initSign
void initSign(java.security.PrivateKey privateKey, java.security.SecureRandom random) throws java.security.InvalidKeyExceptionDeprecated.- Throws:
java.security.InvalidKeyException
-
sign
byte[] sign() throws java.security.SignatureExceptionDeprecated.- Throws:
java.security.SignatureException
-
sign
int sign(byte[] outbuf, int offset, int len) throws java.security.SignatureExceptionDeprecated.- Throws:
java.security.SignatureException
-
verify
boolean verify(byte[] signature) throws java.security.SignatureExceptionDeprecated.- Throws:
java.security.SignatureException
-
verify
boolean verify(byte[] signature, int offset, int length) throws java.security.SignatureExceptionDeprecated.- Throws:
java.security.SignatureException
-
update
void update(byte b) throws java.security.SignatureExceptionDeprecated.- Throws:
java.security.SignatureException
-
update
void update(byte[] data) throws java.security.SignatureExceptionDeprecated.- Throws:
java.security.SignatureException
-
update
void update(byte[] data, int off, int len) throws java.security.SignatureExceptionDeprecated.- Throws:
java.security.SignatureException
-
update
void update(java.nio.ByteBuffer data) throws java.security.SignatureExceptionDeprecated.- Throws:
java.security.SignatureException
-
getAlgorithm
java.lang.String getAlgorithm()
Deprecated.
-
isSigningCapable
boolean isSigningCapable()
Deprecated.Return true if this Signature object can be used for signing. False otherwise.- Returns:
- true if we are capable of making signatures.
-
getUpdatedPrivateKey
java.security.PrivateKey getUpdatedPrivateKey()
Deprecated.Return 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.
isSigningCapable()is what answers that, and the two do differ in that case.- Returns:
- an updated private key object, which can be used for later signature generation.
-
-