LMSPrivateKeyParameters (Bouncy Castle Library 1.85 API Specification)
Date: 2026-07-12

org.bouncycastle.pqc.crypto.lms

## Class LMSPrivateKeyParameters

- java.lang.Object
- - org.bouncycastle.crypto.params.AsymmetricKeyParameter
  - - org.bouncycastle.pqc.crypto.lms.LMSKeyParameters
    - - org.bouncycastle.pqc.crypto.lms.LMSPrivateKeyParameters

- All Implemented Interfaces:
    CipherParameters, LMSContextBasedSigner, Encodable

      public class LMSPrivateKeyParameters
      extends LMSKeyParameters
      implements LMSContextBasedSigner

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LMSPrivateKeyParameters(LMSigParameters lmsParameter, LMOtsParameters otsParameters, int q, byte[] I, int maxQ, byte[] masterSecret)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object o)`
    `LMSPrivateKeyParameters` | `extractKeyShard(int usageCount)` Return a key that can be used usageCount times.
    `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)`
    `byte[]` | `getMasterSecret()`
    `LMOtsParameters` | `getOtsParameters()`
    `LMSPublicKeyParameters` | `getPublicKey()`
    `LMSigParameters` | `getSigParameters()`
    `long` | `getUsagesRemaining()`
    `int` | `hashCode()`

    - ### Methods inherited from class org.bouncycastle.crypto.params.AsymmetricKeyParameter

      `isPrivate`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LMSPrivateKeyParameters

          public LMSPrivateKeyParameters(LMSigParameters lmsParameter,
                                         LMOtsParameters otsParameters,
                                         int q,
                                         byte[] I,
                                         int maxQ,
                                         byte[] masterSecret)

  - ### Method Detail

    - #### getInstance

          public static LMSPrivateKeyParameters getInstance(byte[] privEnc,
                                                            byte[] pubEnc)
                                                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getInstance

          public static LMSPrivateKeyParameters getInstance(java.lang.Object src)
                                                     throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### getIndex

          public int getIndex()

      Return the key index (the q value).
      Returns:
        private key index number.

    - #### generateLMSContext

          public LMSContext generateLMSContext()

      Specified by:
        `generateLMSContext` in interface `LMSContextBasedSigner`

    - #### generateSignature

          public byte[] generateSignature(LMSContext context)

      Specified by:
        `generateSignature` in interface `LMSContextBasedSigner`

    - #### extractKeyShard

          public LMSPrivateKeyParameters 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.

    - #### getSigParameters

          public LMSigParameters getSigParameters()

    - #### getOtsParameters

          public LMOtsParameters getOtsParameters()

    - #### getI

          public byte[] getI()

    - #### getMasterSecret

          public byte[] getMasterSecret()

    - #### getIndexLimit

          public int getIndexLimit()

    - #### getUsagesRemaining

          public long getUsagesRemaining()

      Specified by:
        `getUsagesRemaining` in interface `LMSContextBasedSigner`

    - #### getPublicKey

          public LMSPublicKeyParameters getPublicKey()

    - #### equals

          public boolean equals(java.lang.Object o)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### getEncoded

          public byte[] getEncoded()
                            throws java.io.IOException

      Description copied from interface: `Encodable`
      Return a byte array representing the implementing object.
      Specified by:
        `getEncoded` in interface `Encodable`
      Specified by:
        `getEncoded` in class `LMSKeyParameters`
      Returns:
        a byte array representing the encoding.
      Throws:
        `java.io.IOException` - if an issue arises generation the encoding.