Package org.bouncycastle.pqc.jcajce.provider.lms

## Class BCLMSPrivateKey

- java.lang.Object
- - org.bouncycastle.pqc.jcajce.provider.lms.BCLMSPrivateKey

- All Implemented Interfaces:
    `java.io.Serializable`, `java.security.Key`, `java.security.PrivateKey`, `javax.security.auth.Destroyable`, `LMSKey`, `LMSPrivateKey`

      public class BCLMSPrivateKey
      extends java.lang.Object
      implements java.security.PrivateKey, LMSPrivateKey

  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BCLMSPrivateKey​(PrivateKeyInfo keyInfo)` |
    `BCLMSPrivateKey​(LMSKeyParameters keyParams)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(java.lang.Object o)` |
    `LMSPrivateKey` | `extractKeyShard​(int usageCount)` | Return a key representing a shard of the key space that can be used usageCount times.
    `java.lang.String` | `getAlgorithm()` |
    `byte[]` | `getEncoded()` |
    `java.lang.String` | `getFormat()` |
    `long` | `getIndex()` | Return the index of the next signature.
    `int` | `getLevels()` | Return the number of levels (L) associated with the key.
    `long` | `getUsagesRemaining()` | Return the number of usages left for the private key.
    `int` | `hashCode()` |

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

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

    - ### Methods inherited from interface javax.security.auth.Destroyable

      `destroy, isDestroyed`

- - ### Constructor Detail

    - #### BCLMSPrivateKey

          public BCLMSPrivateKey​(LMSKeyParameters keyParams)

    - #### BCLMSPrivateKey

          public BCLMSPrivateKey​(PrivateKeyInfo keyInfo)
                          throws java.io.IOException

      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### getIndex

          public long getIndex()

      Description copied from interface: `LMSPrivateKey`
      Return the index of the next signature.
      Specified by:
        `getIndex` in interface `LMSPrivateKey`
      Returns:
        the index number for the next signature.

    - #### getUsagesRemaining

          public long getUsagesRemaining()

      Description copied from interface: `LMSPrivateKey`
      Return the number of usages left for the private key.
      Specified by:
        `getUsagesRemaining` in interface `LMSPrivateKey`
      Returns:
        the number of times the key can be used before it is exhausted.

    - #### extractKeyShard

          public LMSPrivateKey extractKeyShard​(int usageCount)

      Description copied from interface: `LMSPrivateKey`
      Return a key representing a shard of the key space that can be used usageCount times.

      Note: this will use the range [index...index + usageCount) for the current key.

      Specified by:
        `extractKeyShard` in interface `LMSPrivateKey`
      Parameters:
        `usageCount` - the number of usages the key should have.
      Returns:
        a key based on the current key that can be used usageCount times.

    - #### getAlgorithm

          public java.lang.String getAlgorithm()

      Specified by:
        `getAlgorithm` in interface `java.security.Key`

    - #### getFormat

          public java.lang.String getFormat()

      Specified by:
        `getFormat` in interface `java.security.Key`

    - #### getEncoded

          public byte[] getEncoded()

      Specified by:
        `getEncoded` in interface `java.security.Key`

    - #### 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`

    - #### getLevels

          public int getLevels()

      Description copied from interface: `LMSKey`
      Return the number of levels (L) associated with the key.
      Specified by:
        `getLevels` in interface `LMSKey`
      Returns:
        L.