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

com.ibm.opencard.signature
Class MFCKeyGenService

java.lang.Object
  |
  +--opencard.core.service.CardService
        |
        +--com.ibm.opencard.service.MFCCardService
              |
              +--com.ibm.opencard.signature.MFCSignatureService
                    |
                    +--com.ibm.opencard.signature.MFCKeyImportService
                          |
                          +--com.ibm.opencard.signature.MFCKeyGenService

public class MFCKeyGenService
extends MFCKeyImportService
implements KeyGenerationCardService

MFCKeyGenService extends the base class MFCKeyImportService and additionally implements the KeyGenerationCardService interface defined by OCF. Instances of MFCKeyFenService or one of its subclasses, which talk to a specific physical smart card, delegate execution of the functionality defined in KeyGenerationCardService to a (singleton) driver for that card, which implements interface MFCKeyGenImpl for a specific card.

Version:
$Id: MFCKeyGenService.java,v 1.1 1999/12/02 16:06:09 damke Exp $
See Also:
MFCCardService, SignatureCardService

Field Summary
protected  int cos
           
protected  MFCFileAccessImpl faImpl
           
protected  MFCKeyGenImpl keyGenImpl
          Instances of MFCSKeyGenServices share a single instance of a card service implementation class implementing MFCKeyGenImpl.
 
Fields inherited from class com.ibm.opencard.signature.MFCKeyImportService
keyConv, keyImpImpl
 
Fields inherited from class com.ibm.opencard.signature.MFCSignatureService
kiParser, sigImpl
 
Fields inherited from class com.ibm.opencard.service.MFCCardService
card_type
 
Constructor Summary
MFCKeyGenService()
          Creates a new key generation service for MFC smartcards.
 
Method Summary
 void generateKeyPair(PrivateKeyRef privateDest, PublicKeyRef publicDest, int strength, java.lang.String keyAlgorithm)
          Generate a pair of PKA keys on card.
protected  MFCFileAccessImpl getFileAccessImpl()
          get a file service implementation
protected  void initialize(CardServiceScheduler scheduler, SmartCard smartcard, boolean blocking)
          Initializes this service.
 void initKeyGen(MFCKeyGenParameter parameter)
          Initializes this service from encapsulated arguments.
 java.security.PublicKey readPublicKey(PublicKeyRef publicKey, java.lang.String keyAlgorithm)
          Read a public key that was generated on the card from the card.
 
Methods inherited from class com.ibm.opencard.signature.MFCKeyImportService
importAndValidateKey, importAndValidatePrivateKey, importAndValidatePublicKey, importKey, importKeyInternal, importPrivateKey, importPublicKey, initKeyImport, validateKeyInternal
 
Methods inherited from class com.ibm.opencard.signature.MFCSignatureService
initSignature, satisfyAccessConditions, signData, signData, signDataInternal, signHash, signHash, signHashInternal, verifySignedData, verifySignedData, verifySignedDataInternal, verifySignedHash, verifySignedHash, verifySignedHashInternal
 
Methods inherited from class com.ibm.opencard.service.MFCCardService
allocateCardChannel, checkFileArg, getMFCChannel, getRoot, initGeneric, provideCredentials, releaseCardChannel, selectObject, setCHVDialog, setParentChannel
 
Methods inherited from class opencard.core.service.CardService
getCard, getCardChannel, getCHVDialog, setCardChannel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

keyGenImpl

protected MFCKeyGenImpl keyGenImpl
Instances of MFCSKeyGenServices share a single instance of a card service implementation class implementing MFCKeyGenImpl.

cos

protected int cos

faImpl

protected MFCFileAccessImpl faImpl
Constructor Detail

MFCKeyGenService

public MFCKeyGenService()
Creates a new key generation service for MFC smartcards. The service cannot be used until it has been initialized by invoking initialize. If this service has to be initialized as part of a derived service, initKeyGen has to be invoked instead.
See Also:
initialize(opencard.core.service.CardServiceScheduler, opencard.core.service.SmartCard, boolean), initKeyGen(com.ibm.opencard.signature.MFCKeyGenParameter)
Method Detail

initialize

protected void initialize(CardServiceScheduler scheduler,
                          SmartCard smartcard,
                          boolean blocking)
                   throws CardServiceException
Initializes this service. This is an entry point for initializing the MFC signature service. It invokes initKeyGen to perform the actual initialization. Derived services must not invoke this method, but have to invoke initKeyGen directly.
Parameters:
scheduler - where to allocate channels
smartcard - which smartcard to contact
blocking - whether operation shall be blocking
Throws:
CardServiceException - any subclass of CardServiceException
Overrides:
initialize in class MFCKeyImportService
See Also:
initKeyGen(com.ibm.opencard.signature.MFCKeyGenParameter), MFCCardService.initialize(opencard.core.service.CardServiceScheduler, opencard.core.service.SmartCard, boolean)

initKeyGen

public final void initKeyGen(MFCKeyGenParameter parameter)
                      throws CardServiceException
Initializes this service from encapsulated arguments. This method initializes the local attributes and invokes initKeyImport in the base class.
Parameters:
parameter - an object encapsulating the parameters to this service
Throws:
CardServiceException - if the initialization failed. With the current implementation, this cannot happen.
See Also:
MFCKeyGenParameter, MFCKeyImportService.initKeyImport(com.ibm.opencard.signature.MFCKeyImportParameter)

generateKeyPair

public void generateKeyPair(PrivateKeyRef privateDest,
                            PublicKeyRef publicDest,
                            int strength,
                            java.lang.String keyAlgorithm)
                     throws CardServiceException,
                            java.security.InvalidKeyException,
                            CardTerminalException
Generate a pair of PKA keys on card.
Specified by:
generateKeyPair in interface KeyGenerationCardService
Throws:
java.security.InvalidKeyException - Thrown when the key files do not match the requested strength or algorithm.
CardServiceException - Thrown when the card does not support the requested strength or algorithm.
CardTerminalException - any subclass of CardTerminalException

getFileAccessImpl

protected MFCFileAccessImpl getFileAccessImpl()
get a file service implementation

readPublicKey

public java.security.PublicKey readPublicKey(PublicKeyRef publicKey,
                                             java.lang.String keyAlgorithm)
                                      throws CardServiceException,
                                             java.security.InvalidKeyException,
                                             CardTerminalException
Read a public key that was generated on the card from the card.
Specified by:
readPublicKey in interface KeyGenerationCardService
Throws:
java.security.InvalidKeyException - Thrown when the key files do not match the requested algorithm.
CardServiceException - any subclass of CardServiceException
CardTerminalException - any subclass of CardTerminalException