Iain

 

Thanks!! It worked. I was looking at the examples in the source and also on the mailing list and one point I thought I did put the length. You had been of great help to me.

 

Thanks

 

Seshu

 

-----Original Message-----
From: Iain Walmsley [mailto:[EMAIL PROTECTED]
Sent:
Tuesday, March 23, 2004 1:45 PM
To: [EMAIL PROTECTED]
Subject: RE: Ber Encoding problem: Please Help

 

Seshu,

 

When StringSource is used on an array rather than an actual string type, you need to pass in the length of the string as well.

    StringSource privFile(privKey, <length(privKey)>, true, .....

 

When you want to use the contents of a file rather than a string, you need to use FileSource instead of StringSource.

 

Iain

-----Original Message-----
From: Seshu Madabushi [mailto:[EMAIL PROTECTED]
Sent:
Wednesday, 24 March 2004 5:38 a.m.
To: [EMAIL PROTECTED]
Subject: Ber Encoding problem: Please Help

Hi

I am trying to do encrypt/decrypt on a pub/pvt key pair. Here is the code snippet which I am using,

 

 

            char privKey[] = "3081E70201003081C906072A8648CE3804013081BD02510"

        "084CA34301AB2EC920DE1304BF4467258D5371869FF9710D541790376D615B57B9CDB89A5"

        "7D9511DCAB6AF2A068DE8C1F9D92752B7BAEE2F3CD50D0CA6B1809F46CF3E2D5C4786A110"

        "9A40DB6929A5B85021500EDFFB2725C9F7C688E1DE003E70B87F9E67C115902510081D65A"

        "CBD4C406FEEB4EACBF8CBEBE4A4AAB911D65BEC76A0DB254FBF5D77F42A0EE39C2E75FAC3"

        "5C78B74ADD0C306471AAC93B9CB9EAB392C773E4E3596D74A31372B2E861EFD8603EA5CC5"

        "6A315A120416021441A76580783FE328E58753C4880D0FD00A12514D";

 

StringSource privFile(privKey, true, new HexDecoder);

                        RSAES_OAEP_SHA_Decryptor rsaPriv;

                        rsaPriv.AccessKey().BERDecodeKey(privFile);

 

But when I run the above code, I am getting BER encoding exception error. So I tried to remove the privKey with rsa400pv.dat file, but I am still getting the same exception.

StringSource privFile(rsa400pv.dat, true, new HexDecoder);

What am I doing wrong? Please help

 

Thanks
Seshu

 

 

Reply via email to