I have a group chat where a user can post both text and image.
I'm using client-side fan-out to encrypt each message multiple times for each user using their public key
In theory this is fine until you try to RSA encrypt a base64 image for 50 people before sending to the server. It takes about 11 days.
So after searching around trying things like JSZip and then encrypt or AES and then RSA, I'm looking for the correct way to do this.
So let's say I have
<input id="foo" type="file" />
And my change function
$(document).on("change", "#foo", function() {
// AJAX PUBLIC KEY RETRIEVAL
$.ajax({
url : ajax_object.ajax_url,
type : 'post',
data : {
action: 'get_room_member_keys',
},
beforeSend: function() {
},
success: function(html) {
var pubKeys = $.parseJSON(html);
$.each( pubKeys, function( key, value ) {
// Do encryption with Cryptico
});
},
});
});
And then later when I grab stored messages and RSA decrypt, how do I extract the image for use in an image tag?
I didn't post things I've tried because they're laughable and I don't see this thoroughly explained anywhere.
You don't use RSA to encrypt large things, it is really slow, you use RSA to encrypt small things. The typical method here is to generate a new symmetric encryption key, encrypt the image with it, then encrypt that key individually for each user who needs to know how to decrypt the image.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With