org.jpos.security
Class SecureDESKey

java.lang.Object
  extended by org.jpos.security.SecureKey
      extended by org.jpos.security.SecureDESKey
All Implemented Interfaces:
Serializable, Loggeable

public class SecureDESKey
extends SecureKey

The SecureDESKey class represents:
Single, double or triple length DES keys that are secured by a security module. This is typically the DES key encrypted under one of the Local Master Keys of the security module.

SecureDESKey has an extra property "Key Check Value". It allows assuring that two SecureDESKeys owned by two different parties map to the same clear key. This can be a useful manual check for successful key exchange.

NOTE: The security of SecureDESKey is totally dependent on the security of the used security module.

Version:
$Revision$ $Date$
Author:
Hani S. Kirollos
See Also:
SMAdapter, Serialized Form

Field Summary
protected  byte[] keyCheckValue
          The keyCheckValue allows identifying which clear key does this secure key represent.
protected  KeyScheme scheme
           
protected  Byte variant
           
 
Fields inherited from class org.jpos.security.SecureKey
keyBytes, keyLength, keyName, keyType
 
Constructor Summary
SecureDESKey()
           
SecureDESKey(short keyLength, String keyType, byte[] keyBytes, byte[] keyCheckValue)
          Constructs an SecureDESKey
SecureDESKey(short keyLength, String keyType, byte variant, KeyScheme scheme, byte[] keyBytes, byte[] keyCheckValue)
          Constructs an SecureDESKey
SecureDESKey(short keyLength, String keyType, byte variant, KeyScheme scheme, String keyHexString, String keyCheckValueHexString)
          Constructs an SecureDESKey
SecureDESKey(short keyLength, String keyType, String keyHexString, String keyCheckValueHexString)
          Constructs an SecureDESKey
 
Method Summary
 void dump(PrintStream p, String indent)
          dumps SecureDESKey basic information
 byte[] getKeyCheckValue()
          The Key Check Value is typically a 24-bits (3 bytes) formed by encrypting a block of zeros under the secure key when the secure key is clear (not in this class, but inside the security module).
 KeyScheme getScheme()
           
 byte getVariant()
           
 void setKeyCheckValue(byte[] keyCheckValue)
          The Key Check Value is typically a 24-bits (3 bytes) formed by encrypting a block of zeros under the secure key when the secure key is clear (not in this class, but inside the security module).
 void setScheme(KeyScheme scheme)
          Key Type Scheme is useful for stating whitch scheme variant of key type should be used.
 void setVariant(byte variant)
          Key Type Variant is useful for stating whitch variant of key type should be used.
 
Methods inherited from class org.jpos.security.SecureKey
getKeyBytes, getKeyLength, getKeyName, getKeyType, setKeyBytes, setKeyLength, setKeyName, setKeyType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyCheckValue

protected byte[] keyCheckValue
The keyCheckValue allows identifying which clear key does this secure key represent.


variant

protected Byte variant

scheme

protected KeyScheme scheme
Constructor Detail

SecureDESKey

public SecureDESKey()

SecureDESKey

public SecureDESKey(short keyLength,
                    String keyType,
                    byte variant,
                    KeyScheme scheme,
                    byte[] keyBytes,
                    byte[] keyCheckValue)
Constructs an SecureDESKey

Parameters:
keyLength - e.g. LENGTH_DES, LENGTH_DES3_2KEY, LENGTH_DES3_3KEY
keyType -
variant -
scheme -
keyBytes - DES Key in the secure proprietary format of your security module
keyCheckValue -
See Also:
SMAdapter

SecureDESKey

public SecureDESKey(short keyLength,
                    String keyType,
                    byte[] keyBytes,
                    byte[] keyCheckValue)
Constructs an SecureDESKey

Parameters:
keyLength - e.g. LENGTH_DES, LENGTH_DES3_2KEY, LENGTH_DES3_3KEY
keyType -
keyBytes - DES Key in the secure proprietary format of your security module
keyCheckValue -
See Also:
SMAdapter

SecureDESKey

public SecureDESKey(short keyLength,
                    String keyType,
                    String keyHexString,
                    String keyCheckValueHexString)
Constructs an SecureDESKey

Parameters:
keyLength -
keyType -
keyHexString - secure key represented as HexString instead of byte[]
keyCheckValueHexString - key check value represented as HexString instead of byte[]

SecureDESKey

public SecureDESKey(short keyLength,
                    String keyType,
                    byte variant,
                    KeyScheme scheme,
                    String keyHexString,
                    String keyCheckValueHexString)
Constructs an SecureDESKey

Parameters:
keyLength -
keyType -
keyHexString - secure key represented as HexString instead of byte[]
keyCheckValueHexString - key check value represented as HexString instead of byte[]
Method Detail

setKeyCheckValue

public void setKeyCheckValue(byte[] keyCheckValue)
The Key Check Value is typically a 24-bits (3 bytes) formed by encrypting a block of zeros under the secure key when the secure key is clear (not in this class, but inside the security module). This check value allows identifying if two secure keys map to the same clear key.

Parameters:
keyCheckValue -

getKeyCheckValue

public byte[] getKeyCheckValue()
The Key Check Value is typically a 24-bits (3 bytes) formed by encrypting a block of zeros under the secure key when the secure key is clear (not in this class, but inside the security module).

Returns:
the keyCheckValue that was set before by setKeyCheckValue()

setVariant

public void setVariant(byte variant)
Key Type Variant is useful for stating whitch variant of key type should be used. ... TO COMPLITE ...

Parameters:
variant -

getVariant

public byte getVariant()

setScheme

public void setScheme(KeyScheme scheme)
Key Type Scheme is useful for stating whitch scheme variant of key type should be used. ... TO COMPLITE ...

Parameters:
variant -

getScheme

public KeyScheme getScheme()

dump

public void dump(PrintStream p,
                 String indent)
dumps SecureDESKey basic information

Parameters:
p - a PrintStream usually supplied by Logger
indent - indention string, usually suppiled by Logger
See Also:
Loggeable


Copyright © 1998-2012 jPOS.org. All Rights Reserved.