Hi,
I'm trying to initialize RSACryptoServiceProvider/RSAParameters with private and public keys that I'm getting from a third party (in file). Environment is Windows Mobile 6.1 and .Net CF 3.5.
I was expecting that the following code will work, but I'm always getting a " 80007001" error on the Importparameters call. I have read many posts and many comments, but for the moment I'm still stuck with this issue !!
Any help and advice will be welcome. Thks !
Vincent
Here is the code :
private void button1_Click(object sender, EventArgs e) { RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); RSAParameters RSAparams = new RSAParameters(); RSAparams.Modulus = new Byte[]{ 0x00,0xc4,0xd1,0xd9,0x42,0xc8,0x3c,0xad,0x54,0xf0,0xb1,0xab,0x3a,0x54,0x33, 0x78,0x39,0x5a,0x3d,0x76,0x65,0x30,0xeb,0xb8,0x81,0xbb,0xc9,0x9e,0xe6,0x1c, 0xf4,0xa1,0x6b,0x31,0x18,0x1a,0x89,0x00,0xdf,0x03,0x92,0x3e,0xe3,0x71,0xca, 0x4c,0xc9,0xc6,0x15,0xb1,0xdd,0x17,0x58,0x27,0x6c,0x94,0xff,0x51,0x3f,0x1b, 0x01,0xf5,0xc7,0x96,0xc1,0x46,0x27,0xc5,0xed,0x3f,0x79,0x0d,0x4b,0x67,0x0e, 0xc0,0x3b,0x37,0xc5,0x50,0x7f,0x55,0x37,0x05,0x3f,0xfb,0x3d,0xbc,0x4f,0x15, 0x3b,0x54,0xde,0x4a,0x20,0x86,0x2c,0x14,0xda,0x22,0xa5,0x94,0xc9,0x85,0x72, 0x27,0xe8,0x85,0xee,0x2f,0x5e,0xe7,0x0f,0x3c,0x70,0x02,0xd1,0x79,0x82,0x51, 0x8f,0x90,0x3b,0xa7,0x3a,0x8a,0x0e,0xae,0x39 }; RSAparams.Exponent = new Byte[] { 1, 0, 1 }; RSAparams.D = new Byte[] { 0x7e,0x86,0xf5,0x27,0x94,0x78,0x45,0x69,0xac,0x8e,0x5b,0x28,0x55,0x46,0xfd, 0x4b,0xc9,0x72,0x67,0xb1,0x67,0xc0,0xb1,0xcd,0x5c,0xfe,0xa1,0x93,0x07,0x1c, 0x50,0xc5,0x0b,0x3b,0x96,0x9b,0x6a,0x9e,0xf3,0xb9,0xc9,0x8a,0x07,0xf5,0xe8, 0x65,0x72,0x5d,0x32,0x09,0x92,0xdf,0x4e,0x00,0xe4,0xcc,0x39,0xdb,0xda,0xad, 0xe8,0xe6,0x15,0x48,0x2b,0xc7,0xbb,0xdb,0x6c,0x12,0xf2,0x41,0x43,0xec,0x69, 0x5e,0x60,0x23,0x08,0xae,0x0b,0x7c,0xa6,0x03,0x57,0x49,0x08,0xa8,0x2b,0x32, 0x79,0x9e,0x69,0x81,0x22,0xc2,0xd6,0x44,0x9b,0xf0,0xa9,0x02,0xf9,0x9e,0x9e, 0xbb,0x45,0x64,0x48,0x4a,0x0f,0x7a,0xbd,0xa4,0x55,0xb1,0x7c,0xd1,0xc9,0x67, 0x26,0xf6,0x1d,0xa6,0x00,0xe7,0xbc,0x9d }; RSAparams.P = new Byte[]{ 0x00,0xea,0x20,0xbc,0x04,0xb7,0x85,0x0f,0xe8,0x74,0x41,0xf1,0xa8,0x2a,0xc3, 0x1e,0xe6,0x7e,0x34,0xbd,0x8b,0x14,0x67,0xb9,0x2c,0x60,0x9a,0x79,0xb9,0x49, 0xf2,0xaa,0xb6,0xc7,0x46,0x40,0xff,0x26,0x91,0x7d,0x88,0xe8,0x57,0x4a,0xb8, 0x82,0x9d,0xf9,0xbf,0x46,0xca,0xe0,0xde,0x12,0x78,0x6f,0x4a,0x14,0xb8,0x53, 0x4c,0xe4,0x2d,0xb2,0x07 }; RSAparams.Q = new Byte[]{ 0x00,0xd7,0x34,0xdf,0xd4,0x3f,0xb4,0x2c,0xb5,0x14,0x9c,0x46,0x1b,0xc0,0x84, 0x8e,0x34,0x89,0xa1,0x17,0xcb,0x92,0x0d,0x21,0x6e,0x42,0x4e,0x20,0xe6,0xa6, 0xb3,0xd6,0x76,0xb3,0x4d,0xdb,0x68,0x7b,0xac,0x8a,0x33,0x88,0xeb,0xbf,0xbc, 0x75,0xff,0x85,0x2d,0x9c,0x0c,0xbc,0xc1,0xe5,0x58,0x3e,0x07,0x9f,0xa8,0xc1, 0x0a,0x19,0x8f,0x8d,0xbf }; RSAparams.DP = new Byte[]{ 0x00,0xc3,0x36,0x90,0x0e,0x8e,0xc6,0x4f,0xc1,0x4e,0x4e,0x3d,0xa4,0x2e,0x23, 0x8a,0xfc,0x3c,0x76,0xd5,0x23,0xc5,0xdb,0xc6,0x36,0x0e,0x46,0x3f,0x00,0x13, 0x7c,0x56,0x83,0x18,0x1c,0xa7,0xcd,0x16,0xe7,0x70,0x78,0x5a,0xe1,0x8d,0xd7, 0xd2,0x70,0xcd,0xf0,0x82,0xa2,0x5e,0x64,0x4b,0x9a,0x47,0x90,0xc9,0x3d,0xf7, 0x96,0xc1,0x1a,0xa8,0xb9 }; RSAparams.DQ = new Byte[]{ 0x19,0x6b,0x60,0x68,0xd4,0xa1,0x76,0x8a,0x69,0x05,0xd0,0x6e,0x24,0xbe,0x43, 0x81,0xc7,0x23,0xe5,0x08,0xa1,0x96,0xb5,0x75,0x2d,0x95,0xc6,0xe3,0x17,0x9b, 0xb4,0x60,0x4e,0xeb,0x8a,0x57,0xfc,0x0b,0xb4,0x43,0x44,0x0f,0xfc,0x94,0xc9, 0x27,0x46,0x56,0xcd,0xd0,0xdf,0x56,0xd3,0xbd,0x29,0x8e,0x82,0xf8,0x4e,0xdc, 0xdf,0x8a,0x0a,0x47 }; RSAparams.InverseQ = new Byte[] { 0x40,0xde,0x0a,0x45,0xf6,0xff,0x7a,0x86,0x56,0x7d,0xc4,0x12,0x85,0xa4,0xc0, 0x36,0x37,0x18,0x2a,0x11,0xa4,0x0b,0x38,0xfa,0xbb,0x98,0x4f,0xf2,0x1e,0xcb, 0x31,0x3d,0x15,0x57,0x2f,0x69,0xce,0x43,0x72,0xe1,0xe9,0x33,0xad,0xdf,0xe9, 0xe7,0x8c,0x28,0x71,0x51,0x81,0x07,0x7c,0xd8,0x6e,0x24,0x80,0x92,0xd6,0x35, 0x6f,0x6f,0x46,0xcf }; RSA.ImportParameters(RSAparams); }