SCM iOS API
Token Class Reference

Class represents connection to a smart card (or more generally, any cryptographic device). Token objects are obtained by calling the Reader#connect: method. More...

Inherits NSObject.

Instance Methods

(NSArray *) - pins
 
(Reader *) - getReader
 
(NSString *) - getModel
 
(NSString *) - getSerialNumber
 
(NSString *) - getLabel
 
(NSString *) - getManufacturer
 
(BOOL) - isInitialized
 
(BOOL) - hasProtectedAuthPath
 
(void) - getObjects:
 
(void) - generateKeyPair:completionHandler:
 

Detailed Description

Class represents connection to a smart card (or more generally, any cryptographic device). Token objects are obtained by calling the Reader#connect: method.

Note that the constructor is not intended to be called by user code. Such objects are constructed internally by the API.

Method Documentation

◆ generateKeyPair:completionHandler:()

- (void) generateKeyPair: (NSNumber *)  keyLength
completionHandler: (void(^)(NSDictionary *keyPair, NSError *error))  completionHandler 

Generates a new RSA key pair (a public key and a private key) in the card.

Parameters
keyLengththe length, in bits, of the new key to generate.
completionHandlerthe completion handler block to be called as soon as the key pairs are retrieved. The completion handler is executed on the main queue, and takes the following parameters :
  • keyPair the key pair generated, organized as an NSdictionnray (with keys privateKey and publicKey)
  • error nil if operation was completed successfully; otherwise an NSError encapsulates the reason of failure.

◆ getLabel()

- (NSString *) getLabel

Gets the token label name.

Returns
the label name.

◆ getManufacturer()

- (NSString *) getManufacturer

Gets the token manufacturer name.

Returns
the manufacturer name.

◆ getModel()

- (NSString *) getModel

Gets the token model name.

Returns
the model name.

◆ getObjects:()

- (void) getObjects: (void(^)(NSArray *listObjects, NSError *error))  completionHandler

Retrieves all objects found in the token (certificates and keys).

Remarks
Note that private objects may not be returned if the associated PIN has not been verified previously.
Also take in consideration that the API does not internally keep references to the retrieved obejcts, and calling this method will always return newly created TokenObject instances, even if the objects have been previously retrieved.
To check whether two TokenObject instances refer to the same physical object in the card, the
isEqual:
method can be used.d
Parameters
completionHandlerthe completion handler block to be called as soon as the objets are retrieved. The completion handler is executed on the main queue, and takes the following parameters :
  • listObjects the list of TokenObject items.
  • error nil if the objects were retrieved successfully; otherwise an NSError encapsulates the reason of failure.

◆ getReader()

- (Reader *) getReader

Gets the Reader object from which this token is issued.

Returns
the Reader object.

◆ getSerialNumber()

- (NSString *) getSerialNumber

Gets the token serial number.

Returns
the token serial number..

◆ hasProtectedAuthPath()

- (BOOL) hasProtectedAuthPath

Returns YES if this token allows user authentication through a hardware protected path (like a PIN pad reader, or using biometric recognition).

Returns
YES if this token allows user authentication through a hardware protected path; NO otherwise.

◆ isInitialized()

- (BOOL) isInitialized

Returns YES if this token has been initialized.

Returns
YES if this token has been initialized; NO otherwise.

◆ pins()

- (NSArray *) pins

Returns an array of Pin objects describing all the PINs available with this card.

Returns
a list of Pin objects.

The documentation for this class was generated from the following files: