Descriptor conversion problem

Go To


CRSAPublicKey* publicKey;

const CRSAPublicKey &iRSAPublicKey= *publicKey;

iEncryptor = CRSAPKCS1v15Encryptor::NewL(iRSAPublicKey);

My problem is on the second line, because I have to pass a reference to function, for that I am creating reference from pointer.

I don't know whether I am doing this right or wrong. First line compiles but on second line it crashes.

2009-06-16 07:28
by rahulm


If you need to pass a rfeference to a function, there is no need to create an intermediate named value:

CRSAPublicKey* publicKey = .... // initialise pointer somehow

iEncryptor = CRSAPKCS1v15Encryptor::NewL( * publickey );
2009-06-16 07:50
by NoName


You are declaring the publicKey variable but you never initialize it. Using an uninitialized pointer leads easily to KERN-EXEC 3.

2009-06-16 07:39
by laalto


to avoid confusion, you should only prefix member variables with i. Its important as it allows you to ensure that you destroy them in an appropriate fashion (i.e. in the destructor rather than the clean up stack).

On topic, your first line of code should be something loosely along the lines of:

CRSAPublicKey* publicKey=CRSAPublicKey::NewLC();
2009-08-04 12:54
by frankster