#include <ct/mcttoken.h>
Link against: ctframework.lib
class MCTToken |
Public Member Enumerations | |
---|---|
enum | TTokenInformation { EVersion, ESerialNo, EManufacturer } |
Public Member Functions | |
---|---|
void | AddRef() |
IMPORT_C void | CancelGetInterface() |
virtual IMPORT_C void | CancelNotify() |
IMPORT_C void | GetInterface(TUid, MCTTokenInterface *&, TRequestStatus &) |
pure virtual TCTTokenHandle | Handle() |
pure virtual const TDesC & | Information(TTokenInformation) |
pure virtual const TDesC & | Label() |
virtual IMPORT_C void | NotifyOnRemoval(TRequestStatus &) |
IMPORT_C void | Release() |
pure virtual MCTTokenType & | TokenType() |
Protected Member Functions | |
---|---|
pure virtual | ~MCTToken() |
pure virtual TBool | DoCancelGetInterface() |
pure virtual void | DoGetInterface(TUid, MCTTokenInterface *&, TRequestStatus &) |
virtual IMPORT_C void | DoRelease() |
pure virtual TInt & | ReferenceCount() |
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.)
Available information strings for the token.
Enumerator | Value | Description |
---|---|---|
EVersion |
Version | |
ESerialNo |
Serial number | |
EManufacturer |
Manufacturer |
~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.
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().
IMPORT_C void | CancelGetInterface | ( | ) |
Cancels an asynchronous GetInterface() operation.
The operation completes with KErrCancel.
Cancel a GetInterface operation
IMPORT_C void | CancelNotify | ( | ) | [virtual] |
Cancels an asynchronous NotifyOnRemoval() operation.
The operation completes with KErrCancel.
TBool | DoCancelGetInterface | ( | ) | [protected, pure virtual] |
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.
See also: GetInterface
Parameters | |
---|---|
aRequiredInterface | The UID of the interface that should be returned. |
aReturnedInterface | On success, this will be set to a pointer to the returned interface. |
aStatus | The request status object; contains the result of the GetInterface() request when complete. Set to KErrCancel if an outstanding request is cancelled. |
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.
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 | |
---|---|
aRequiredInterface | The UID of the interface that should be returned. |
aReturnedInterface | On success, this will be set to a pointer to the returned interface. |
aStatus | The request status object; contains the result of the GetInterface() request when complete. Set to KErrCancel if an outstanding request is cancelled. |
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.
const TDesC & | Information | ( | TTokenInformation | aRequiredInformation | ) | [pure virtual] |
Gets the specified information string about the token. The default implementation returns an empty descriptor.
const TDesC & | Label | ( | ) | [pure virtual] |
Gets a label for the token.
This should be the same as the descriptor returned by MCTTokenType::List().
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 | |
---|---|
aStatus | The request status object; contains the result of the NotifyOnRemoval() request when complete. Set to KErrCancel if an outstanding request is cancelled. |
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.
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.
MCTTokenType & | TokenType | ( | ) | [pure virtual] |
Gets the associated token type.