I had to port a Java app to C++/Qt, but I have a problem about the RSA encryption.
Basically my app ask the server for a key and the the server return it like this :
30 81 9f 30 0d 06 09 2a 86 48 86 f7 0d 01 01 01 05 00 03
81 8d 00 30 81 89 02 81 81 00 b4 74 05 71 53 79 39 16 29
fc 17 d3 dd 27 c0 84 72 1e 4a 66 b8 43 e8 57 58 f6 13 65
3c a6 85 ff e1 c3 b3 76 11 3e 10 33 00 7d a4 ab 94 d3 86
a2 99 71 d6 c9 99 a6 54 ec 3c 32 de 25 60 61 c3 84 6d 00
32 6a 4e 7c f7 25 38 3c 12 f7 f7 c0 08 e0 8a ca 6f dc 1d
3c 37 bc e9 77 70 11 e7 9e 67 f0 96 d6 df a1 37 d2 8e 83
1c 75 cf 86 ff 39 bb 53 a6 63 f7 ce 99 eb b3 f2 20 39 37
52 41 31 6e 9f 02 03 01 00 01
After that, all i have to do is to encrypt the credentials and sending them to the server. But I can't find any way to use that key.
The Java version look like this
byte[] key;
// Get the key from the server
// ...
//
KeyFactory kf;
EncodedKeySpec eks = new X509EncodedKeySpec(key);
PublicKey localPublicKey = kf.generatePublic(eks);
I've looked both OpenSSL and QSsl libs but I didn't found anything like this.
If anyone had any ideas ...