de.schlichtherle.key.passwd.console
Class PromptingKeyManager

java.lang.Object
  extended by de.schlichtherle.key.KeyManager
      extended by de.schlichtherle.key.PromptingKeyManager
          extended by de.schlichtherle.key.passwd.console.PromptingKeyManager

public class PromptingKeyManager
extends PromptingKeyManager

A simple key manager which enables users to enter passwords as keys using console I/O. This key manager is used by default if the JVM is running in headless mode and the API complies to JSE6 (i.e. the class java.io.Console is available)! To request it explicitly, set the system property de.schlichtherle.key.KeyManager to de.schlichtherle.key.passwd.console.PromptingKeyManager.

This key manager does not support key files and disables prompting if no console is attached to the JVM.

Note that class loading and instantiation may happen in a JVM shutdown hook, so class initializers and constructors must behave accordingly. In particular, it's not permitted to construct or use a Swing GUI there.

This class is thread safe.

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

Nested Class Summary
 
Nested classes/interfaces inherited from class de.schlichtherle.key.KeyManager
KeyManager.KeyProviderCommand
 
Constructor Summary
PromptingKeyManager()
          Constructs a new PromptingKeyManager.
 
Method Summary
protected  void ensurePromptingImpl()
          If no console is attached to this JVM, then this method throws a KeyPromptingDisabledException.
protected  boolean isPromptingImpl()
          Called by PromptingKeyManager.isPrompting() on the default key manager instance in order to implement its behaviour and allow subclasses to override it.
 
Methods inherited from class de.schlichtherle.key.PromptingKeyManager
getKeyProvider, isPrompting, mapPromptingKeyProviderUIType, register, resetCancelledPrompts, setPrompting, setPromptingImpl
 
Methods inherited from class de.schlichtherle.key.KeyManager
forEachKeyProvider, getInstance, getKeyProvider, mapKeyProviderType, moveKeyProvider, resetAndClearKeyProviders, resetAndRemoveKeyProvider, resetAndRemoveKeyProviders, resetKeyProvider, resetKeyProviders, setInstance, setKeyProvider
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PromptingKeyManager

public PromptingKeyManager()
Constructs a new PromptingKeyManager. This instance maps the following key provider UI types using PromptingKeyManager.mapPromptingKeyProviderUIType(java.lang.String, java.lang.Class):
uiClassID uiClass
"PromptingKeyProvider" PromptingKeyProviderUI.class
"PromptingAesKeyProvider" PromptingAesKeyProviderUI.class

Method Detail

isPromptingImpl

protected boolean isPromptingImpl()
Description copied from class: PromptingKeyManager
Called by PromptingKeyManager.isPrompting() on the default key manager instance in order to implement its behaviour and allow subclasses to override it. Subclasses should call the implementation in this class when overriding this method.

Overrides:
isPromptingImpl in class PromptingKeyManager
See Also:
PromptingKeyManager.setPromptingImpl(boolean), KeyManager.getInstance()

ensurePromptingImpl

protected void ensurePromptingImpl()
                            throws KeyPromptingDisabledException
If no console is attached to this JVM, then this method throws a KeyPromptingDisabledException.

Overrides:
ensurePromptingImpl in class PromptingKeyManager
Throws:
KeyPromptingDisabledException