|
IAIK PKCS#11 Wrapper Demo version 1.2.17 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdemo.pkcs.pkcs11.Util
This class contains only static methods. It is the place for all functions that are used by several classes in this package.
Field Summary | |
protected static Hashtable |
mechansimCodes_
Maps mechanism strings to their codes as Long. |
Constructor Summary | |
Util()
|
Method Summary | |
static Long |
mechanismCodeToString(String mechansimName)
Converts the names of mechanisms to their long value code. |
static Session |
openAuthorizedSession(Token token,
boolean rwSession,
PrintWriter output,
BufferedReader input)
Opens an authorized session for the given token. |
static KeyAndCertificate |
selectKeyAndCertificate(Session session,
Key keyTemplate,
PrintWriter output,
BufferedReader input)
Lists all keys that match the given key template and lets the user choose one, if there is more than one. |
static Token |
selectToken(Module pkcs11Module,
PrintWriter output,
BufferedReader input)
Lists all available tokens of the given module and lets the user select one, if there is more than one available. |
static String |
toString(X509PublicKeyCertificate certificate)
Gets a string representation of the given PKCS#11 certificate. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static Hashtable mechansimCodes_
Constructor Detail |
public Util()
Method Detail |
public static Long mechanismCodeToString(String mechansimName)
mechansimName
- The name of the mechanism to get the code; e.g.
"CKM_RSA_PKCS".
public static Token selectToken(Module pkcs11Module, PrintWriter output, BufferedReader input) throws TokenException, IOException
pkcs11Module
- The PKCS#11 module to use.output
- The output stream to write the user prompts to.input
- The input stream where to read user input from.
TokenException
- If listing the tokens failed.
IOException
- If writing a user prompt faild or if reading user
input failed.public static Session openAuthorizedSession(Token token, boolean rwSession, PrintWriter output, BufferedReader input) throws TokenException, IOException
token
- The token to open a session for.rwSession
- If the session should be a read-write session. This may be
Token.SessionReadWriteBehavior.RO_SESSION or
Token.SessionReadWriteBehavior.RW_SESSION.output
- The output stream to write the user prompts to.input
- The input stream where to read user input from.
TokenException
- If listing the tokens failed.
IOException
- If writing a user prompt faild or if reading user
input failed.public static KeyAndCertificate selectKeyAndCertificate(Session session, Key keyTemplate, PrintWriter output, BufferedReader input) throws TokenException, IOException
session
- The session to use for key and certificate searching.keyTemplate
- The template for searching for keys.output
- The output stream to write the user prompts to.input
- The input stream where to read user input from.
TokenException
- If searching for keys or certificates failed.
IOException
- If writing a user prompt faild or if reading user
input failed.public static String toString(X509PublicKeyCertificate certificate)
certificate
- The PKCS#11 certificate.
|
IAIK PKCS#11 Wrapper Demo version 1.2.17 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |