TrueZIP 6.8.1

de.schlichtherle.key.passwd.swing
Class PromptingKeyProviderUI

java.lang.Object
  extended by de.schlichtherle.key.passwd.swing.PromptingKeyProviderUI
All Implemented Interfaces:
PromptingKeyProviderUI
Direct Known Subclasses:
PromptingAesKeyProviderUI

public class PromptingKeyProviderUI
extends Object
implements PromptingKeyProviderUI

A Swing based user interface to prompt for passwords or key files. This class is thread safe.

Since:
TrueZIP 6.0
Version:
$Id: PromptingKeyProviderUI.java,v 1.10 2010/09/21 10:07:36 christian_schlichtherle Exp $
Author:
Christian Schlichtherle

Field Summary
static int KEY_FILE_LEN
          This is the number of bytes to load from the beginning of a key file.
 
Constructor Summary
PromptingKeyProviderUI()
           
 
Method Summary
protected  CreateKeyPanel createCreateKeyPanel()
          A factory method to create the Create Protected Resource Key Panel.
protected  OpenKeyPanel createOpenKeyPanel()
          A factory method to create the Open Protected Resource Key Panel.
protected  CreateKeyPanel getCreateKeyPanel()
          Deprecated. This method is not used anymore and will be removed for the next major release number. It's use may dead lock the GUI. Use createCreateKeyPanel() instead.
protected  Feedback getInvalidCreateKeyFeedback()
           
protected  Feedback getInvalidOpenKeyFeedback()
           
protected  OpenKeyPanel getOpenKeyPanel()
          Deprecated. This method is not used anymore and will be removed for the next major release number. It's use may dead lock the GUI. Use createOpenKeyPanel() instead.
protected  Feedback getUnknownCreateKeyFeedback()
           
protected  Feedback getUnknownOpenKeyFeedback()
           
 void promptCreateKey(PromptingKeyProvider 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.
protected  void promptCreateKey(PromptingKeyProvider provider, JComponent extraDataUI)
          This method is only called by the AWT Event Dispatch Thread, so it doesn't need to be thread safe.
 boolean promptInvalidOpenKey(PromptingKeyProvider provider)
          Prompts the user for the key which may be used to open an existing protected resource in order to access its contents.
protected  boolean promptOpenKey(PromptingKeyProvider provider, boolean invalid, JComponent extraDataUI)
          This method is only called by the AWT Event Dispatch Thread, so it doesn't need to be thread safe.
 boolean promptUnknownOpenKey(PromptingKeyProvider provider)
          Prompts the user for the key which may be used to open an existing protected resource in order to access its contents.
protected  void setInvalidCreateKeyFeedback(Feedback ickf)
           
protected  void setInvalidOpenKeyFeedback(Feedback iokf)
           
protected  void setUnknownOpenKeyFeedback(Feedback uokf)
           
protected  void setUnkownCreateKeyFeedback(Feedback uckf)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_FILE_LEN

public static final int KEY_FILE_LEN
This is the number of bytes to load from the beginning of a key file. A valid key file for encryption must contain at least this number of bytes!

See Also:
Constant Field Values
Constructor Detail

PromptingKeyProviderUI

public PromptingKeyProviderUI()
Method Detail

getCreateKeyPanel

protected CreateKeyPanel getCreateKeyPanel()
Deprecated. This method is not used anymore and will be removed for the next major release number. It's use may dead lock the GUI. Use createCreateKeyPanel() instead.


createCreateKeyPanel

protected CreateKeyPanel createCreateKeyPanel()
A factory method to create the Create Protected Resource Key Panel.


getOpenKeyPanel

protected OpenKeyPanel getOpenKeyPanel()
Deprecated. This method is not used anymore and will be removed for the next major release number. It's use may dead lock the GUI. Use createOpenKeyPanel() instead.


createOpenKeyPanel

protected OpenKeyPanel createOpenKeyPanel()
A factory method to create the Open Protected Resource Key Panel.


getUnknownCreateKeyFeedback

protected Feedback getUnknownCreateKeyFeedback()

setUnkownCreateKeyFeedback

protected void setUnkownCreateKeyFeedback(Feedback uckf)

getInvalidCreateKeyFeedback

protected Feedback getInvalidCreateKeyFeedback()

setInvalidCreateKeyFeedback

protected void setInvalidCreateKeyFeedback(Feedback ickf)

getUnknownOpenKeyFeedback

protected Feedback getUnknownOpenKeyFeedback()

setUnknownOpenKeyFeedback

protected void setUnknownOpenKeyFeedback(Feedback uokf)

getInvalidOpenKeyFeedback

protected Feedback getInvalidOpenKeyFeedback()

setInvalidOpenKeyFeedback

protected void setInvalidOpenKeyFeedback(Feedback iokf)

promptCreateKey

public final void promptCreateKey(PromptingKeyProvider provider)
Description copied from interface: PromptingKeyProviderUI
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 is expected to update the common key in provider. Upon return, if provider.getKey() returns null, prompting for the key is assumed to have been cancelled by the user. In this case, the current and each subsequent call to KeyProvider.getOpenKey() or KeyProvider.getCreateKey() by the client results in an UnknownKeyException and the user is not prompted anymore until the provider is reset by the KeyManager. Otherwise, the key is used as the common key, a clone of which is provided to the client upon request.

Hint: If the user cancels the dialog, it is recommended to leave the provider's key property simply unmodified. This causes the old key to be reused and allows the client to continue its operation as if the user would not have requested to change the key.

Since TrueZIP 6.4, an implementation may also throw a RuntimeException with any kind of UnknownKeyException as its cause. This will trigger the calling method in the PromptingKeyProvider class to unwrap and pass on the cause without changing its state. This may be useful if prompting was interrupted by a call to Thread.interrupt() while waiting on the Event Dispatch Thread. In this case, another try to prompt the user should have the chance to succeed instead of being cancelled without actually prompting the user again. To trigger this behaviour, the implementation should simply throw any kind of RuntimeException with a KeyPromptingInterruptedException as its cause.

Specified by:
promptCreateKey in interface PromptingKeyProviderUI
Parameters:
provider - The default key provider to store the result in.

promptUnknownOpenKey

public final boolean promptUnknownOpenKey(PromptingKeyProvider provider)
Description copied from interface: PromptingKeyProviderUI
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 is expected to update the common key in provider. Upon return, if provider.getKey() returns null, prompting for the key is assumed to have been cancelled by the user. In this case, the current and each subsequent call to KeyProvider.getOpenKey() or KeyProvider.getCreateKey() by the client results in an UnknownKeyException and the user is not prompted anymore until the provider is reset by the KeyManager. Otherwise, the key is used as the common key, a clone of which is provided to the client upon request.

Since TrueZIP 6.4, an implementation may also throw a RuntimeException with any kind of UnknownKeyException as its cause. This will trigger the calling method in the PromptingKeyProvider class to unwrap and pass on the cause without changing its state. This may be useful if prompting was interrupted by a call to Thread.interrupt() while waiting on the Event Dispatch Thread. In this case, another try to prompt the user should have the chance to succeed instead of being cancelled without actually prompting the user again. To trigger this behaviour, the implementation should simply throw any kind of RuntimeException with a KeyPromptingInterruptedException as its cause.

Specified by:
promptUnknownOpenKey in interface PromptingKeyProviderUI
Parameters:
provider - The key provider to store the result in.
Returns:
true if the user has requested to change the provided key.

promptInvalidOpenKey

public final boolean promptInvalidOpenKey(PromptingKeyProvider provider)
Description copied from interface: PromptingKeyProviderUI
Prompts the user for the key which may be used to open an existing protected resource in order to access its contents. This is called if the key returned by a previous call to PromptingKeyProviderUI.promptUnknownOpenKey(de.schlichtherle.key.PromptingKeyProvider) is invalid.

Upon return, the implementation is expected to update the common key in provider. Upon return, if provider.getKey() returns null, prompting for the key is assumed to have been cancelled by the user. In this case, the current and each subsequent call to KeyProvider.getOpenKey() or KeyProvider.getCreateKey() by the client results in an UnknownKeyException and the user is not prompted anymore until the provider is reset by the KeyManager. Otherwise, the key is used as the common key, a clone of which is provided to the client upon request.

Since TrueZIP 6.4, an implementation may also throw a RuntimeException with any kind of UnknownKeyException as its cause. This will trigger the calling method in the PromptingKeyProvider class to unwrap and pass on the cause without changing its state. This may be useful if prompting was interrupted by a call to Thread.interrupt() while waiting on the Event Dispatch Thread. In this case, another try to prompt the user should have the chance to succeed instead of being cancelled without actually prompting the user again. To trigger this behaviour, the implementation should simply throw any kind of RuntimeException with a KeyPromptingInterruptedException as its cause.

Specified by:
promptInvalidOpenKey in interface PromptingKeyProviderUI
Parameters:
provider - The key provider to store the result in.
Returns:
true if the user has requested to change the provided key.

promptCreateKey

protected void promptCreateKey(PromptingKeyProvider provider,
                               JComponent extraDataUI)
This method is only called by the AWT Event Dispatch Thread, so it doesn't need to be thread safe.


promptOpenKey

protected boolean promptOpenKey(PromptingKeyProvider provider,
                                boolean invalid,
                                JComponent extraDataUI)
This method is only called by the AWT Event Dispatch Thread, so it doesn't need to be thread safe.


TrueZIP 6.8.1

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