MCTToken Class Reference

#include <ct/mcttoken.h>

Link against: ctframework.lib

class MCTToken
Public Member Enumerations
enumTTokenInformation { EVersion, ESerialNo, EManufacturer }
Public Member Functions
voidAddRef()
IMPORT_C voidCancelGetInterface()
virtual IMPORT_C voidCancelNotify()
IMPORT_C voidGetInterface(TUid, MCTTokenInterface *&, TRequestStatus &)
pure virtual TCTTokenHandle Handle()
pure virtual const TDesC &Information(TTokenInformation)
pure virtual const TDesC &Label()
virtual IMPORT_C voidNotifyOnRemoval(TRequestStatus &)
IMPORT_C voidRelease()
pure virtual MCTTokenType &TokenType()
Protected Member Functions
pure virtual ~MCTToken()
pure virtual TBool DoCancelGetInterface()
pure virtual voidDoGetInterface(TUid, MCTTokenInterface *&, TRequestStatus &)
virtual IMPORT_C voidDoRelease()
pure virtual TInt &ReferenceCount()

Detailed Description

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

Member Enumeration Documentation

Enum TTokenInformation

Available information strings for the token.

EnumeratorValueDescription
EVersion

Version

ESerialNo

Serial number

EManufacturer

Manufacturer

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 Function 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.

See also: CancelGetInterface

Returns: ETrue if there is an token interface running; EFalse, otherwise.

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.

See also: GetInterface

ParameterDescription
aRequiredInterfaceThe UID of the interface that should be returned.
aReturnedInterfaceOn success, this will be set to a pointer to the returned interface.
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.

ParameterDescription
aRequiredInterfaceThe UID of the interface that should be returned.
aReturnedInterfaceOn success, this will be set to a pointer to the returned interface.
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.

Returns: The handle of the token.

Information ( TTokenInformation )

const TDesC &Information(TTokenInformationaRequiredInformation)[pure virtual]

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

Label ( )

const TDesC &Label()[pure virtual]

Gets a label for the token.

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

Returns: The label to the token type.

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.

ParameterDescription
aStatusThe request status object; contains the result of the NotifyOnRemoval() request when complete. Set to KErrCancel if an outstanding request is cancelled.

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.

Returns: A reference to the variable used as a reference counter.

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.

Returns: The associated token type.