jPOS 1.6.1 API Documentation

org.jpos.security
Class SecureKey

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

public abstract class SecureKey
extends java.lang.Object
implements java.io.Serializable, Loggeable

Represents a key that cannot be used except by your security module and for performing the operations allowed by the security module for this type of keys. So, a SecureKey can be safely stored in a clear file or database.

A SecureKey is typically a key encrypted under one of the secret keys that are protected by the security module itself (Local Master Keys --LMK for short).

SecureKey just holds:
1- Secure Key: a byte[] holding the key in the secure proprietary format of your security module. This is typically the clear key encrypted under LMK.
2- Key Type: identifies what this key can be used for (e.g. TYPE_ZPK (Zone PIN Key), TYPE_ZMK (Zone Master Key)...
3- Key Length (in bits): also called key size. e.g. LENGTH_DES, LENGTH_DES3_2KEY,...etc. This is not necessarily deducible from the length of the byte[] holding the secure key bytes, since encryption under LMK is proprietary to the security module.

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

Version:
$Revision: 2594 $ $Date: 2008-01-22 08:41:31 -0800 (Tue, 22 Jan 2008) $
Author:
Hani S. Kirollos
See Also:
SMAdapter, Serialized Form

Constructor Summary
SecureKey()
           
 
Method Summary
 byte[] getKeyBytes()
           
 short getKeyLength()
           
 java.lang.String getKeyName()
          optional key name
 java.lang.String getKeyType()
          Key Type is useful for stating what this key can be used for.
 void setKeyBytes(byte[] keyBytes)
          Sets the secure key bytes
 void setKeyLength(short keyLength)
          Sets the length of the key (in bits) (when it was still clear).
 void setKeyName(java.lang.String keyName)
          optional key name
 void setKeyType(java.lang.String keyType)
          Key Type is useful for stating what this key can be used for.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jpos.util.Loggeable
dump
 

Constructor Detail

SecureKey

public SecureKey()
Method Detail

setKeyBytes

public void setKeyBytes(byte[] keyBytes)
Sets the secure key bytes

Parameters:
keyBytes - byte[] representing the secured key bytes

getKeyBytes

public byte[] getKeyBytes()
Returns:
The byte[] holding the secure key Bytes

setKeyLength

public void setKeyLength(short keyLength)
Sets the length of the key (in bits) (when it was still clear). This might be different than the bit length of the secureKeyBytes.

Parameters:
keyLength -

getKeyLength

public short getKeyLength()
Returns:
The Length of the secure key (when it was still clear)

setKeyType

public void setKeyType(java.lang.String keyType)
Key Type is useful for stating what this key can be used for. The value of Key Type specifies whether this secure key is a TYPE_TMK (Terminal Master Key), TYPE_ZPK (Zone PIN Key)....

Parameters:
keyType -

getKeyType

public java.lang.String getKeyType()
Key Type is useful for stating what this key can be used for. The value of Key Type specifies whether this secure key is a TYPE_TMK (Terminal Master Key), TYPE_ZPK (Zone PIN Key)....

Returns:
keyType

getKeyName

public java.lang.String getKeyName()
optional key name


setKeyName

public void setKeyName(java.lang.String keyName)
optional key name

Parameters:
keyName - string

jPOS.org