uc3m.it.CKCertManager
Class CertManagerCK

java.lang.Object
  extended byuc3m.it.CKCertManager.CertManagerCK
All Implemented Interfaces:
IJCCM

public class CertManagerCK
extends java.lang.Object
implements IJCCM

This class serves as a Java wrapper for UC3M Cryptoki library. The different calls to the library are made with native methods that are private in the class. They are called by public methods which work as an "interface" with the external world.

Version:
1.7
Author:
Juan J. S?nchez (jjsanchez@it.uc3m.es)

Constructor Summary
CertManagerCK()
          Creates a new instance of CertManagerCK
 
Method Summary
 boolean checkPrivateKeyOwnership(byte[] serial)
           
 boolean checkPrivateKeyOwnership(byte[] serial, byte[] pk)
           
 java.lang.String dataSign(byte[] data, byte[] serial)
          This public method signs a data byte array with the private key of the certificate selected by serial This method calls private method signData(byte[], byte[], byte[]) signData().
 boolean DoorControl()
           
 java.lang.String getCertificateBySerial(byte[] serial)
          This public method searchs for a Certificate by its serial.
 java.lang.String getCertificateList()
          This public method gets the list of certificates stored in the card as a tagged String.
 java.util.Vector getCertificateVectorList()
          This public method gets the list of certificates stored in the card as CertBeans Vector.
 void getpublickKey(byte[] serial, byte[] mod, byte[] exp)
          This public method uses the libray to made a polling based wait for card.
static void main(java.lang.String[] args)
           
 boolean verifySignature(byte[] Mod, byte[] Exp, byte[] clear, byte[] signed)
           
 void waitForCard()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CertManagerCK

public CertManagerCK()
Creates a new instance of CertManagerCK

Method Detail

getpublickKey

public void getpublickKey(byte[] serial,
                          byte[] mod,
                          byte[] exp)
                   throws java.lang.Exception
This public method uses the libray to made a polling based wait for card. This method calls private method wait4Card().

Throws:
An - exception showing where is the problem.
java.lang.Exception

DoorControl

public boolean DoorControl()
                    throws java.lang.Exception
Throws:
java.lang.Exception

verifySignature

public boolean verifySignature(byte[] Mod,
                               byte[] Exp,
                               byte[] clear,
                               byte[] signed)
                        throws java.lang.Exception
Throws:
java.lang.Exception

waitForCard

public void waitForCard()
                 throws java.lang.Exception
Throws:
java.lang.Exception

getCertificateList

public java.lang.String getCertificateList()
                                    throws java.lang.Exception
This public method gets the list of certificates stored in the card as a tagged String. This method calls private method getCertificateListNative() getCertificateListNative() .

Specified by:
getCertificateList in interface IJCCM
Returns:
An tagged String with the baisc information of the certificates stored in the card if any.
Throws:
An - exception showing where is the problem.
java.lang.Exception

getCertificateVectorList

public java.util.Vector getCertificateVectorList()
                                          throws java.lang.Exception
This public method gets the list of certificates stored in the card as CertBeans Vector. This method calls private method processCertificatesList(StreamTokenizer) processCertificatesList() .

Specified by:
getCertificateVectorList in interface IJCCM
Returns:
CertBeans Vector
Throws:
An - exception showing where is the problem.
java.lang.Exception

getCertificateBySerial

public java.lang.String getCertificateBySerial(byte[] serial)
                                        throws java.lang.Exception
This public method searchs for a Certificate by its serial. It uses Cryptoki library to access the card and, if the certificate its found, creates a temporal PEM file with it. If the certificate does not exit in the card or there are any kind of problems an exception is thrown. This method calls private method searchCertificateBySerial(byte[]) searchCertificateBySerial.

Specified by:
getCertificateBySerial in interface IJCCM
Returns:
An String with the absolut path of the PEM file.
Throws:
An - exception showing where is the problem.
java.lang.Exception

checkPrivateKeyOwnership

public boolean checkPrivateKeyOwnership(byte[] serial)
                                 throws java.lang.Exception
Specified by:
checkPrivateKeyOwnership in interface IJCCM
Throws:
java.lang.Exception

checkPrivateKeyOwnership

public boolean checkPrivateKeyOwnership(byte[] serial,
                                        byte[] pk)
                                 throws java.lang.Exception
Specified by:
checkPrivateKeyOwnership in interface IJCCM
Throws:
java.lang.Exception

dataSign

public java.lang.String dataSign(byte[] data,
                                 byte[] serial)
                          throws java.lang.Exception
This public method signs a data byte array with the private key of the certificate selected by serial This method calls private method signData(byte[], byte[], byte[]) signData().

Specified by:
dataSign in interface IJCCM
Returns:
signed data.
Throws:
An - exception showing where is the problem.
java.lang.Exception

main

public static void main(java.lang.String[] args)