tags:

views:

125

answers:

2

hi,

i am using encrypt function of cryptography api(fun declared as virtual)

//fun declaration
TBool EncryptL(const TDesC8 &aInput, TDes8 &aOutput);

//function calling
TBuf8<10> text;
TBuf8<10> cipher;
text.Copy(_L("Hello"));
iEncryptor.EncryptL(text,cipher); it shows error expression syntax error

//fun definition
TBool CRSAAlgo::EncryptL(const TDesC8 &aInput,TDes8 &aOutput) 
{
    if(iEncryptor)
    {
        TInt len = iEncryptor->MaxInputLength();
    }
}

i want to know what is exact problem

A: 

As you did not post the exact error message you get from the compiler I have to guess.

I assume the problem is that the EncryptL function you show expects to get arguments of type TDesC8 and you pass a TBuf8<10> to it. Unless TDesC8 were a typedef to TBuf8<10> these are different and therefore for the compiler incompatible types.

Ypou are also using iEncryptor once as a pointer: iEncryptor->MaxInputLength(); and at the location where you see the error as an object: iEncryptor.EncryptL(text,cipher);. Only one form can be correct. As we don't have more code from you I don't know which, but given the fact that the latter has the error I suspect the latter.

lothar
+1  A: 

The main issue here, the reason your compiler complains is that you are using iEncryptor as an object or a reference, while it probably is a C++ pointer.

To move to the next stage, try using:

iEncryptor->EncryptL(text,cipher);

QuickRecipesOnSymbianOS