TrueZIP Driver TZP (ZIP.RAES) 7.0-rc1

de.schlichtherle.truezip.crypto.raes.param.console
Class AesCipherParametersUI

java.lang.Object
  extended by de.schlichtherle.truezip.crypto.raes.param.console.AesCipherParametersUI
All Implemented Interfaces:
PromptingKeyProvider.UI<AesCipherParameters>

@ThreadSafe
public final class AesCipherParametersUI
extends Object
implements PromptingKeyProvider.UI<AesCipherParameters>

A console based user interface to prompt for passwords.

Author:
Christian Schlichtherle

Nested Class Summary
private static class AesCipherParametersUI.PromptingLock
          Used to lock out concurrent prompting.
 
Field Summary
private static String CLASS_NAME
           
(package private) static Console con
          The console to use for I/O.
private static URI lastResource
          The last resource ID used when prompting.
private static AesCipherParametersUI.PromptingLock lock
          Used to lock out prompting by multiple threads.
private static int MIN_PASSWD_LEN
          The minimum acceptable length of a password.
private static String NO
           
(package private) static ResourceBundle resources
           
private static String YES
           
 
Constructor Summary
AesCipherParametersUI()
           
 
Method Summary
 void promptCreateKey(PromptingKeyProvider<? super AesCipherParameters> provider)
          Prompts the user for the key which may be used to create a new protected resource or entirely replace the contents of an already existing protected resource.
 void promptOpenKey(PromptingKeyProvider<? super AesCipherParameters> provider, boolean invalid)
          Prompts the user for the key which may be used to open an existing protected resource in order to access its contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_NAME

private static final String CLASS_NAME

resources

static final ResourceBundle resources

con

static final Console con
The console to use for I/O. If null, the prompt methods are never called, so it's safe to assume that it's not null in these methods.


lock

private static final AesCipherParametersUI.PromptingLock lock
Used to lock out prompting by multiple threads.


MIN_PASSWD_LEN

private static final int MIN_PASSWD_LEN
The minimum acceptable length of a password.

See Also:
Constant Field Values

lastResource

private static URI lastResource
The last resource ID used when prompting. Initialized to the empty string.


YES

private static final String YES

NO

private static final String NO
Constructor Detail

AesCipherParametersUI

public AesCipherParametersUI()
Method Detail

promptCreateKey

public final void promptCreateKey(PromptingKeyProvider<? super AesCipherParameters> provider)
Description copied from interface: PromptingKeyProvider.UI
Prompts the user for the key which may be used to create a new protected resource or entirely replace the contents of an already existing protected resource. Upon return, the implementation should have updated the key property of the given provider.

If the implementation has called PromptingKeyProvider.setKey(K) with a non-null parameter, then a clone of this object will be used as the key of the given provider.

Otherwise, prompting for a key is permanently disabled and each subsequent call to SafeKeyProvider.getCreateKey() or SafeKeyProvider.getOpenKey(boolean) results in a KeyPromptingCancelledException until PromptingKeyProvider.resetCancelledKey() or PromptingKeyProvider.resetUnconditionally() gets called.

Specified by:
promptCreateKey in interface PromptingKeyProvider.UI<AesCipherParameters>
Parameters:
provider - The key provider to store the result in.

promptOpenKey

public void promptOpenKey(PromptingKeyProvider<? super AesCipherParameters> provider,
                          boolean invalid)
Description copied from interface: PromptingKeyProvider.UI
Prompts the user for the key which may be used to open an existing protected resource in order to access its contents. Upon return, the implementation should have updated the key property of the given provider.

If the implementation has called PromptingKeyProvider.setKey(K) with a non-null parameter, then a clone of this object will be used as the key of the given provider.

Otherwise, if the implementation has called PromptingKeyProvider.setKey(K) with a null parameter or throws a KeyPromptingCancelledException, then prompting for the key is permanently disabled and each subsequent call to SafeKeyProvider.getCreateKey() or SafeKeyProvider.getOpenKey(boolean) results in a KeyPromptingCancelledException until PromptingKeyProvider.resetCancelledKey() or PromptingKeyProvider.resetUnconditionally() gets called.

Otherwise, the state of the key provider is not changed and this method gets called again.

Specified by:
promptOpenKey in interface PromptingKeyProvider.UI<AesCipherParameters>
Parameters:
provider - The key provider to store the result in.
invalid - true iff a previous call to this method resulted in an invalid key.

TrueZIP Driver TZP (ZIP.RAES) 7.0-rc1

Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.