Cumulus4j API
(1.0.0)

org.cumulus4j.store.crypto.keymanager
Class CryptoCacheKeyEncryptionKeyEntry

java.lang.Object
  extended by org.cumulus4j.store.crypto.keymanager.CryptoCacheKeyEncryptionKeyEntry

public class CryptoCacheKeyEncryptionKeyEntry
extends Object

CryptoCache-entry wrapping a key-pair used for asymmetric en-/decryption of secret keys.

Author:
Marco หงุ่ยตระกูล-Schulze - marco at nightlabs dot de

Constructor Summary
protected CryptoCacheKeyEncryptionKeyEntry(AsymmetricCipherKeyPair keyPair, long keyEncryptionKeyActivePeriodMSec)
          Create an instance.
 
Method Summary
 byte[] getEncodedPublicKey()
          Get the encoded (serialised) public key.
 Date getExpiry()
          Get the timestamp after which the key-pair expires.
 AsymmetricCipherKeyPair getKeyPair()
          Get the key-pair.
 boolean isExpired()
          Determine, if this entry is expired.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CryptoCacheKeyEncryptionKeyEntry

protected CryptoCacheKeyEncryptionKeyEntry(AsymmetricCipherKeyPair keyPair,
                                           long keyEncryptionKeyActivePeriodMSec)
Create an instance.

Parameters:
keyPair - the key-pair used for en-/decrypting secret keys.
keyEncryptionKeyActivePeriodMSec - the length (in milliseconds) how long the key-pair should be used.
Method Detail

getExpiry

public Date getExpiry()
Get the timestamp after which the key-pair expires. This instance of CryptoCacheKeyEncryptionKeyEntry should be evicted then.

Returns:
the timestamp after which the key-pair expires; never null.

isExpired

public boolean isExpired()
Determine, if this entry is expired.

Returns:
true, if the key-pair is expired and should not be used anymore; false otherwise.

getKeyPair

public AsymmetricCipherKeyPair getKeyPair()
Get the key-pair.

Returns:
the key-pair; never null.

getEncodedPublicKey

public byte[] getEncodedPublicKey()
Get the encoded (serialised) public key. This can be sent to the remote key-manager where CryptoRegistry.decodePublicKey(byte[]) can be used to decode (deserialise) the byte array again.

Returns:
the encoded (serialised) public key.

Cumulus4j API
(1.0.0)

Copyright © 2012 NightLabs Consulting GmbH. All Rights Reserved.