97
Views
8
Comments
Solved
Encryption and Decryption of an image using Crypto API plugin

I am tried encrypting the image by first converting the image from byte to text format as AES encryption server action takes plaintext and key as input and for key I take user input key value and then generate the ciphertext for the same and for decryption of that ciphertext I was taking user input as key value to check if the input key value is same or not so how should I check this by using the plugin itself and don't add this condition by my own in the flow. So which key plugin should I used to check the key entered by the user to decrypt the ciphertext into plaintext. I am attaching the oml file below. Do check that out and send me the updated one if anyone have any idea to achieve this or tell any suggestion what I can do. But first do check out the oml file. 

ReactiveTestAppNew.oml
2022-05-26 14-50-47
Christian Angelo Santos
Solution

Hi Chetna,

You may refer with the uploaded .oml file.

Note:

The usage of the user key will depend on your use case. It could be from an input field and/or retrieve from the database. In my example, it is simply from an input box. You're free to explore it first before applying complex implementation.


Regards,

Chris

ReactiveTestApp2.oml
2022-05-26 14-50-47
Christian Angelo Santos

Hi,

I assume that the logic you want to implement with your thought process is somehow like the ff:

  1. Upload image as binary
  2. Convert it to base64
  3. Encrypt (save it somewhere)
  4. Decrypt (retrieve and decrypt)
  5. Show it to the user

If yes, you may check the simple implementation I made.


Regards,

Chris

ReactiveTestApp.oml
UserImage.jpg
Chetna Upadhyay

While I am publishing your module it shows the Foreign Module error. Can you tell me how to resolve this error in order to publish and run the module.

UserImage.jpg
Chetna Upadhyay

I want to enter the key value by the user during image encryption and check the key for decrypting the image with the help of crypto plugin.

2022-05-26 14-50-47
Christian Angelo Santos

You can add an input parameter to the encryption process/encrypt action (in the provided .oml) then replace AES_NewKey with  AES_KeyFromPassword and set the key value using the new input parameter (probably came from the input box where you're setting the user key). 


UserImage.jpg
Chetna Upadhyay

Which key should I add to compare the password entered by the user during image decryption?? Can you tell the flow for decryption also.

2022-05-26 14-50-47
Christian Angelo Santos
Solution

Hi Chetna,

You may refer with the uploaded .oml file.

Note:

The usage of the user key will depend on your use case. It could be from an input field and/or retrieve from the database. In my example, it is simply from an input box. You're free to explore it first before applying complex implementation.


Regards,

Chris

ReactiveTestApp2.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.