tags:

views:

98

answers:

3
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.

+2  A: 

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

laalto
+4  A: 

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 );
anon
A: 

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();
frankster