CSymbianKeyStore Class Reference

class CSymbianKeyStore : public CActive

Inherits from

Public Member Functions
~CSymbianKeyStore ()
IMPORT_C void CreateRSAKey ( TUint , const TDesC8 &)
IMPORT_C void CreateUnifiedKeyStoreL ()
void ExportRSAPublicKeyL ()
IMPORT_C void FindKey (const TDesC8 &, CKeyInfoBase::EKeyAlgorithm )
IMPORT_C TInt GetError ()
IMPORT_C CCTKeyInfo::EKeyAlgorithm GetKeyAlgorithm ()
IMPORT_C TUint GetKeySize ()
IMPORT_C const TUint8 * GetSignedData ( TUint *)
IMPORT_C TBool GetVerifyResult ()
IMPORT_C void ImportKey (const TDesC8 &, const TDesC8 &)
IMPORT_C CSymbianKeyStore * NewL ()
IMPORT_C CSymbianKeyStore * NewLC ()
void PerformRSASignOperation ()
void PerformRSAVerifyOperationL ()
IMPORT_C void RSASignL (const TUint8 *, TUint )
IMPORT_C void RSAVerifyL (const TUint8 *, TUint , const TUint8 *, TUint )
IMPORT_C TBool RSAVerifyWithPublicKeyL (const TUint8 *, TUint , const TUint8 *, TUint , CSubjectPublicKeyInfo *)
IMPORT_C TInt hasKey ()
Protected Member Functions
void DoCancel ()
TInt RunError ( TInt )
void RunL ()
Private Member Functions
CSymbianKeyStore ()
void ConstructL ()
void FindMatchedKey ()
void GetRSASignatureL ()
void ResetAndDestroyKeysArray ()
Inherited Functions
CActive::CActive(TInt)
CActive::Cancel()
CActive::Deque()
CActive::Extension_(TUint,TAny *&,TAny *)
CActive::IsActive()const
CActive::IsAdded()const
CActive::Priority()const
CActive::SetActive()
CActive::SetPriority(TInt)
CActive::~CActive()
CBase::CBase()
CBase::Delete(CBase *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Member Enumerations
enum TState {
EUnitialized , EInitializingKeystore , EFindingKeys , ECreateKey , EImportKey , EOpenRSAKeyForSigning , EPerformRSASignOperation , EExportPublic
}
Inherited Enumerations
CActive:TPriority
Private Attributes
HBufC8 * iDataToSign
HBufC8 * iDataToVerify
TInt iError
RFs iFs
CCTKeyInfo * iKey
HBufC * iKeyLabelToFind
CUnifiedKeyStore * iKeyStore
RMPointerArray < CCTKeyInfo > iKeys
TBool iOutOfMemoryFlag
HBufC8 * iPublicKeyData
CRSASignature * iRSASignature
MRSASigner * iRSASigner
HBufC8 * iSignature
TState iState
TBool iVerifyResult
Inherited Attributes
CActive::iStatus

Constructor & Destructor Documentation

CSymbianKeyStore()

CSymbianKeyStore ( ) [private]

C++ default constructor.

~CSymbianKeyStore()

~CSymbianKeyStore ( ) [virtual]

Destructor.

Member Functions Documentation

ConstructL()

void ConstructL ( ) [private]

By default Symbian 2nd phase constructor is private.

CreateRSAKey(TUint, const TDesC8 &)

IMPORT_C void CreateRSAKey ( TUint aSize,
const TDesC8 & aKeyName
)

Create RSA Key

Since
S60 v3.2

Parameters

TUint aSize Bit size of the key
const TDesC8 & aKeyName Name of the key

CreateUnifiedKeyStoreL()

IMPORT_C void CreateUnifiedKeyStoreL ( )

Create Unified Key Store

Since
S60 v3.2

DoCancel()

void DoCancel ( ) [protected, virtual]

This function is called as part of the active object's Cancel() .

ExportRSAPublicKeyL()

void ExportRSAPublicKeyL ( )

Export public key if none present

Since
S60 v3.2

FindKey(const TDesC8 &, CKeyInfoBase::EKeyAlgorithm)

IMPORT_C void FindKey ( const TDesC8 & aLabel,
CKeyInfoBase::EKeyAlgorithm aAlgo
)

Find a key in the Unified Key Store

Since
S60 v3.2

Parameters

const TDesC8 & aLabel The name of the key to be found
CKeyInfoBase::EKeyAlgorithm aAlgo The algorithm of the key to be found

FindMatchedKey()

void FindMatchedKey ( ) [private]

To find matched key in the phase EFindingKeys

GetError()

IMPORT_C TInt GetError ( )

Get the error flag

Since
S60 v3.2

GetKeyAlgorithm()

IMPORT_C CCTKeyInfo::EKeyAlgorithm GetKeyAlgorithm ( )

Get the algorithm of the key stored

Since
S60 v3.2

GetKeySize()

IMPORT_C TUint GetKeySize ( )

Get the size of the key stored

Since
S60 v3.2

GetRSASignatureL()

void GetRSASignatureL ( ) [private]

Sets iSignature buffer

GetSignedData(TUint *)

IMPORT_C const TUint8 * GetSignedData ( TUint * aLen )

Gets Signed data

Since
S60 v3.2

Parameters

TUint * aLen sets length of signed data

GetVerifyResult()

IMPORT_C TBool GetVerifyResult ( )

Gets verification result

Since
S60 v3.2

ImportKey(const TDesC8 &, const TDesC8 &)

IMPORT_C void ImportKey ( const TDesC8 & aKeyData,
const TDesC8 & aKeyName
)

Import key

Since
S60 v3.2

Parameters

const TDesC8 & aKeyData The key data to import, ASN.1 DER encoded PKCS#8 Name of the key
const TDesC8 & aKeyName

NewL()

IMPORT_C CSymbianKeyStore * NewL ( ) [static]

Create new object.

Since
S60 v3.2

NewLC()

IMPORT_C CSymbianKeyStore * NewLC ( ) [static]

Create new object and put it on clean stack.

Since
S60 v3.2

PerformRSASignOperation()

void PerformRSASignOperation ( )

Perform RSA sign operation

Since
S60 v3.2

PerformRSAVerifyOperationL()

void PerformRSAVerifyOperationL ( )

Perform RSA verify operation

Since
S60 v3.2

RSASignL(const TUint8 *, TUint)

IMPORT_C void RSASignL ( const TUint8 * aDataToSign,
TUint aLen
)

Opens RSA key for signing the data

Since
S60 v3.2

Parameters

const TUint8 * aDataToSign The data to be signed
TUint aLen Length of the data

RSAVerifyL(const TUint8 *, TUint, const TUint8 *, TUint)

IMPORT_C void RSAVerifyL ( const TUint8 * aDataToVerify,
TUint aDataLen,
const TUint8 * aSig,
TUint aSigLen
)

Verify a RSA signed data

Since
S60 v3.2

Parameters

const TUint8 * aDataToVerify The signed data to be verified
TUint aDataLen Length of the signed data
const TUint8 * aSig A reference to the signature that signed the data
TUint aSigLen Length of the signature

RSAVerifyWithPublicKeyL(const TUint8 *, TUint, const TUint8 *, TUint, CSubjectPublicKeyInfo *)

IMPORT_C TBool RSAVerifyWithPublicKeyL ( const TUint8 * aDataToVerify,
TUint aDataLen,
const TUint8 * aSig,
TUint aSigLen,
CSubjectPublicKeyInfo * aSubPubKeyInfo
)

Verify an RSA signed data with a public key passed from a certificate

Since
S60 v3.2

Parameters

const TUint8 * aDataToVerify The signed data to be verified
TUint aDataLen Length of the signed data
const TUint8 * aSig A reference to the signature that signed the data
TUint aSigLen Length of the signature
CSubjectPublicKeyInfo * aSubPubKeyInfo A handle to the public key passed from a certificate

ResetAndDestroyKeysArray()

void ResetAndDestroyKeysArray ( ) [private]

Release all resources kept in iKeys array (exept for iKey which is released separetly) and empty iKeys array

RunError(TInt)

TInt RunError ( TInt aError ) [protected, virtual]

Handles Leaves from RunL function.

Parameters

TInt aError

RunL()

void RunL ( ) [protected, virtual]

From CActive Callback function, invoked to handle responses from the server

hasKey()

IMPORT_C TInt hasKey ( )

Check if a key is found in the Unified Key Store

Since
S60 v3.2

Member Enumerations Documentation

Enum TState

State of active object. EUnitialized standard state EInitializingKeystore during initialize keystore EFindingKeys during finding keys ECreateKey during creating key EImportKey during importing key EOpenRsaKeyForSigning during preparing key for signing EPerformRSASignOperation during signing EExportPublic during exporting public key

Enumerators

EUnitialized
EInitializingKeystore
EFindingKeys
ECreateKey
EImportKey
EOpenRSAKeyForSigning
EPerformRSASignOperation
EExportPublic

Member Data Documentation

HBufC8 * iDataToSign

HBufC8 * iDataToSign [private]

Store the data to be signed

HBufC8 * iDataToVerify

HBufC8 * iDataToVerify [private]

Store the data to be verified

TInt iError

TInt iError [private]

Error flag

RFs iFs

RFs iFs [private]

A reference to the File Server Client

CCTKeyInfo * iKey

CCTKeyInfo * iKey [private]

Store the generated key

HBufC * iKeyLabelToFind

HBufC * iKeyLabelToFind [private]

To store the key label to find

CUnifiedKeyStore * iKeyStore

CUnifiedKeyStore * iKeyStore [private]

A reference to the CUnifiedKeyStore class

RMPointerArray< CCTKeyInfo > iKeys

RMPointerArray < CCTKeyInfo > iKeys [private]

Store the keys found

TBool iOutOfMemoryFlag

TBool iOutOfMemoryFlag [private]

To check if it was out of memory during previous verify operation

HBufC8 * iPublicKeyData

HBufC8 * iPublicKeyData [private]

Contain the exported public key

CRSASignature * iRSASignature

CRSASignature * iRSASignature [private]

Contain the result of the RSA Signer

MRSASigner * iRSASigner

MRSASigner * iRSASigner [private]

Store the RSA Signer

HBufC8 * iSignature

HBufC8 * iSignature [private]

Store the signed signature

TState iState

TState iState [private]

An internal state

TBool iVerifyResult

TBool iVerifyResult [private]

Store the result of signature verification