org.keyczar.enums
Enum KeyType

java.lang.Object
  extended by java.lang.Enum<KeyType>
      extended by org.keyczar.enums.KeyType
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<KeyType>

public enum KeyType
extends java.lang.Enum<KeyType>

Encodes different types of keys each with (default size, output size). Some have multiple acceptable sizes given in a list with the first as default.

JSON Representation currently supports these strings:

Author:
steveweis@gmail.com (Steve Weis), arkajit.dey@gmail.com (Arkajit Dey)

Enum Constant Summary
AES
           
DSA_PRIV
           
DSA_PUB
           
HMAC_SHA1
           
RSA_PRIV
           
RSA_PUB
           
TEST
           
 
Method Summary
 int defaultSize()
          Returns the default (recommended) key size.
 java.util.List<java.lang.Integer> getAcceptableSizes()
           
 int getOutputSize()
           
 boolean isAcceptableSize(int size)
          Checks whether a given key size is acceptable.
 java.lang.String toString()
           
static KeyType valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static KeyType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

AES

public static final KeyType AES

HMAC_SHA1

public static final KeyType HMAC_SHA1

DSA_PRIV

public static final KeyType DSA_PRIV

DSA_PUB

public static final KeyType DSA_PUB

RSA_PRIV

public static final KeyType RSA_PRIV

RSA_PUB

public static final KeyType RSA_PUB

TEST

public static final KeyType TEST
Method Detail

values

public static KeyType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (KeyType c : KeyType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static KeyType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

defaultSize

public int defaultSize()
Returns the default (recommended) key size.

Returns:
default key size in bits

getOutputSize

public int getOutputSize()

isAcceptableSize

public boolean isAcceptableSize(int size)
Checks whether a given key size is acceptable.

Parameters:
size - integer key size
Returns:
True if size is acceptable, False otherwise.

getAcceptableSizes

public java.util.List<java.lang.Integer> getAcceptableSizes()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Enum<KeyType>