ESYAE-imza Kütüphaneleri

User Tools

Site Tools


en:esya:smartcard:smartcardmanager

SmartCardManager

You can find the class SmartCardManager in the sample codes section of the distributed package. This class is published as open source in order for you to customize it according to your own needs. Basic signature operations can be performed by this class which has the following functions:

  1. It performs operations with the certificate in the smartcard automatically if there is only one smartcard and one certificate in the card.
  2. It prompts the user to select card if more than one card are plugged in. If there are multiple certificates in the card then it prompts certificate selection.
  3. If APDU communication is supprted by the card, it can use APDU commands. C# API does not support APDU and only uses pkcs11 to access smartcard.
  4. Repetitive operations with the samecard is performed fast tahnks to the retrieval of the certificate from memory.
  5. After a smartcard operation, if the card is taken out then card and certificate selection are reprompted upon next card operation.

A sample usage is as follows:

//Enable APDU usage
SmartCardManager.useAPDU(true);
//Connect a smartcard. If more than one smart card connected, user selects one of them
SmartCardManager scm = SmartCardManager.getInstance();
		
//Get qualified certificate. If more than one qualified certificate, user selects one of them.
ECertificate cert = scm.getSignatureCertificate(true, false);
//Create signer
BaseSignersigner = scm.getSigner("12345", cert);
		
/**
 * Create signature
 */
	
//If not sign again with selected card logout.
scm.logout();
//To select new card and new certificate, call reset.
scm.reset();

The method getInstance() checks if a new card has been plugged in or the existing card has been taken out. Before every signing operation call the method getInstance() of SmartCardManager. In the sample code above, the operations are sequentially in a short period of time, the object is retrieved just once.

en/esya/smartcard/smartcardmanager.txt · Son değiştirilme: 2013/09/12 08:42 Değiştiren: Dindar Öz