Class KeyToken


  • public class KeyToken
    extends Token
    Tokens that contain java.security.Keys.
    Since:
    Ptolemy II 4.0
    Version:
    $Id$
    Author:
    Christopher Hylands Brooks, Based on TestToken by Steve Neuendorffer
    Pt.AcceptedRating:
    Yellow (cxh)
    Pt.ProposedRating:
    Yellow (cxh)
    • Field Detail

      • KEY

        public static final Type KEY
        The Key type: the least upper bound of all the cryptographic key types.
    • Constructor Detail

      • KeyToken

        public KeyToken​(java.security.Key value)
        Construct a token with a specified java.security.Key.
        Parameters:
        value - The specified java.security.Key type to construct the token with.
    • Method Detail

      • getType

        public Type getType()
        Return the type of this token.
        Overrides:
        getType in class Token
        Returns:
        KEY, the least upper bound of all the cryptographic key types.
      • getValue

        public java.security.Key getValue()
        Return the java.security.Key.
        Returns:
        The java.security.Key that this Token was created with.
      • isEqualTo

        public final BooleanToken isEqualTo​(Token rightArgument)
                                     throws IllegalActionException
        Test for equality of the values of this Token and the argument Token. Two KeyTokens are considered equals if the strings that name their corresponding algorithms and formats are the same and the byte arrays that contain the encoding have the same contents. Consult the java.security.Key documentation for the meaning of these terms. If the value of this token or the value of the rightArgument token is null, then we return False.
        Overrides:
        isEqualTo in class Token
        Parameters:
        rightArgument - The Token to test against.
        Returns:
        A boolean token that contains the value true if the algorithms, formats and encodings are the same.
        Throws:
        IllegalActionException - Not thrown in this base class.
      • toString

        public java.lang.String toString()
        Return a String representation of the KeyToken.
        Overrides:
        toString in class Token
        Returns:
        A String representation of the KeyToken that includes the value of the algorithm, format and encoding.