nl.nikhef.slcshttps.gui
Class SerialPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by nl.nikhef.slcshttps.gui.SerialPanel
All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class SerialPanel
extends JPanel
implements ActionListener

Class to create a panel showing information about the serial number of the client side certificate in use for the default SSLSocketFactory for HttpsURLConnection or HttxURLConnection and and buttons to change it. Note CAPanel shows either one or two SerialPanels, one for Https, one for Httx.

Version:
0.1
Author:
Mischa Sallé
See Also:
CAPanel, CAHttps.setSSLSocketFactory(), Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
(package private)  JButton actButton
          Activate the certificate for client side authentication.
(package private)  CAHttps ca
          The information for this SerialPanel is taken from here.
(package private)  JButton deactButton
          Dectivate the certificate for client side authentication.
private  boolean maskHttps
          whether or not Https is masked by CAPanel, what is actually shown by this SerialPanel is determined by the parameter in SerialPanel(CAHttps,boolean), masking means: show only Httx status, but update both Https and Httx.
(package private)  NonEditableDefaultTableModel serialModel
          Contains the serialnumber, updated by actButton and deactButton.
private  boolean showBoth
          whether or Https AND Httx status are shown by CAPanel, what is actually shown by this SerialPanel is determined by the parameter in SerialPanel(CAHttps,boolean).
private  boolean showHttx
          whether or not the Httx is shown by CAPanel, what is actually shown by this SerialPanel is determined by the parameter in SerialPanel(CAHttps,boolean).
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
SerialPanel(CAHttps caHttps, boolean httx)
          Constructs a SerialPanel for either Httx or Https, depending on the value of httx.
 
Method Summary
 void actionPerformed(ActionEvent event)
          Called when one of the buttons is pressed.
private  JPanel getButtonPanel(boolean cert, boolean active)
          Creates a JPanel containing the activate/deactivate buttons.
private  String getSerial(CAHttps caHttps, boolean httx)
          Gets the serial number from the CAHttps for either HttxURLConnection (when httx is true) or HttpsURLConnection (otherwise).
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ca

CAHttps ca
The information for this SerialPanel is taken from here.


serialModel

NonEditableDefaultTableModel serialModel
Contains the serialnumber, updated by actButton and deactButton.


actButton

JButton actButton
Activate the certificate for client side authentication.


deactButton

JButton deactButton
Dectivate the certificate for client side authentication.


showHttx

private boolean showHttx
whether or not the Httx is shown by CAPanel, what is actually shown by this SerialPanel is determined by the parameter in SerialPanel(CAHttps,boolean).


showBoth

private boolean showBoth
whether or Https AND Httx status are shown by CAPanel, what is actually shown by this SerialPanel is determined by the parameter in SerialPanel(CAHttps,boolean).


maskHttps

private boolean maskHttps
whether or not Https is masked by CAPanel, what is actually shown by this SerialPanel is determined by the parameter in SerialPanel(CAHttps,boolean), masking means: show only Httx status, but update both Https and Httx.

Constructor Detail

SerialPanel

public SerialPanel(CAHttps caHttps,
                   boolean httx)
            throws KeyStoreException
Constructs a SerialPanel for either Httx or Https, depending on the value of httx.

Parameters:
caHttps - the CAHttps to get the status, certificate and settings from.
httx - whether this panel is for Httx (true) or Https (false).
Throws:
KeyStoreException - when retrieval of certificate from caHttps fails (not when caHttps is null).
Method Detail

actionPerformed

public void actionPerformed(ActionEvent event)
Called when one of the buttons is pressed. It sets the correct button labels and enables/disables the certificate. It also updates the serial number in the table. It uses the instance variables ca to change the SSLSocketFactory, serialModel to change the text and actButton and deactButton to set their status and label.

Specified by:
actionPerformed in interface ActionListener
Parameters:
event - type of event (which button has been pressed).

getButtonPanel

private JPanel getButtonPanel(boolean cert,
                              boolean active)
Creates a JPanel containing the activate/deactivate buttons.

Parameters:
cert - boolean whether there is a certificate.
active - boolean whether a certificate is active.
Returns:
JPanel containing the buttons.

getSerial

private String getSerial(CAHttps caHttps,
                         boolean httx)
Gets the serial number from the CAHttps for either HttxURLConnection (when httx is true) or HttpsURLConnection (otherwise).

Parameters:
caHttps - CAHttps to use.
httx - whether to return the value for Httx (true) or Https (false).
Returns:
String representation of certificate serial number in use.


nl.nikhef.slcshttps Mischa Sallé - msalle(AT)nikhef.nl