0

我正在使用密码学 api 的加密功能(乐趣声明为虚拟)

//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();
    }
}

我想知道什么是确切的问题

4

2 回答 2

1

这里的主要问题,您的编译器抱怨的原因是您使用 iEncryptor 作为对象或引用,而它可能是 C++ 指针。

要进入下一阶段,请尝试使用:

iEncryptor->EncryptL(文本,密码);

于 2009-05-22T09:11:23.730 回答
-1

由于您没有发布从编译器获得的确切错误消息,我不得不猜测。

我认为问题在于您显示的EncryptL函数期望获取TDesC8 类型的参数,并且您将TBuf8<10>传递给它。除非TDesC8TBuf8<10>的 typedef,否则它们是不同的,因此对于编译器不兼容的类型。

Ypou 也使用iEncryptor一次作为指针:iEncryptor->MaxInputLength(); 在您将错误视为对象的位置:iEncryptor.EncryptL(text,cipher); . 只有一种形式是正确的。由于我们没有您提供的更多代码,我不知道是哪个,但鉴于后者有错误,我怀疑是后者。

于 2009-05-21T14:15:09.853 回答