de.schlichtherle.key
Class PromptingAesKeyProvider

java.lang.Object
  extended by de.schlichtherle.key.AbstractKeyProvider
      extended by de.schlichtherle.key.PromptingKeyProvider
          extended by de.schlichtherle.key.PromptingAesKeyProvider
All Implemented Interfaces:
AesKeyProvider, KeyProvider

public class PromptingAesKeyProvider
extends PromptingKeyProvider
implements AesKeyProvider

An implementation of AesKeyProvider which prompts the user for a key and allows to select the cipher key strength when creating a new AES encrypted resource or replacing the entire contents of an already existing AES encrypted resource.

This class is thread safe.

Since:
TrueZIP 6.0
Version:
TrueZIP 6.7
Author:
Christian Schlichtherle

Field Summary
 
Fields inherited from interface de.schlichtherle.key.AesKeyProvider
KEY_STRENGTH_128, KEY_STRENGTH_192, KEY_STRENGTH_256
 
Fields inherited from interface de.schlichtherle.key.KeyProvider
MIN_KEY_RETRY_DELAY
 
Constructor Summary
PromptingAesKeyProvider()
           
 
Method Summary
 int getKeyStrength()
          Returns the cipher key strength for the AES encryption.
protected  String getUIClassID()
          Returns the identifier which is used by the PromptingKeyManager to look up an instance of the PromptingKeyProviderUI user interface class which is then used to prompt the user for a key.
protected  void onReset()
          Resets the key strength to 256 bits.
 void setKeyStrength(int keyStrength)
          Sets the cipher key strength for the AES encryption.
 String toString()
          Returns the current key strength.
 
Methods inherited from class de.schlichtherle.key.PromptingKeyProvider
addToKeyManager, getCreateKeyImpl, getOpenKeyImpl, getResourceID, invalidOpenKeyImpl, removeFromKeyManager, reset
 
Methods inherited from class de.schlichtherle.key.AbstractKeyProvider
cloneKey, getCreateKey, getKey, getOpenKey, invalidOpenKey, resetKey, setKey
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface de.schlichtherle.key.KeyProvider
getCreateKey, getOpenKey, invalidOpenKey
 

Constructor Detail

PromptingAesKeyProvider

public PromptingAesKeyProvider()
Method Detail

getKeyStrength

public int getKeyStrength()
Description copied from interface: AesKeyProvider
Returns the cipher key strength for the AES encryption.

Specified by:
getKeyStrength in interface AesKeyProvider
Returns:
One of KEY_STRENGTH_128, KEY_STRENGTH_192 or KEY_STRENGTH_256.

setKeyStrength

public void setKeyStrength(int keyStrength)
Description copied from interface: AesKeyProvider
Sets the cipher key strength for the AES encryption.

Specified by:
setKeyStrength in interface AesKeyProvider
Parameters:
keyStrength - One of KEY_STRENGTH_128, KEY_STRENGTH_192 or KEY_STRENGTH_256.

getUIClassID

protected String getUIClassID()
Description copied from class: PromptingKeyProvider
Returns the identifier which is used by the PromptingKeyManager to look up an instance of the PromptingKeyProviderUI user interface class which is then used to prompt the user for a key. The implementation in this class returns the fully qualified name of this class.

Subclasses which want to use a custom user interface should overwrite this method to return the fully qualified name of their respective class as the identifier and provide a custom PromptingKeyManager which has registered a PromptingKeyProviderUI class for this identifier.

Overrides:
getUIClassID in class PromptingKeyProvider

onReset

protected void onReset()
Resets the key strength to 256 bits.

Overrides:
onReset in class PromptingKeyProvider

toString

public String toString()
Returns the current key strength.

Overrides:
toString in class Object