Search code examples
javascriptangularjsencryptionng-file-upload

How encrypt files before uploading?


ng-file-upload is a very effective library and I would like to use it but after adding a encryption system.

I want to encrypt files with RSA protocol in javascript before uploading them. Do you have any idea how to do this with ng-file-upload ?

Is there a way to change blob before uploading the files ?

PS : encryption must be in javascript because I can't use HTTPS.


Solution

  • Are your intentions to modify ng-file-upload ? If not, you could use the $ngfBlobUrl that they provide for each file.

    Read that using HTML5 fileReader API to get the binary data. Encrypt this data and convert it back to a blob (functions to do so are well found on the interwebz). You can then send this back to the server.