CSymbianKeyStore Class Reference

class CSymbianKeyStore : public CActive

Inherits from

Public Member Functions
~CSymbianKeyStore()
IMPORT_C voidCreateRSAKey(TUint, const TDesC8 &)
IMPORT_C voidCreateUnifiedKeyStoreL()
voidExportRSAPublicKeyL()
IMPORT_C voidFindKey(const TDesC8 &, CKeyInfoBase::EKeyAlgorithm)
IMPORT_C TIntGetError()
IMPORT_C CCTKeyInfo::EKeyAlgorithmGetKeyAlgorithm()
IMPORT_C TUintGetKeySize()
IMPORT_C const TUint8 *GetSignedData(TUint *)
IMPORT_C TBoolGetVerifyResult()
IMPORT_C voidImportKey(const TDesC8 &, const TDesC8 &)
IMPORT_C CSymbianKeyStore *NewL()
IMPORT_C CSymbianKeyStore *NewLC()
voidPerformRSASignOperation()
voidPerformRSAVerifyOperationL()
IMPORT_C voidRSASignL(const TUint8 *, TUint)
IMPORT_C voidRSAVerifyL(const TUint8 *, TUint, const TUint8 *, TUint)
IMPORT_C TBoolRSAVerifyWithPublicKeyL(const TUint8 *, TUint, const TUint8 *, TUint, CSubjectPublicKeyInfo *)
IMPORT_C TInthasKey()
Protected Member Functions
voidDoCancel()
TInt RunError(TInt)
voidRunL()
Private Member Functions
CSymbianKeyStore()
voidConstructL()
voidFindMatchedKey()
voidGetRSASignatureL()
voidResetAndDestroyKeysArray()
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
enumTState {
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()

voidConstructL()[private]

By default Symbian 2nd phase constructor is private.

CreateRSAKey(TUint, const TDesC8 &)

IMPORT_C voidCreateRSAKey(TUintaSize,
const TDesC8 &aKeyName
)

Create RSA Key

Since
S60 v3.2

Parameters

TUint aSizeBit size of the key
const TDesC8 & aKeyNameName of the key

CreateUnifiedKeyStoreL()

IMPORT_C voidCreateUnifiedKeyStoreL()

Create Unified Key Store

Since
S60 v3.2

DoCancel()

voidDoCancel()[protected, virtual]

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

ExportRSAPublicKeyL()

voidExportRSAPublicKeyL()

Export public key if none present

Since
S60 v3.2

FindKey(const TDesC8 &, CKeyInfoBase::EKeyAlgorithm)

IMPORT_C voidFindKey(const TDesC8 &aLabel,
CKeyInfoBase::EKeyAlgorithmaAlgo
)

Find a key in the Unified Key Store

Since
S60 v3.2

Parameters

const TDesC8 & aLabelThe name of the key to be found
CKeyInfoBase::EKeyAlgorithm aAlgoThe algorithm of the key to be found

FindMatchedKey()

voidFindMatchedKey()[private]

To find matched key in the phase EFindingKeys

GetError()

IMPORT_C TIntGetError()

Get the error flag

Since
S60 v3.2

GetKeyAlgorithm()

IMPORT_C CCTKeyInfo::EKeyAlgorithmGetKeyAlgorithm()

Get the algorithm of the key stored

Since
S60 v3.2

GetKeySize()

IMPORT_C TUintGetKeySize()

Get the size of the key stored

Since
S60 v3.2

GetRSASignatureL()

voidGetRSASignatureL()[private]

Sets iSignature buffer

GetSignedData(TUint *)

IMPORT_C const TUint8 *GetSignedData(TUint *aLen)

Gets Signed data

Since
S60 v3.2

Parameters

TUint * aLensets length of signed data

GetVerifyResult()

IMPORT_C TBoolGetVerifyResult()

Gets verification result

Since
S60 v3.2

ImportKey(const TDesC8 &, const TDesC8 &)

IMPORT_C voidImportKey(const TDesC8 &aKeyData,
const TDesC8 &aKeyName
)

Import key

Since
S60 v3.2

Parameters

const TDesC8 & aKeyDataThe 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()

voidPerformRSASignOperation()

Perform RSA sign operation

Since
S60 v3.2

PerformRSAVerifyOperationL()

voidPerformRSAVerifyOperationL()

Perform RSA verify operation

Since
S60 v3.2

RSASignL(const TUint8 *, TUint)

IMPORT_C voidRSASignL(const TUint8 *aDataToSign,
TUintaLen
)

Opens RSA key for signing the data

Since
S60 v3.2

Parameters

const TUint8 * aDataToSignThe data to be signed
TUint aLenLength of the data

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

IMPORT_C voidRSAVerifyL(const TUint8 *aDataToVerify,
TUintaDataLen,
const TUint8 *aSig,
TUintaSigLen
)

Verify a RSA signed data

Since
S60 v3.2

Parameters

const TUint8 * aDataToVerifyThe signed data to be verified
TUint aDataLenLength of the signed data
const TUint8 * aSigA reference to the signature that signed the data
TUint aSigLenLength of the signature

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

IMPORT_C TBoolRSAVerifyWithPublicKeyL(const TUint8 *aDataToVerify,
TUintaDataLen,
const TUint8 *aSig,
TUintaSigLen,
CSubjectPublicKeyInfo *aSubPubKeyInfo
)

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

Since
S60 v3.2

Parameters

const TUint8 * aDataToVerifyThe signed data to be verified
TUint aDataLenLength of the signed data
const TUint8 * aSigA reference to the signature that signed the data
TUint aSigLenLength of the signature
CSubjectPublicKeyInfo * aSubPubKeyInfoA handle to the public key passed from a certificate

ResetAndDestroyKeysArray()

voidResetAndDestroyKeysArray()[private]

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

RunError(TInt)

TInt RunError(TIntaError)[protected, virtual]

Handles Leaves from RunL function.

Parameters

TInt aError

RunL()

voidRunL()[protected, virtual]

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

hasKey()

IMPORT_C TInthasKey()

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