I have used AES for symmetric encryption and RSA for symmetric key distribution. The problem is i ended up with two messages. The first is the encrypted message. The second is encrypted symmetric key. Now i am looking for away to append the second to the first then send one message and do the retrieving accordingly. If it is possible to do, any information on where to look or start would be great.
Asked
Active
Viewed 165 times
0
-
3You managed to use AES and RSA, but combining 2 messages into 1 is causing you trouble? – Kayaman May 30 '16 at 08:30
-
What does this have to do with [tag:sms]? – Piotr Siupa May 30 '16 at 08:37
-
i have removed that tag @NO_NAME – Martin Frank May 30 '16 at 09:15
-
you can create a temp array of bytes which length is encryptedBytes.length + keyBytes.length, and merge (concatenate) them where key is added at the beginning of the temp array, then the encryoted message. once done, you can Base64#encode the temp array (to hex stirng) – Yazan May 30 '16 at 12:49
-
@Yazan could you clarify or redirect me to a detailed solution – ftalem arefayne May 30 '16 at 19:15
-
1i saw it somewhere, but unfortunately i can't find it again :( anyways, its straight forward, once you have encrypted the message , and encrypted the key using the keypair, you have to create array as i told you, and use `System,arraycopy()` to merge the 2 bytes array into the new array, and when decrypting you read 1st n bytes (length of key appended) then decrypt it, and decrypt the remaining bytes (the message) and thats it, if i find it i will let you know – Yazan May 31 '16 at 06:35
-
Thanks i can take it from here – ftalem arefayne Jun 11 '16 at 05:29