public final class XMSSPrivateKeyParameters extends XMSSKeyParameters implements Encodable, javax.security.auth.Destroyable
| Modifier and Type | Class and Description |
|---|---|
static class |
XMSSPrivateKeyParameters.Builder |
SHA_256, SHA_512, SHAKE128, SHAKE256, SHAKE256_LEN| 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
key its BDS traversal state retains for the leaf it 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.
|
XMSSPrivateKeyParameters |
extractKeyShard(int usageCount)
Return a key that can be used usageCount times.
|
BDS |
getBDSState() |
byte[] |
getEncoded()
Return a byte array representing the implementing object.
|
int |
getIndex() |
XMSSPrivateKeyParameters |
getNextKey() |
XMSSParameters |
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() |
XMSSPrivateKeyParameters |
rollKey() |
byte[] |
toByteArray()
Deprecated.
use getEncoded() - this method will become private.
|
getTreeDigestisPrivatepublic long getUsagesRemaining()
public byte[] getEncoded()
throws java.io.IOException
EncodablegetEncoded in interface Encodablejava.io.IOException - if an issue arises generation the encoding.public XMSSPrivateKeyParameters rollKey()
public XMSSPrivateKeyParameters getNextKey()
public XMSSPrivateKeyParameters 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.@Deprecated public byte[] toByteArray()
public int getIndex()
public byte[] getSecretKeySeed()
public byte[] getSecretKeyPRF()
public byte[] getPublicSeed()
public byte[] getRoot()
public BDS getBDSState()
public XMSSParameters getParameters()
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. XMSSMTPrivateKeyParameters
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 BCXMSSPrivateKey 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 state's 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