org.bouncycastle.asn1.x9

## Class KeySpecificInfo

- java.lang.Object
- - org.bouncycastle.asn1.ASN1Object
  - - org.bouncycastle.asn1.x9.KeySpecificInfo

- All Implemented Interfaces:
    ASN1Encodable, Encodable

      public class KeySpecificInfo
      extends ASN1Object

  ASN.1 def for Diffie-Hellman key exchange KeySpecificInfo structure. See RFC 2631, or X9.42, for further details.

        KeySpecificInfo ::= SEQUENCE {
            algorithm OBJECT IDENTIFIER,
            counter OCTET STRING SIZE (4..4)
        }

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `KeySpecificInfo(ASN1ObjectIdentifier algorithm, ASN1OctetString counter)` Base constructor.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ASN1ObjectIdentifier` | `getAlgorithm()` The object identifier for the CEK wrapping algorithm.
    `ASN1OctetString` | `getCounter()` The initial counter value for key derivation.
    `static KeySpecificInfo` | `getInstance(ASN1TaggedObject taggedObject, boolean declaredExplicit)`
    `static KeySpecificInfo` | `getInstance(java.lang.Object obj)` Return a KeySpecificInfo object from the passed in object.
    `static KeySpecificInfo` | `getTagged(ASN1TaggedObject taggedObject, boolean declaredExplicit)`
    `ASN1Primitive` | `toASN1Primitive()` Return an ASN.1 primitive representation of this object.

    - ### Methods inherited from class org.bouncycastle.asn1.ASN1Object

      `encodeTo, encodeTo, equals, getEncoded, getEncoded, hasEncodedTagValue, hashCode`

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

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

- - ### Constructor Detail

    - #### KeySpecificInfo

          public KeySpecificInfo(ASN1ObjectIdentifier algorithm,
                                 ASN1OctetString counter)

      Base constructor.
      Parameters:
        `algorithm` - algorithm identifier for the CEK.
        `counter` - initial counter value for key derivation.

  - ### Method Detail

    - #### getInstance

          public static KeySpecificInfo getInstance(java.lang.Object obj)

      Return a KeySpecificInfo object from the passed in object.
      Parameters:
        `obj` - an object for conversion or a byte[].
      Returns:
        a KeySpecificInfo

    - #### getInstance

          public static KeySpecificInfo getInstance(ASN1TaggedObject taggedObject,
                                                    boolean declaredExplicit)

    - #### getTagged

          public static KeySpecificInfo getTagged(ASN1TaggedObject taggedObject,
                                                  boolean declaredExplicit)

    - #### getAlgorithm

          public ASN1ObjectIdentifier getAlgorithm()

      The object identifier for the CEK wrapping algorithm.
      Returns:
        CEK wrapping algorithm OID.

    - #### getCounter

          public ASN1OctetString getCounter()

      The initial counter value for key derivation.
      Returns:
        initial counter value as a 4 byte octet string (big endian).

    - #### toASN1Primitive

          public ASN1Primitive toASN1Primitive()

      Return an ASN.1 primitive representation of this object.
      Specified by:
        `toASN1Primitive` in interface `ASN1Encodable`
      Specified by:
        `toASN1Primitive` in class `ASN1Object`
      Returns:
        a DERSequence containing the KeySpecificInfo values.