public final class XMSSMTPrivateKeyParameters extends XMSSMTKeyParameters implements Encodable, javax.security.auth.Destroyable
| Modifier and Type | Class and Description |
|---|---|
static class |
XMSSMTPrivateKeyParameters.Builder |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy this key, zeroizing the secret key material it holds: the seed the WOTS+ secret
keys are derived from, the PRF key that randomizes message digests, and the WOTS+ secret
keys the per-layer BDS traversal states retain for the leaves they last processed.
|
boolean |
equals(java.lang.Object o)
Whether these are the same key at the same position, which for a stateful key means the same
traversal state too.
|
XMSSMTPrivateKeyParameters |
extractKeyShard(int usageCount)
Return a key that can be used usageCount times.
|
BDSStateMap |
getBDSState() |
byte[] |
getEncoded()
Return a byte array representing the implementing object.
|
long |
getIndex() |
XMSSMTPrivateKeyParameters |
getNextKey() |
XMSSMTParameters |
getParameters() |
byte[] |
getPublicSeed() |
byte[] |
getRoot() |
byte[] |
getSecretKeyPRF() |
byte[] |
getSecretKeySeed() |
long |
getUsagesRemaining() |
int |
hashCode()
The fields that do not move as this key signs, hashed as
XMSSPrivateKeyCodec.hashCode hashes them: the tree digest, the root and the public
seed. |
boolean |
isDestroyed() |
XMSSMTPrivateKeyParameters |
rollKey() |
byte[] |
toByteArray()
Deprecated.
use getEncoded() - this method will become private.
|
getTreeDigestisPrivatepublic byte[] getEncoded()
throws java.io.IOException
EncodablegetEncoded in interface Encodablejava.io.IOException - if an issue arises generation the encoding.@Deprecated public byte[] toByteArray()
public long getIndex()
public long getUsagesRemaining()
public byte[] getSecretKeySeed()
public byte[] getSecretKeyPRF()
public byte[] getPublicSeed()
public byte[] getRoot()
public BDSStateMap getBDSState()
public XMSSMTParameters getParameters()
public XMSSMTPrivateKeyParameters getNextKey()
public XMSSMTPrivateKeyParameters rollKey()
public XMSSMTPrivateKeyParameters extractKeyShard(int usageCount)
Note: this will use the range [index...index + usageCount) for the current key.
usageCount - the number of usages the key should have.public boolean equals(java.lang.Object o)
Both halves of that are XMSSPrivateKeyCodec's, beside the layout they are over:
Fields is the seven things decided ahead of the state and State is the
state, each taken from one key under that key's own monitor and never both at once, and
fieldsEqual and stateEqual compare them. XMSSPrivateKeyParameters
held a line for line copy of all of it. What is left here is a snapshot per key and the two
calls over them, joined with && because what the fields decide is whether the state
is compared at all - the codec says why the short circuit goes there and nowhere inside.
The comparison belongs on this class rather than on the provider key that wraps it because
every part of it does: the monitor a signature is taken under is this object's, the fields
are this object's, and a caller reaching in through the accessors gets a clone of each array
and no way to hold any two of them still. HSSPrivateKeyParameters does the same for
the other stateful family in this package, leaving BCLMSPrivateKey.equals() a single
delegating line, and BCXMSSMTPrivateKey is now that line as well. It carries the
tree digest a second time, as the OID it was constructed with, and no longer compares it:
that OID is params.getTreeDigestOID() at every route a key is built by - generation,
a PKCS#8 round trip, extractKeyShard, and the key a signature hands back - so the first
comparison the codec makes is the comparison it was making.
equals in class java.lang.Objectpublic int hashCode()
XMSSPrivateKeyCodec.hashCode hashes them: the tree digest, the root and the public
seed.hashCode in class java.lang.Objectpublic void destroy()
The public seed, the root, the index and the traversal states' tree nodes are retained -
none of them is secret. After destruction isDestroyed() returns true and
getSecretKeySeed(), getSecretKeyPRF(), getEncoded(),
getNextKey() and extractKeyShard(int) throw
IllegalStateException; a signature attempt fails before the index is advanced.
Keys previously split off this one hold their own copies of the seeds and are unaffected.
destroy in interface javax.security.auth.Destroyablepublic boolean isDestroyed()
isDestroyed in interface javax.security.auth.Destroyable