com.isbc.smartcard.esmarttoken.applet

## Class AppletWrapper

- java.lang.Object
- - java.awt.Component
  - - java.awt.Container
    - - java.awt.Panel
      - - java.applet.Applet
        - - com.isbc.smartcard.esmarttoken.applet.AppletWrapper

- All Implemented Interfaces:
    ImageObserver, MenuContainer, Serializable, Accessible

      public class AppletWrapper
      extends Applet

  Wrapper for PKCS#11 invocation via WEB
  Author:
    Sergey Panov
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.applet.Applet

      `Applet.AccessibleApplet`

    - ### Nested classes/interfaces inherited from class java.awt.Panel

      `Panel.AccessibleAWTPanel`

    - ### 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

    - ### 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

    Constructors
    Constructor and Description
    `AppletWrapper()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `String` | `checkLibrary()` Check if JNI library found and can be loaded
    `String` | `cleanCard(String pin)` Clearing card by deleting all object from token
    `String` | `generateKeyPair(String pin)` Generate RSA key pair (C_GenerateKeyPair from PKCS#11 API)
    `String` | `getPublicKey(String pin, String label, String id, String modulusfilepath, String exponentfilepath)` Get public key from the token
    `String` | `getTerminalList()` Get token UID
    `String` | `getUID()` Get token UID
    `String` | `getX509Certificate(String pin, String label, String id, String filepath)` Get X509 certificate from the token
    `void` | `init()`
    `String` | `initCard(String pin)` Initialize token (C_InitToken from PKCS#11 API)
    `String` | `listObjects(String pin)` List token's objects
    `String` | `loadCert(String pin, String filepath, String filepass)` Load certificate from PKCS#12 file
    `String` | `loadX509Certificate(String pin, String label, String id, String filepath)` Load X509 certificate to token (C_ISBC_ImportX509Certificate from PKCS#11 API)
    `String` | `setPin(String oldpin, String newpin)` Set user PIN
    `String` | `setPuk(String oldpin, String newpin)` Set SO PIN

    - ### Methods inherited from class java.applet.Applet

      `destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, isValidateRoot, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop`

    - ### Methods inherited from class java.awt.Panel

      `addNotify`

    - ### Methods inherited from class java.awt.Container

      `add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### AppletWrapper

          public AppletWrapper()

  - ### Method Detail

    - #### init

          public void init()

      Overrides:
        `init` in class `Applet`

    - #### cleanCard

          public String cleanCard(String pin)

      Clearing card by deleting all object from token
      Parameters:
        `pin` - User PIN code
      Returns:
        Result code for the operation. Code 0 means success. Positive values in according to PKCS #11 v2.20 specification error codes Negative values in according to ErrorCode class
      See Also:
        `ErrorCode`

    - #### initCard

          public String initCard(String pin)

      Initialize token (C_InitToken from PKCS#11 API)
      Parameters:
        `pin` - User PIN code
      Returns:
        Result code for the operation. Code 0 means success. Positive values in according to PKCS #11 v2.20 specification error codes Negative values in according to ErrorCode class
      See Also:
        `ErrorCode`

    - #### generateKeyPair

          public String generateKeyPair(String pin)

      Generate RSA key pair (C_GenerateKeyPair from PKCS#11 API)
      Parameters:
        `pin` - User PIN code
      Returns:
        Result code for the operation. Code 0 means success. Positive values in according to PKCS #11 v2.20 specification error codes Negative values in according to ErrorCode class
      See Also:
        `ErrorCode`

    - #### listObjects

          public String listObjects(String pin)

      List token's objects
      Parameters:
        `pin` - User PIN code
      Returns:
        Result code for the operation and list objects. Code 0 means success. Positive values in according to PKCS #11 v2.20 specification error codes Negative values in according to ErrorCode class
      See Also:
        `ErrorCode`

    - #### setPin

          public String setPin(String oldpin,
                               String newpin)

      Set user PIN
      Parameters:
        `oldpin` - Old user PIN code
        `newpin` - New user PIN code
      Returns:
        Result code for the operation and list objects. Code 0 means success. Positive values in according to PKCS #11 v2.20 specification error codes Negative values in according to ErrorCode class
      See Also:
        `ErrorCode`

    - #### setPuk

          public String setPuk(String oldpin,
                               String newpin)

      Set SO PIN
      Parameters:
        `oldpin` - Old SO PIN code
        `newpin` - New SO PIN code
      Returns:
        Result code for the operation and list objects. Code 0 means success. Positive values in according to PKCS #11 v2.20 specification error codes Negative values in according to ErrorCode class
      See Also:
        `ErrorCode`

    - #### loadCert

          public String loadCert(String pin,
                                 String filepath,
                                 String filepass)

      Load certificate from PKCS#12 file
      Parameters:
        `pin` - User PIN code
        `filepath` - Path to the file with certificate content
        `filepass` - Password for the loaded PKCS#12 file
      Returns:
        Result code for the operation and list objects. Code 0 means success. Positive values in according to PKCS #11 v2.20 specification error codes Negative values in according to ErrorCode class
      See Also:
        `ErrorCode`

    - #### getX509Certificate

          public String getX509Certificate(String pin,
                                           String label,
                                           String id,
                                           String filepath)

      Get X509 certificate from the token
      Parameters:
        `pin` - User PIN code
        `label` - Certificate object label
        `id` - Certificate object id
        `filepath` - File where certificate will be saved
      Returns:
        Result code for the operation and list objects. Code 0 means success. Positive values in according to PKCS #11 v2.20 specification error codes Negative values in according to ErrorCode class
      See Also:
        `ErrorCode`

    - #### getUID

          public String getUID()

      Get token UID
      Returns:
        Result token UID or null

    - #### getPublicKey

          public String getPublicKey(String pin,
                                     String label,
                                     String id,
                                     String modulusfilepath,
                                     String exponentfilepath)

      Get public key from the token
      Parameters:
        `pin` - User PIN code
        `label` - Certificate object label
        `id` - Certificate object id
        `modulusfilepath` - File where public key module will be saved
        `exponentfilepath` - File where public key exponent will be saved
      Returns:
        Result code for the operation and list objects. Code 0 means success. Positive values in according to PKCS #11 v2.20 specification error codes Negative values in according to ErrorCode class
      See Also:
        `ErrorCode`

    - #### loadX509Certificate

          public String loadX509Certificate(String pin,
                                            String label,
                                            String id,
                                            String filepath)

      Load X509 certificate to token (C_ISBC_ImportX509Certificate from PKCS#11 API)
      Parameters:
        `pin` - User PIN code
        `label` - Certificate object label
        `id` - Certificate object id
        `filepath` - Path to the file with certificate content
      Returns:
        Result code for the operation and list objects. Code 0 means success. Positive values in according to PKCS #11 v2.20 specification error codes Negative values in according to ErrorCode class
      See Also:
        `ErrorCode`

    - #### checkLibrary

          public String checkLibrary()

      Check if JNI library found and can be loaded
      Returns:
        Code 1 means success, 0 means unsuccess.

    - #### getTerminalList

          public String getTerminalList()

      Get token UID
      Returns:
        Result token UID or null

Copyright © 2018. All rights reserved.