regarding conversion from reference to string

给你一囗甜甜゛ 提交于 2019-12-13 02:22:54

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/909035/regarding-conversion-from-reference-to-string

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!