IAIK PKCS#11 Wrapper Demo
version 1.2.17

demo.pkcs.pkcs11.wrapper
Class SimpleTest

java.lang.Object
  extended bydemo.pkcs.pkcs11.wrapper.SimpleTest

public class SimpleTest
extends Object

This is a simple class for testing the implementation. Notice that this is an sample that may not run as is with many tokens. It may be required to exclude some test methods in the main method.


Field Summary
protected static String CERTIFICATE_FILE
           
protected  long certificateHandle_
           
protected  byte[] derEncodedCertificate_
           
protected  byte[] digest_
           
protected static String DIGEST_FILE
           
protected  CK_MECHANISM digestMechanism_
           
protected  File file_
           
protected  MessageDigest messageDigest_
           
protected  PKCS11 myPKCS11Module_
           
protected  long[] objects_
           
protected  long session_
           
protected  byte[] signature_
           
protected static String SIGNATURE_FILE
           
protected  long signatureKeyHandle_
           
protected  CK_MECHANISM signatureMechanism_
           
protected  long token_
           
protected  String userPin_
           
 
Constructor Summary
SimpleTest(String pkcs11Module, String userPin, File file)
           
 
Method Summary
 void closeSession()
           
 void digestData()
           
 void findAllObjects()
           
 void findCertificate()
           
 void findSignatureKey()
           
 void getInfo()
           
 void getMechanismInfo()
           
 void getSessionInfo()
           
 void getSlotInfo()
           
 void getTokenInfo()
           
 void initialize()
           
 void initToken()
           
 void loginUser()
           
 void logout()
           
static void main(String[] args)
           
 void openROSession()
           
 void printAllObjects()
           
static void printUsage()
           
 void readCertificate()
           
 void signData()
           
 void writeCertificateToFile()
           
 void writeDigestToFile()
           
 void writeSignatureToFile()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CERTIFICATE_FILE

protected static final String CERTIFICATE_FILE
See Also:
Constant Field Values

SIGNATURE_FILE

protected static final String SIGNATURE_FILE
See Also:
Constant Field Values

DIGEST_FILE

protected static final String DIGEST_FILE
See Also:
Constant Field Values

myPKCS11Module_

protected PKCS11 myPKCS11Module_

userPin_

protected String userPin_

token_

protected long token_

session_

protected long session_

objects_

protected long[] objects_

signatureKeyHandle_

protected long signatureKeyHandle_

certificateHandle_

protected long certificateHandle_

derEncodedCertificate_

protected byte[] derEncodedCertificate_

file_

protected File file_

signatureMechanism_

protected CK_MECHANISM signatureMechanism_

digestMechanism_

protected CK_MECHANISM digestMechanism_

messageDigest_

protected MessageDigest messageDigest_

signature_

protected byte[] signature_

digest_

protected byte[] digest_
Constructor Detail

SimpleTest

public SimpleTest(String pkcs11Module,
                  String userPin,
                  File file)
           throws IOException,
                  PKCS11Exception
Method Detail

main

public static void main(String[] args)

printUsage

public static void printUsage()

initialize

public void initialize()
                throws PKCS11Exception
Throws:
PKCS11Exception

getInfo

public void getInfo()
             throws PKCS11Exception
Throws:
PKCS11Exception

getSlotInfo

public void getSlotInfo()
                 throws PKCS11Exception
Throws:
PKCS11Exception

getTokenInfo

public void getTokenInfo()
                  throws PKCS11Exception
Throws:
PKCS11Exception

getMechanismInfo

public void getMechanismInfo()
                      throws PKCS11Exception
Throws:
PKCS11Exception

initToken

public void initToken()
               throws PKCS11Exception
Throws:
PKCS11Exception

openROSession

public void openROSession()
                   throws PKCS11Exception
Throws:
PKCS11Exception

getSessionInfo

public void getSessionInfo()
                    throws PKCS11Exception
Throws:
PKCS11Exception

findAllObjects

public void findAllObjects()
                    throws PKCS11Exception
Throws:
PKCS11Exception

printAllObjects

public void printAllObjects()
                     throws PKCS11Exception
Throws:
PKCS11Exception

loginUser

public void loginUser()
               throws PKCS11Exception
Throws:
PKCS11Exception

findSignatureKey

public void findSignatureKey()
                      throws PKCS11Exception
Throws:
PKCS11Exception

findCertificate

public void findCertificate()
                     throws PKCS11Exception
Throws:
PKCS11Exception

readCertificate

public void readCertificate()
                     throws PKCS11Exception
Throws:
PKCS11Exception

writeCertificateToFile

public void writeCertificateToFile()
                            throws IOException,
                                   PKCS11Exception
Throws:
IOException
PKCS11Exception

signData

public void signData()
              throws IOException,
                     PKCS11Exception
Throws:
IOException
PKCS11Exception

writeSignatureToFile

public void writeSignatureToFile()
                          throws IOException,
                                 PKCS11Exception
Throws:
IOException
PKCS11Exception

digestData

public void digestData()
                throws IOException,
                       PKCS11Exception
Throws:
IOException
PKCS11Exception

writeDigestToFile

public void writeDigestToFile()
                       throws IOException,
                              PKCS11Exception
Throws:
IOException
PKCS11Exception

logout

public void logout()
            throws PKCS11Exception
Throws:
PKCS11Exception

closeSession

public void closeSession()
                  throws PKCS11Exception
Throws:
PKCS11Exception

IAIK PKCS#11 Wrapper Demo
version 1.2.17

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

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