IAIK PKCS#11 Provider API Documentation
version 1.6

iaik.apps.util.passphrase
Class PassphraseConsoleDialog

java.lang.Object
  extended by iaik.apps.util.passphrase.PassphraseConsoleDialog
All Implemented Interfaces:
PassphraseInterfacce, PassphrasePrompt

public final class PassphraseConsoleDialog
extends java.lang.Object
implements PassphrasePrompt

A dialog for prompting a passphrase via the console.

Author:
Karl Scheibelhofer

Field Summary
static java.lang.String LINE_SEPARATOR
           
 
Constructor Summary
PassphraseConsoleDialog()
          Empty constructor.
 
Method Summary
 boolean isCancelAllowed()
          True, if this prompt can be canceled by the user; i.e. the user need not enter a passphrase.
 char[] promptPassphrase()
          Prompt the passphrase from the user after displaying the prompt message to him.
 void setCancelAllowed(boolean allowCancel)
          Set this prompt object to allow cancelling or not.
 void setMessage(java.lang.Object promptMessageObject)
          Set the prompt object that should be presented to the user as information what passphrase is required.
 void setProtectedResourceInfo(java.lang.Object protectedResourceInfo)
          Set the object that specifies the protectd resource; i.e. the resource to which the user needs to authenticate; e.g. the name of the smart card for which a PIN is required.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LINE_SEPARATOR

public static final java.lang.String LINE_SEPARATOR
Constructor Detail

PassphraseConsoleDialog

public PassphraseConsoleDialog()
Empty constructor.

Method Detail

setMessage

public void setMessage(java.lang.Object promptMessageObject)
Set the prompt object that should be presented to the user as information what passphrase is required. It is recommended that the toString() method of this object provides a telling output for the user. If the implementation knows the concrete class of the object it may use different means to create a message from the given object.

Specified by:
setMessage in interface PassphraseInterfacce
Parameters:
promptMessageObject - The object from which the implementation can get a human readable string that gives information what passphrase the user should enter.

setProtectedResourceInfo

public void setProtectedResourceInfo(java.lang.Object protectedResourceInfo)
Set the object that specifies the protectd resource; i.e. the resource to which the user needs to authenticate; e.g. the name of the smart card for which a PIN is required. The PKCS#11 provider may provide a TokenInfo object.

Specified by:
setProtectedResourceInfo in interface PassphraseInterfacce
Parameters:
protectedResourceInfo - The object that specifies the protected resource in more detail; e.g. the smart card. The PKCS#11 provider may provide a TokenInfo object.

isCancelAllowed

public boolean isCancelAllowed()
True, if this prompt can be canceled by the user; i.e. the user need not enter a passphrase.

Specified by:
isCancelAllowed in interface PassphraseInterfacce
Returns:
True, if this prompt can be canceled without entering a passphrase.
Postconditions
((result == false) implies (promptPassphrase() <> null))

setCancelAllowed

public void setCancelAllowed(boolean allowCancel)
Set this prompt object to allow cancelling or not.

Specified by:
setCancelAllowed in interface PassphraseInterfacce
Parameters:
allowCancel - If true, canceling the prompt is allowed.
Postconditions
(allowedCancel == false) implies (promptPassphrase() <> null)

promptPassphrase

public char[] promptPassphrase()
Prompt the passphrase from the user after displaying the prompt message to him. Block, until user has finished. If user is allowed to cancel the dialog, and the user cancels the dialog, then return null.

Specified by:
promptPassphrase in interface PassphrasePrompt
Returns:
The passphrase the user entered (not including any return character used the finish input).
Postconditions
isCancelAllowed() or ((not isCancelAllowed()) and (result <> null))

IAIK PKCS#11 Provider API Documentation
version 1.6

IAIK JavaSecurity Website http://jce.iaik.tugraz.at/

IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2004, IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved.
version 1.6