Class XMSSMTPrivateKeyParameters
- All Implemented Interfaces:
Destroyable, CipherParameters, Encodable
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()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.booleanWhether these are the same key at the same position, which for a stateful key means the same traversal state too.extractKeyShard(int usageCount) Return a key that can be used usageCount times.byte[]Return a byte array representing the implementing object.longgetIndex()byte[]byte[]getRoot()byte[]byte[]longinthashCode()The fields that do not move as this key signs, hashed asXMSSPrivateKeyCodec.hashCodehashes them: the tree digest, the root and the public seed.booleanrollKey()byte[]Deprecated.use getEncoded() - this method will become private.Methods inherited from class XMSSMTKeyParameters
getTreeDigestMethods inherited from class AsymmetricKeyParameter
isPrivate
-
Method Details
-
getEncoded
Description copied from interface:EncodableReturn a byte array representing the implementing object.- Specified by:
getEncodedin interfaceEncodable- Returns:
- a byte array representing the encoding.
- Throws:
IOException- if an issue arises generation the encoding.
-
toByteArray
Deprecated.use getEncoded() - this method will become private. -
getIndex
public long getIndex() -
getUsagesRemaining
public long getUsagesRemaining() -
getSecretKeySeed
public byte[] getSecretKeySeed() -
getSecretKeyPRF
public byte[] getSecretKeyPRF() -
getPublicSeed
public byte[] getPublicSeed() -
getRoot
public byte[] getRoot() -
getBDSState
-
getParameters
-
getNextKey
-
rollKey
-
extractKeyShard
Return a key that can be used usageCount times.Note: this will use the range [index...index + usageCount) for the current key.
- Parameters:
usageCount- the number of usages the key should have.- Returns:
- a key based on the current key that can be used usageCount times.
-
equals
Whether these are the same key at the same position, which for a stateful key means the same traversal state too.Both halves of that are
XMSSPrivateKeyCodec's, beside the layout they are over:Fieldsis the seven things decided ahead of the state andStateis the state, each taken from one key under that key's own monitor and never both at once, andfieldsEqualandstateEqualcompare them.XMSSPrivateKeyParametersheld 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.
HSSPrivateKeyParametersdoes the same for the other stateful family in this package, leavingBCLMSPrivateKey.equals()a single delegating line, andBCXMSSMTPrivateKeyis 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 isparams.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. -
hashCode
-
destroy
public 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.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 andgetSecretKeySeed(),getSecretKeyPRF(),getEncoded(),getNextKey()andextractKeyShard(int)throwIllegalStateException; 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.- Specified by:
destroyin interfaceDestroyable
-
isDestroyed
public boolean isDestroyed()- Specified by:
isDestroyedin interfaceDestroyable
-