regarding conversion from reference to string

2019-07-28 18:10发布

i am doing RSA encryption

i want to convert reference of public key class to string so that i can pass to server

//declaration

const CRSAPrivateKey &iRSAPrivateKey =iRSAKeyPair->PrivateKey();

const CRSAPublicKey &iRSAPublicKey =iRSAKeyPair->PublicKey() ;

i have convert &iRSAPublicKey into TBuf

i tried lot but fails to convert

plz help me out from situation

thanks in advance

标签: c++ symbian
1条回答
手持菜刀,她持情操
2楼-- · 2019-07-28 18:43

If you're using CRSAPublicKey, you probably downloaded the Symbian cryptography library and its documentation from http://developer.symbian.com/main/tools_and_sdks/developer_tools/supported/crypto_api/index.jsp

Admitedly, the documentation isn't explicit but I would venture that you can just send the modulus and exponent components to any other RSA engine in order to reconstitute the public key:

HBufC8* localModulusBuffer = iRSAPublicKey.N().BufferLC();

HBufC8* localExponentBuffer = iRSAPublicKey.E().BufferLC();

Then simply copy the 2 HBufC8 into a TBuf if you really need it.

Just remember that methods with a trailing "C" leave what they return on the cleanup stack.

查看更多
登录 后发表回答