Class AgreedKeyWithMacKey

java.lang.Object
org.bouncycastle.jcajce.AgreedKeyWithMacKey
All Implemented Interfaces:
Serializable, Key, SecretKey, Destroyable

public final class AgreedKeyWithMacKey extends Object implements SecretKey
Carrier class for an agreement secret key, as well as details about the MAC key if confirmation is provided.
See Also:
  • Constructor Details

    • AgreedKeyWithMacKey

      public AgreedKeyWithMacKey(SecretKey secretKey)
      Basic constructor, no MAC.
      Parameters:
      secretKey - the secret key that was arrived at.
    • AgreedKeyWithMacKey

      public AgreedKeyWithMacKey(SecretKey secretKey, String macAlgorithm, byte[] macKey)
      Constructor containing MAC details
      Parameters:
      secretKey - the secret key that was arrived at.
      macAlgorithm - the MAC algorithm to use.
      macKey - the bytes representing the agreed MAC key.
  • Method Details

    • getAlgorithm

      public String getAlgorithm()
      Return the algorithm for the agreed secret key.
      Specified by:
      getAlgorithm in interface Key
      Returns:
      the secret key value.
    • getFormat

      public String getFormat()
      Return the format for the agreed secret key.
      Specified by:
      getFormat in interface Key
      Returns:
      the secret key format.
    • getEncoded

      public byte[] getEncoded()
      Return the encoding of the agreed secret key.
      Specified by:
      getEncoded in interface Key
      Returns:
      the secret key encoding.
    • destroy

      public void destroy()
      Specified by:
      destroy in interface Destroyable
    • isDestroyed

      public boolean isDestroyed()
      Specified by:
      isDestroyed in interface Destroyable
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getMacKey

      public ZeroizableSecretKey getMacKey()
      Return a key for the MAC associated with the KTS process (if available).
      Returns:
      the MAC secret key (null otherwise).