ptolemy.actor.lib.security
Class KeyToken

java.lang.Object
  extended by ptolemy.data.Token
      extended by ptolemy.actor.lib.security.KeyToken
All Implemented Interfaces:
java.io.Serializable

public class KeyToken
extends Token

Tokens that contain java.security.Keys.

Since:
Ptolemy II 4.0
Version:
$Id: KeyToken.java 57040 2010-01-27 20:52:32Z cxh $
Author:
Christopher Hylands Brooks, Based on TestToken by Steve Neuendorffer
See Also:
Serialized Form
Accepted Rating:
Yellow (cxh)
Proposed Rating:
Yellow (cxh)

Nested Class Summary
static class KeyToken.KeyType
          The cryptographic key type.
 
Field Summary
private  java.security.Key _value
          The java.security.Key
static Type KEY
          The Key type: the least upper bound of all the cryptographic key types.
 
Fields inherited from class ptolemy.data.Token
NIL
 
Constructor Summary
KeyToken(java.security.Key value)
          Construct a token with a specified java.security.Key.
 
Method Summary
 Type getType()
          Return the type of this token.
 java.security.Key getValue()
          Return the java.security.Key.
 BooleanToken isEqualTo(Token rightArgument)
          Test for equality of the values of this Token and the argument Token.
 java.lang.String toString()
          Return a String representation of the KeyToken.
 
Methods inherited from class ptolemy.data.Token
add, addReverse, divide, divideReverse, isCloseTo, isCloseTo, isNil, modulo, moduloReverse, multiply, multiplyReverse, notSupportedConversionMessage, notSupportedIncomparableConversionMessage, notSupportedIncomparableMessage, notSupportedMessage, notSupportedNullNilStringMessage, one, pow, subtract, subtractReverse, zero, zeroReturnType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

KEY

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


_value

private java.security.Key _value
The java.security.Key

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.