Package org.bouncycastle.crypto.params
Class HSSPrivateKeyParameters
- java.lang.Object
-
- org.bouncycastle.crypto.params.AsymmetricKeyParameter
-
- org.bouncycastle.crypto.params.LMSKeyParameters
-
- org.bouncycastle.crypto.params.HSSPrivateKeyParameters
-
- All Implemented Interfaces:
javax.security.auth.Destroyable,CipherParameters,LMSContextBasedSigner,Encodable
public class HSSPrivateKeyParameters extends LMSKeyParameters implements LMSContextBasedSigner, javax.security.auth.Destroyable
-
-
Constructor Summary
Constructors Constructor Description HSSPrivateKeyParameters(int l, java.util.List<LMSPrivateKeyParameters> keys, java.util.List<LMSSignature> sig, long index, long indexLimit)HSSPrivateKeyParameters(LMSPrivateKeyParameters key, long index, long indexLimit)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Objectclone()voiddestroy()Destroy this key, zeroizing the master secret of every tree in the hierarchy.booleanequals(java.lang.Object o)HSSPrivateKeyParametersextractKeyShard(int usageCount)Return a key that can be used usageCount times.LMSContextgenerateLMSContext()byte[]generateSignature(LMSContext context)byte[]getEncoded()Return a byte array representing the implementing object.longgetIndex()longgetIndexLimit()Return the index one past the last this key may sign with.static HSSPrivateKeyParametersgetInstance(byte[] privEnc, byte[] pubEnc)static HSSPrivateKeyParametersgetInstance(java.lang.Object src)intgetL()LMSParameters[]getLMSParameters()HSSPublicKeyParametersgetPublicKey()longgetUsagesRemaining()inthashCode()booleanisDestroyed()booleanisShard()Return true if this key was split off another withextractKeyShard(int)and so covers a sub-range of that key's indexes.-
Methods inherited from class org.bouncycastle.crypto.params.AsymmetricKeyParameter
isPrivate
-
-
-
-
Constructor Detail
-
HSSPrivateKeyParameters
public HSSPrivateKeyParameters(LMSPrivateKeyParameters key, long index, long indexLimit)
-
HSSPrivateKeyParameters
public HSSPrivateKeyParameters(int l, java.util.List<LMSPrivateKeyParameters> keys, java.util.List<LMSSignature> sig, long index, long indexLimit)
-
-
Method Detail
-
getInstance
public static HSSPrivateKeyParameters getInstance(byte[] privEnc, byte[] pubEnc) throws java.io.IOException
- Throws:
java.io.IOException
-
getInstance
public static HSSPrivateKeyParameters getInstance(java.lang.Object src) throws java.io.IOException
- Throws:
java.io.IOException
-
getL
public int getL()
-
getIndex
public long getIndex()
-
getLMSParameters
public LMSParameters[] getLMSParameters()
-
isShard
public boolean isShard()
Return true if this key was split off another withextractKeyShard(int)and so covers a sub-range of that key's indexes.
-
getIndexLimit
public long getIndexLimit()
Return the index one past the last this key may sign with.
-
getUsagesRemaining
public long getUsagesRemaining()
- Specified by:
getUsagesRemainingin interfaceLMSContextBasedSigner
-
extractKeyShard
public HSSPrivateKeyParameters extractKeyShard(int usageCount)
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.
-
getPublicKey
public HSSPublicKeyParameters getPublicKey()
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
getEncoded
public byte[] getEncoded() throws java.io.IOExceptionDescription copied from interface:EncodableReturn a byte array representing the implementing object.- Specified by:
getEncodedin interfaceEncodable- Specified by:
getEncodedin classLMSKeyParameters- Returns:
- a byte array representing the encoding.
- Throws:
java.io.IOException- if an issue arises generation the encoding.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
clone
protected java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
generateLMSContext
public LMSContext generateLMSContext()
- Specified by:
generateLMSContextin interfaceLMSContextBasedSigner
-
generateSignature
public byte[] generateSignature(LMSContext context)
- Specified by:
generateSignaturein interfaceLMSContextBasedSigner
-
destroy
public void destroy()
Destroy this key, zeroizing the master secret of every tree in the hierarchy.The chaining signatures, the indexes and the component keys' identifiers and cached tree nodes are retained - none of them is secret, and the public key stays derivable where the root tree's root node is already cached. After destruction
isDestroyed()returns true andgetEncoded(),generateLMSContext()andextractKeyShard(int)throwIllegalStateException; a signature attempt fails before its index is claimed. Shards split off this key before it was destroyed are independent copies and are unaffected.- Specified by:
destroyin interfacejavax.security.auth.Destroyable
-
isDestroyed
public boolean isDestroyed()
- Specified by:
isDestroyedin interfacejavax.security.auth.Destroyable
-
-