public final class NewPassphraseFrameDialog extends javax.swing.JFrame implements NewPassphrasePrompt
Modifier and Type | Class and Description |
---|---|
protected static class |
NewPassphraseFrameDialog.DefaultConstraints
A contraints class for passphrases to use as default.
|
javax.swing.JFrame.AccessibleJFrame
java.awt.Window.AccessibleAWTWindow, java.awt.Window.Type
Modifier and Type | Field and Description |
---|---|
protected boolean |
cancelAllowed_
indicates if this passphrase dialog can be canceled by the user with entering a password
|
protected PassphraseConstraints |
cons_
Contraints for a passphrase
|
protected boolean |
dialogClosed_
Used to emulated a modal dialog.
|
protected java.lang.Object |
dialogClosedLock_
This is a flag that is used to synchronize the threads to have a modal dialog
|
protected java.awt.GridBagLayout |
gridBagLayout1_
Layout for content pane
|
protected javax.swing.JButton |
jButtonOK_
OK button
|
protected javax.swing.JLabel |
jLConfirmation_
Label for passphrase confirmation field
|
protected javax.swing.JLabel |
jLOldPassphrase_
Label for old passphrase field
|
protected javax.swing.JLabel |
jLPassphrase_
Label for passphrase field
|
protected javax.swing.JPasswordField |
jPFConfirmation_
Passphrase confirmation field
|
protected javax.swing.JPasswordField |
jPFOldPassphrase_
Passphrase field
|
protected javax.swing.JPasswordField |
jPFPassphrase_
Passphrase field
|
protected javax.swing.JTextArea |
jTAMsg_
text area to display message
|
static java.lang.String |
LINE_SEPARATOR
The separator used to separate lines in the message component.
|
protected java.lang.String |
message_
Message in this dialog
|
protected char[] |
oldPassphrase_
The old passphrase
|
protected boolean |
oldPassphraseRequired_
indicates if the user must enter the old passphrase also
|
protected javax.swing.JPanel |
panel1_
Content pane
|
protected char[] |
passphrase_
The passphrase
|
protected java.lang.Object |
protectedResourceInfo_
Object specifying the protected resource; e.g.
|
protected static java.util.ResourceBundle |
res_
Used to read strings from (internationalization)
|
protected java.lang.String |
title_
Title of this dialog
|
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor and Description |
---|
NewPassphraseFrameDialog()
Empty constructor.
|
NewPassphraseFrameDialog(java.lang.String title)
Constructor.
|
NewPassphraseFrameDialog(java.lang.String title,
java.lang.Object promptMessageObject)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkPassphrase()
Check the actual enteres passphrase for validity and throw an PassphraseException if passphrase
is not ok of any reason.
|
protected void |
dialogInit()
Initializing and adding all components.
|
protected void |
displayError(java.lang.String message)
Displays a error message.
|
void |
dispose()
Overridden to catch the call to this method.
|
protected boolean |
equals(char[] a1,
char[] a2)
Checks two
char arrays for equality. |
protected void |
fill(char[] a,
char c)
Fills an array with a specific character.
|
protected void |
fillMessage()
This method fills the
jTAMsg_ component which holds the message. |
char[] |
getNewPassphrase()
Returns the entered new passphrase and delete the internal copy of the password afterwards.
|
char[] |
getOldPassphrase()
Returns the entered old passphrase and delete the internal copy of the password afterwards.
|
protected void |
initContentPane()
This method initializes the content pane.
|
boolean |
isCancelAllowed()
Check, if the user can cancel this dialog; e.g.
|
static void |
main(java.lang.String[] args)
For testing only.
|
protected void |
okActionPerformed()
Wraps actions to perform on OK.
|
void |
paint(java.awt.Graphics g)
We have overridden this method to set the input focus to the password field when the dialog is
painted the first time.
|
char[][] |
promptNewPassphrase()
Show this dialog and return the entered password(s).
|
protected void |
retrievePassphrase()
Retrieve passphrase from input fields.
|
void |
setCancelAllowed(boolean allowCancel)
Set, if the user is allowed to cancel this dialog without entering a password.
|
void |
setConstraints(PassphraseConstraints cons)
Sets a new contraints object.
|
void |
setMessage(java.lang.Object promptMessageObject)
Set the message to be displayed by this dialog.
|
void |
setOldPassphraseRequired(boolean oldPassphraseRequired)
Set if the use must enter the old passphrase in addition to the new.
|
void |
setProtectedResourceInfo(java.lang.Object protectedResourceInfo)
Set the object that represents the protected resources; i.e.
|
void |
show()
Show this dialog.
|
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setBackground, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setOpacity, setResizable, setShape, setState, setTitle, setUndecorated
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, setVisible, toBack, toFront
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final java.lang.String LINE_SEPARATOR
protected javax.swing.JPanel panel1_
protected java.awt.GridBagLayout gridBagLayout1_
protected javax.swing.JTextArea jTAMsg_
protected javax.swing.JLabel jLPassphrase_
protected javax.swing.JLabel jLOldPassphrase_
protected javax.swing.JLabel jLConfirmation_
protected javax.swing.JPasswordField jPFOldPassphrase_
protected javax.swing.JPasswordField jPFPassphrase_
protected javax.swing.JPasswordField jPFConfirmation_
protected javax.swing.JButton jButtonOK_
protected java.lang.String title_
protected java.lang.String message_
protected java.lang.Object protectedResourceInfo_
protected char[] oldPassphrase_
protected char[] passphrase_
protected PassphraseConstraints cons_
protected static java.util.ResourceBundle res_
protected boolean cancelAllowed_
protected boolean oldPassphraseRequired_
protected java.lang.Object dialogClosedLock_
protected boolean dialogClosed_
public NewPassphraseFrameDialog()
public NewPassphraseFrameDialog(java.lang.String title)
title
- The title of the dialog box.public NewPassphraseFrameDialog(java.lang.String title, java.lang.Object promptMessageObject)
title
- The title of the dialog box.promptMessageObject
- The message to diplay to the user.public void setOldPassphraseRequired(boolean oldPassphraseRequired)
setOldPassphraseRequired
in interface NewPassphrasePrompt
oldPassphraseRequired
- True, the use must enter the old passphrase in addition to the new.public void setMessage(java.lang.Object promptMessageObject)
toString()
of this object.setMessage
in interface PassphraseInterfacce
promptMessageObject
- The message object.public void setProtectedResourceInfo(java.lang.Object protectedResourceInfo)
toString()
.setProtectedResourceInfo
in interface PassphraseInterfacce
protectedResourceInfo
- The resource info object.public char[][] promptNewPassphrase()
getOldPassphrase()
and
getNewPassphrase()
method, because this method already calls these methods.promptNewPassphrase
in interface NewPassphrasePrompt
public char[] getOldPassphrase()
public char[] getNewPassphrase()
public boolean isCancelAllowed()
isCancelAllowed
in interface PassphraseInterfacce
public void setCancelAllowed(boolean allowCancel)
setCancelAllowed
in interface PassphraseInterfacce
allowCancel
- True, to allow the user to cancel the dialog.public void setConstraints(PassphraseConstraints cons)
checkPassphrase(char[])
of this object is called when the user hits OK. If this method
throws an PassphraseException the message is displayed. If this method returns normally, this
dialog is closed (hidden).cons
- A object used to check a entered password. If set to null, a default object will be
used.public void show()
show
in class java.awt.Window
public void paint(java.awt.Graphics g)
paint
in class java.awt.Window
g
- see Container.paint(java.awt.Graphics)
.public void dispose()
dispose
in class java.awt.Window
protected void fillMessage()
jTAMsg_
component which holds the message. It fills it with the
prompt message followed by information about the protected resource; e.g. the token label, if
the resource info is a TokenInfo
object. A subclass may override this method to
display different things to the user.protected void dialogInit()
protected void initContentPane()
protected void okActionPerformed()
protected void checkPassphrase() throws PassphraseException
PassphraseException
- Thrown, if passphrase is not valid.protected void retrievePassphrase()
protected void displayError(java.lang.String message)
message
- The message to display.protected boolean equals(char[] a1, char[] a2)
char
arrays for equality. Two arrays are considered equal, if they
refer to the same array, or they have the same length and contain the same characters in the
same order. If both are null
, they are considered equal. For JDK 2 use
java.util.Arrays.equals()a1
- The first array.a2
- The second array.protected void fill(char[] a, char c)
a
- The array to fill.c
- The character to fill with.public static void main(java.lang.String[] args)
IAIK JavaSecurity Website https://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2023 IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved. Version 1.9.4