Class AgreedKeyWithMacKey

  • All Implemented Interfaces:
    java.io.Serializable, java.security.Key, javax.crypto.SecretKey, javax.security.auth.Destroyable

    public final class AgreedKeyWithMacKey
    extends java.lang.Object
    implements javax.crypto.SecretKey
    Carrier class for an agreement secret key, as well as details about the MAC key if confirmation is provided.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from interface javax.crypto.SecretKey

        serialVersionUID
    • Constructor Summary

      Constructors 
      Constructor Description
      AgreedKeyWithMacKey​(javax.crypto.SecretKey secretKey)
      Basic constructor, no MAC.
      AgreedKeyWithMacKey​(javax.crypto.SecretKey secretKey, java.lang.String macAlgorithm, byte[] macKey)
      Constructor containing MAC details
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void destroy()  
      boolean equals​(java.lang.Object o)  
      java.lang.String getAlgorithm()
      Return the algorithm for the agreed secret key.
      byte[] getEncoded()
      Return the encoding of the agreed secret key.
      java.lang.String getFormat()
      Return the format for the agreed secret key.
      ZeroizableSecretKey getMacKey()
      Return a key for the MAC associated with the KTS process (if available).
      int hashCode()  
      boolean isDestroyed()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AgreedKeyWithMacKey

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

        public AgreedKeyWithMacKey​(javax.crypto.SecretKey secretKey,
                                   java.lang.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 Detail

      • getAlgorithm

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

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

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

        public void destroy()
        Specified by:
        destroy in interface javax.security.auth.Destroyable
      • isDestroyed

        public boolean isDestroyed()
        Specified by:
        isDestroyed in interface javax.security.auth.Destroyable
      • 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
      • getMacKey

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