Class KTSKeyWithEncapsulation

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

    public final class KTSKeyWithEncapsulation
    extends java.lang.Object
    implements javax.crypto.SecretKey
    Carrier class for a KTS secret key plus its encapsulation, as well as details about the MAC key if provided.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from interface javax.crypto.SecretKey

        serialVersionUID
    • Constructor Summary

      Constructors 
      Constructor Description
      KTSKeyWithEncapsulation​(javax.crypto.SecretKey secretKey, byte[] encapsulation)
      Basic constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object o)  
      java.lang.String getAlgorithm()
      Return the algorithm for the agreed secret key.
      byte[] getEncapsulation()
      Return the encapsulation that carried the key material used in creating 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 the mac key if there is one present.
      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

      • KTSKeyWithEncapsulation

        public KTSKeyWithEncapsulation​(javax.crypto.SecretKey secretKey,
                                       byte[] encapsulation)
        Basic constructor.
        Parameters:
        secretKey - the secret key that was arrived at.
        encapsulation - the encapsulation the key data was carried in.
    • 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.
      • getEncapsulation

        public byte[] getEncapsulation()
        Return the encapsulation that carried the key material used in creating the agreed secret key.
        Returns:
        the encrypted encapsulation of the agreed secret key.
      • getMacKey

        public ZeroizableSecretKey getMacKey()
        Return the mac key if there is one present.
        Returns:
        the associated MAC key for this KTS key (null if there isn't one).
      • 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