MCTToken Class Reference

class MCTToken

The base class for a token.

Token types must implement this class. It is created from a MCTTokenType using MCTTokenType::OpenToken() .

A token represents one instance of a particular kind of cryptographic module; for instance, on a device with two WIMs, each WIM is a token. The token contains several interfaces, representing particular kinds of functions supported by the token (e.g. certificate management, key management, etc.)

Since
v7.0

Constructor & Destructor Documentation

~MCTToken()

~MCTToken ( ) [protected, inline, pure virtual]

The destructor is protected so that users of the interface have to use the Release() function.

Destructor.

Frees all resources owned by the object, prior to its destruction.

Member Functions Documentation

AddRef()

void AddRef ( ) [inline]

Allows the client to add a reference to the token (for example, when a reference to a token is copied elsewhere).

Does not need to be called if token is referenced through OpenToken().

CancelGetInterface()

IMPORT_C void CancelGetInterface ( )

Cancels an asynchronous GetInterface() operation.

The operation completes with KErrCancel.

Cancel a GetInterface operation

CancelNotify()

IMPORT_C void CancelNotify ( ) [virtual]

Cancels an asynchronous NotifyOnRemoval() operation.

The operation completes with KErrCancel.

DoCancelGetInterface()

TBool DoCancelGetInterface ( ) [protected, pure virtual]

Implements an asynchronous CancelGetInterface() request.

CancelGetInterface

DoGetInterface(TUid, MCTTokenInterface *&, TRequestStatus &)

void DoGetInterface ( TUid aRequiredInterface,
MCTTokenInterface *& aReturnedInterface,
TRequestStatus & aStatus
) [protected, pure virtual]

Implementation for getting a token interface.

This is called by GetInterface() .

This is an asynchronous request.

GetInterface

Parameters

TUid aRequiredInterface The UID of the interface that should be returned.
MCTTokenInterface *& aReturnedInterface On success, this will be set to a pointer to the returned interface.
TRequestStatus & aStatus The request status object; contains the result of the GetInterface() request when complete. Set to KErrCancel if an outstanding request is cancelled.

DoRelease()

IMPORT_C void DoRelease ( ) [protected, virtual]

Destroys the token object.

This function is called when Release() has determined that the object is ready to be destroyed.

The default implementation just does a 'delete this', but classes can override that if they want different behaviour.

It should destroy the token; it MUST NOT release the token type, as Release() will do that.

GetInterface(TUid, MCTTokenInterface *&, TRequestStatus &)

IMPORT_C void GetInterface ( TUid aRequiredInterface,
MCTTokenInterface *& aReturnedInterface,
TRequestStatus & aStatus
)

Gets a token interface, or NULL if it's not supported by this token.

This is an asynchronous request.

Parameters

TUid aRequiredInterface The UID of the interface that should be returned.
MCTTokenInterface *& aReturnedInterface On success, this will be set to a pointer to the returned interface.
TRequestStatus & aStatus The request status object; contains the result of the GetInterface() request when complete. Set to KErrCancel if an outstanding request is cancelled.

Handle()

TCTTokenHandle Handle ( ) [pure virtual]

Gets the token's handle.

This can be used to identify a token to another process.

See the documentation of TCTTokenHandle for an explanation of the use of token handles.

Information(TTokenInformation)

const TDesC & Information ( TTokenInformation aRequiredInformation ) [pure virtual]

Gets the specified information string about the token. The default implementation returns an empty descriptor.

Parameters

TTokenInformation aRequiredInformation

Label()

const TDesC & Label ( ) [pure virtual]

Gets a label for the token.

This should be the same as the descriptor returned by MCTTokenType::List() .

NotifyOnRemoval(TRequestStatus &)

IMPORT_C void NotifyOnRemoval ( TRequestStatus & aStatus ) [virtual]

Notifies the client when the token has been removed.

The base class assumes the token is not removable, and so does nothing. Removable tokens must implement these functions.

This is an asynchronous request.

Parameters

TRequestStatus & aStatus The request status object; contains the result of the NotifyOnRemoval() request when complete. Set to KErrCancel if an outstanding request is cancelled.

ObjectCreated()

void ObjectCreated ( ) [private]

ReferenceCount()

TInt & ReferenceCount ( ) [protected, pure virtual]

Gets a reference to the variable used as a reference counter.

The implementer should initialise this to 0. The value of the reference count should be treated as opaque by the implementer.

Release()

IMPORT_C void Release ( )

Destroys the object.

The interface should be destroyed via this method as the destructor is protected.

The token implements reference counting, with one count for itself and one for every opened interface. Once the count reaches 0, it releases its count with the token type.

TokenType()

MCTTokenType & TokenType ( ) [pure virtual]

Gets the associated token type.

Member Enumerations Documentation

Enum TTokenInformation

Available information strings for the token.

Enumerators

EVersion

Version

ESerialNo

Serial number

EManufacturer

Manufacturer