OpenCard  
 
OCF, the OpenCard Framework is a standard Java framework for working with Smart Cards.  
 

com.ibm.opencard.access
Class MFCPKAuthenticator

java.lang.Object
  |
  +--com.ibm.opencard.access.MFCSecurityHelper
        |
        +--com.ibm.opencard.access.MFC35Authenticator
              |
              +--com.ibm.opencard.access.MFCPKAuthenticator

public class MFCPKAuthenticator
extends MFC35Authenticator

An authenticator for MFC 4.0 and above smartcards that support PKA keys for authentication This helper of MFCCardAccessor is responsible to authenticate an application to the smartcard. It uses the MFC card's external authenticate command to do this. The key required for the respective authentication number has to be provided by the application as a SignCredential.

Version:
$Id: MFCPKAuthenticator.java,v 1.1 1999/12/02 16:06:01 damke Exp $
See Also:
SignCredential

Constructor Summary
MFCPKAuthenticator(MFCCodes codes, int cos)
          Instantiates a new authenticator for MFC 4.0 and above PKA smartcards.
 
Method Summary
protected  MFCSignatureImpl getKeyInfoImpl()
          Returs the card specific impl to read key info
protected  MFCKeyInfoRParser getKIParser()
          Returns the card specific key info parser
protected  MFCSigCodes getMFCSigCodes()
          Returns the PKA command codes for the smartcard.
protected  byte[] isoPadding(byte[] pbIn, int cbOut)
          perform iso 9796 padding ported from C code obtained from Michael Deindl
 boolean performAuthentication(MFCCardChannel channel, int number)
          Performs external authentication.
protected  byte[] pkcs1Padding(byte[] data, int length)
          Perform pkcs#1 padding
protected  byte[] zeroPadding(byte[] data, int length)
          Perform zero padding
 
Methods inherited from class com.ibm.opencard.access.MFC35Authenticator
sendAuthentication
 
Methods inherited from class com.ibm.opencard.access.MFCSecurityHelper
getMFCCodes, lookupSecureCredential, lookupSignCredential, provideRandom, requestRandom, setCredentials
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MFCPKAuthenticator

public MFCPKAuthenticator(MFCCodes codes,
                          int cos)
Instantiates a new authenticator for MFC 4.0 and above PKA smartcards.
Parameters:
codes - the command codes for the smartcard
Method Detail

getMFCSigCodes

protected final MFCSigCodes getMFCSigCodes()
Returns the PKA command codes for the smartcard.
Returns:
the card-specific PKA command codes passed to the constructor

getKIParser

protected final MFCKeyInfoRParser getKIParser()
Returns the card specific key info parser

getKeyInfoImpl

protected final MFCSignatureImpl getKeyInfoImpl()
Returs the card specific impl to read key info

performAuthentication

public boolean performAuthentication(MFCCardChannel channel,
                                     int number)
                              throws CardServiceInvalidCredentialException,
                                     CardServiceUnexpectedResponseException,
                                     CardTerminalException
Performs external authentication.
Parameters:
channel - the contact to the smartcard
number - the identifier of the authentication key
Throws:
CardServiceInvalidCredentialException - The authentication was not accepted since the key used is wrong or blocked.
CardServiceUnexpectedResponseException - The authentication failed due to some other reason.
CardTerminalException - The terminal encountered an error.
Overrides:
performAuthentication in class MFC35Authenticator

zeroPadding

protected final byte[] zeroPadding(byte[] data,
                                   int length)
Perform zero padding

pkcs1Padding

protected final byte[] pkcs1Padding(byte[] data,
                                    int length)
Perform pkcs#1 padding

isoPadding

protected final byte[] isoPadding(byte[] pbIn,
                                  int cbOut)
perform iso 9796 padding ported from C code obtained from Michael Deindl
Parameters:
pbIn - data to be padded
cbOut - length of data after padding
Returns:
padded byte array