public class LMSPrivateKeyParameters extends LMSKeyParameters implements LMSContextBasedSigner, javax.security.auth.Destroyable
| Modifier | Constructor and Description |
|---|---|
protected |
LMSPrivateKeyParameters(LMSigParameters sigParameters,
LMOtsParameters otsParameters,
int maxQ)
Deprecated.
This class is not intended to be subclassed; the constructor will be removed.
|
|
LMSPrivateKeyParameters(LMSigParameters sigParameters,
LMOtsParameters otsParameters,
int q,
byte[] I,
int maxQ,
byte[] masterSecret)
An LMS private key positioned at one-time key q of the tree named by I (RFC 8554 sec. 5.2, Algorithm 5).
|
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy this key, zeroizing the master secret it holds.
|
boolean |
equals(java.lang.Object o) |
LMSPrivateKeyParameters |
extractKeyShard(int usageCount)
Return a key that can be used usageCount times.
|
static LMSPrivateKeyParameters |
generate(LMSParameters lmsParameters,
java.security.SecureRandom random)
A fresh LMS private key (RFC 8554 sec. 5.2, Algorithm 5): the SEED (m bytes) and then the identifier I
(16 bytes) are drawn from the random, in that order, and the key starts at q = 0 with all 2^h one-time
keys available.
|
LMSContext |
generateLMSContext() |
byte[] |
generateSignature(LMSContext context) |
byte[] |
getEncoded()
Return a byte array representing the implementing object.
|
byte[] |
getI() |
int |
getIndex()
Return the key index (the q value).
|
int |
getIndexLimit() |
static LMSPrivateKeyParameters |
getInstance(byte[] privEnc,
byte[] pubEnc) |
static LMSPrivateKeyParameters |
getInstance(java.lang.Object src) |
LMSParameters |
getLMSParameters() |
byte[] |
getMasterSecret()
Deprecated.
use
getEncoded() instead. A seed handed out alone is a second copy of the
key with no index attached - the state duplication SP 800-208 rules out - whereas the encoding
carries the index, usage limit and tree cache with it. |
LMOtsParameters |
getOtsParameters() |
LMSPublicKeyParameters |
getPublicKey()
The public key of this tree, derived on first use and kept thereafter.
|
LMSigParameters |
getSigParameters() |
long |
getUsagesRemaining() |
int |
hashCode() |
boolean |
isDestroyed() |
isPrivatepublic LMSPrivateKeyParameters(LMSigParameters sigParameters, LMOtsParameters otsParameters, int q, byte[] I, int maxQ, byte[] masterSecret)
@Deprecated protected LMSPrivateKeyParameters(LMSigParameters sigParameters, LMOtsParameters otsParameters, int maxQ)
public static LMSPrivateKeyParameters generate(LMSParameters lmsParameters, java.security.SecureRandom random)
public static LMSPrivateKeyParameters getInstance(byte[] privEnc, byte[] pubEnc) throws java.io.IOException
java.io.IOExceptionpublic static LMSPrivateKeyParameters getInstance(java.lang.Object src) throws java.io.IOException
java.io.IOExceptionpublic int getIndex()
public LMSContext generateLMSContext()
generateLMSContext in interface LMSContextBasedSignerpublic byte[] generateSignature(LMSContext context)
generateSignature in interface LMSContextBasedSignerpublic LMSPrivateKeyParameters 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 LMSParameters getLMSParameters()
public LMSigParameters getSigParameters()
public LMOtsParameters getOtsParameters()
public byte[] getI()
@Deprecated public byte[] getMasterSecret()
getEncoded() instead. A seed handed out alone is a second copy of the
key with no index attached - the state duplication SP 800-208 rules out - whereas the encoding
carries the index, usage limit and tree cache with it.public void destroy()
The key identifier I, the parameter sets, the index and the cached Merkle tree nodes are
retained - none of them is secret, and the public key stays derivable where the tree's
root is already cached. After destruction isDestroyed() returns true and
getMasterSecret(), getEncoded(), generateLMSContext() and the
derivation of child trees throw IllegalStateException; a signature attempt fails
before its one-time index is claimed. Note: keys repositioned within this tree or split
off it with extractKeyShard(int) share its master secret array, so destroying
this key invalidates them too.
destroy in interface javax.security.auth.Destroyablepublic boolean isDestroyed()
isDestroyed in interface javax.security.auth.Destroyablepublic int getIndexLimit()
public long getUsagesRemaining()
getUsagesRemaining in interface LMSContextBasedSignerpublic LMSPublicKeyParameters getPublicKey()
Deliberately not taken under the key's monitor: the root node is a function of the identifier,
the master secret and the parameter sets and not of q, so nothing the monitor guards takes part
in deriving it, and holding the monitor for a tree build (up to 2^h leaf derivations) would stall
every one-time key claim on the key for its duration. Concurrent callers race harmlessly -
findT(int) already dedupes the expensive per-node work, so a second caller finds the
tree built - and they publish equal keys.
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic byte[] getEncoded()
throws java.io.IOException
EncodablegetEncoded in interface EncodablegetEncoded in class LMSKeyParametersjava.io.IOException - if an issue arises generation the encoding.