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
Public Member Functions
voidAddRef()
IMPORT_C voidCancelGetInterface()
IMPORT_C voidCancelNotify()
IMPORT_C voidGetInterface(TUid, MCTTokenInterface *&, TRequestStatus &)
TCTTokenHandle Handle()
const TDesC &Information(TTokenInformation)
const TDesC &Label()
IMPORT_C voidNotifyOnRemoval(TRequestStatus &)
IMPORT_C voidRelease()
MCTTokenType &TokenType()
Protected Member Functions
~MCTToken()
TBool DoCancelGetInterface()
voidDoGetInterface(TUid, MCTTokenInterface *&, TRequestStatus &)
IMPORT_C voidDoRelease()
TInt &ReferenceCount()
Private Member Functions
voidObjectCreated()
Public Member Enumerations
enumTTokenInformation { EVersion, ESerialNo, EManufacturer }

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()

voidAddRef()[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 voidCancelGetInterface()

Cancels an asynchronous GetInterface() operation.

The operation completes with KErrCancel.

Cancel a GetInterface operation

CancelNotify()

IMPORT_C voidCancelNotify()[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 &)

voidDoGetInterface(TUidaRequiredInterface,
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 aRequiredInterfaceThe UID of the interface that should be returned.
MCTTokenInterface *& aReturnedInterfaceOn success, this will be set to a pointer to the returned interface.
TRequestStatus & aStatusThe request status object; contains the result of the GetInterface() request when complete. Set to KErrCancel if an outstanding request is cancelled.

DoRelease()

IMPORT_C voidDoRelease()[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 voidGetInterface(TUidaRequiredInterface,
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 aRequiredInterfaceThe UID of the interface that should be returned.
MCTTokenInterface *& aReturnedInterfaceOn success, this will be set to a pointer to the returned interface.
TRequestStatus & aStatusThe 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(TTokenInformationaRequiredInformation)[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 voidNotifyOnRemoval(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 & aStatusThe request status object; contains the result of the NotifyOnRemoval() request when complete. Set to KErrCancel if an outstanding request is cancelled.

ObjectCreated()

voidObjectCreated()[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 voidRelease()

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