tags:

views:

204

answers:

1

hi,

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  A: 

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.

QuickRecipesOnSymbianOS