org.javasign.util
Class WrapperUtil

java.lang.Object
  |
  +--org.javasign.util.WrapperUtil

public class WrapperUtil
extends java.lang.Object

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 java.util.Hashtable mechansimCodes_
          Maps mechanism strings to their codes as Long.
 
Constructor Summary
WrapperUtil()
           
 
Method Summary
static java.security.cert.X509Certificate loadX509Certificate(byte[] array)
           
static java.lang.Long mechanismCodeToString(java.lang.String mechansimName)
          Converts the names of mechanisms to their long value code.
static Session openAuthorizedSession(Token token, boolean rwSession, java.io.PrintWriter output, java.lang.String PIN)
           
static KeyAndCertificate selectKeyAndCertificate(Session session, Key keyTemplate, java.io.PrintWriter output, java.lang.String key_label)
           
static Token selectToken(Module pkcs11Module, java.io.PrintWriter output)
           
static java.lang.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

mechansimCodes_

protected static java.util.Hashtable mechansimCodes_
Maps mechanism strings to their codes as Long.

Constructor Detail

WrapperUtil

public WrapperUtil()
Method Detail

mechanismCodeToString

public static java.lang.Long mechanismCodeToString(java.lang.String mechansimName)
Converts the names of mechanisms to their long value code.

Parameters:
mechansimName - The name of the mechanism to get the code; e.g. "CKM_RSA_PKCS".
Returns:
The code of the mechanism or null, if this name is unknown.

selectToken

public static Token selectToken(Module pkcs11Module,
                                java.io.PrintWriter output)
                         throws TokenException,
                                java.io.IOException
TokenException
java.io.IOException

openAuthorizedSession

public static Session openAuthorizedSession(Token token,
                                            boolean rwSession,
                                            java.io.PrintWriter output,
                                            java.lang.String PIN)
                                     throws TokenException,
                                            java.io.IOException
TokenException
java.io.IOException

selectKeyAndCertificate

public static KeyAndCertificate selectKeyAndCertificate(Session session,
                                                        Key keyTemplate,
                                                        java.io.PrintWriter output,
                                                        java.lang.String key_label)
                                                 throws TokenException,
                                                        java.io.IOException
TokenException
java.io.IOException

toString

public static java.lang.String toString(X509PublicKeyCertificate certificate)
Gets a string representation of the given PKCS#11 certificate.

Parameters:
certificate - The PKCS#11 certificate.
Returns:
The string representing the certificate.

loadX509Certificate

public static java.security.cert.X509Certificate loadX509Certificate(byte[] array)