Package org.bouncycastle.jcajce.util

## Class AnnotatedPrivateKey

- java.lang.Object
- - org.bouncycastle.jcajce.util.AnnotatedPrivateKey

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

      public class AnnotatedPrivateKey
      extends java.lang.Object
      implements java.security.PrivateKey

  Wrapper for a private key that carries annotations that can be used for tracking or debugging.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static java.lang.String` | `LABEL` |

    - ### Fields inherited from interface java.security.PrivateKey

      `serialVersionUID`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `AnnotatedPrivateKey` | `addAnnotation​(java.lang.String name, java.lang.Object annotation)` | Return a new annotated key with an additional annotation added to it.
    `boolean` | `equals​(java.lang.Object o)` |
    `java.lang.String` | `getAlgorithm()` |
    `java.lang.Object` | `getAnnotation​(java.lang.String key)` |
    `java.util.Map<java.lang.String,​java.lang.Object>` | `getAnnotations()` |
    `byte[]` | `getEncoded()` |
    `java.lang.String` | `getFormat()` |
    `java.security.PrivateKey` | `getKey()` |
    `int` | `hashCode()` |
    `AnnotatedPrivateKey` | `removeAnnotation​(java.lang.String name)` | Return a new annotated key with the named annotation removed.
    `java.lang.String` | `toString()` |

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

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

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

      `destroy, isDestroyed`

- - ### Field Detail

    - #### LABEL

          public static final java.lang.String LABEL

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### getKey

          public java.security.PrivateKey getKey()

    - #### getAnnotations

          public java.util.Map<java.lang.String,​java.lang.Object> getAnnotations()

    - #### getAlgorithm

          public java.lang.String getAlgorithm()

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

    - #### getAnnotation

          public java.lang.Object getAnnotation​(java.lang.String key)

    - #### addAnnotation

          public AnnotatedPrivateKey addAnnotation​(java.lang.String name,
                                                   java.lang.Object annotation)

      Return a new annotated key with an additional annotation added to it.
      Parameters:
        `name` - the name of the annotation to add.
        `annotation` - the object providing the annotation details.
      Returns:
        a new annotated key with the extra annotation.

    - #### removeAnnotation

          public AnnotatedPrivateKey removeAnnotation​(java.lang.String name)

      Return a new annotated key with the named annotation removed.
      Parameters:
        `name` - the name of the annotation to remove.
      Returns:
        a new annotated key with the named annotation removed.

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

    - #### hashCode

          public int hashCode()

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

    - #### equals

          public boolean equals​(java.lang.Object o)

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

    - #### toString

          public java.lang.String toString()

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