About the encryption method

I am using api cryptography encryption function (fun is 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 the exact problem is

0


a source to share


2 answers


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

To move on to the next step, try using:



iEncryptor-> EncryptL (text, cipher);

+1


a source


Since you haven't posted the exact error message you are getting from the compiler, I have to guess.

I guess the problem is that the EncryptL function you are showing is expecting to receive arguments of type TDesC8 and you are passing TBuf8 <10> to it. If TDesC8 was not a typedef for TBuf8 <10, then they are different and therefore for incompatible compiler types.



Ypou also uses iEncryptor once as a pointer: iEncryptor-> MaxInputLength (); and in the place where you see the error as an object: iEncryptor.EncryptL (text, cipher) ;. Only one shape can be correct. Since we don't have any more code from you, I don't know what, but given the fact that the latter has a bug, I suspect the latter.

-1


a source







All Articles