281
Views
9
Comments
Solved
How to use CryptoAPI RSA_Decrypt()?
Application Type
Reactive
Service Studio Version
11.53.20 (Build 61431)
Platform Version
11.16.0 (Build 35554)

I am want to encrypt URL parameters  and want to send those in other screen.
I am using RSA encryption.

And when i call decrypt function it returns error Please refere given screenshot for server action.Also using the same key to decrypt 

2022-10-11 21-19-04
Fábio Miguel Ferreira Coelho
Solution

Hello Pratap,


I hope you're doing well.


I did the same logic flow as you but I added the action "RSA_GetPublicKey" because this action returns the Public Key that you need to use as input parameter on the action "RSA_Encrypt".


You have that error on your logic because you don't have the Public Key to use on the "RSA_Encrypt" action.


This worked for me.

Let me know if this solved your situation.


Kind regards,

FC


2024-09-04 05-41-42
Pratap Singh Naruka

@Fábio Miguel Ferreira Coelho 

I tried your solution as well 
I tried to save private key in DB and while decryption perform like this
Still this error

2022-10-11 21-19-04
Fábio Miguel Ferreira Coelho
Solution

Hello Pratap,


Regarding your issue see the explanation below:

  1. I created an action to save in the DB the Private Key, Public Key, Ciphertext, Plaintext and URL and I store all the values on the DB (CryptoKey Entity). So you have all the values that you might need stored in the DB; 
  2. I created another action to retrieve the CryptoKey by Id that you have stored in the DB and I used as you asked the "RSA_Decrypt" action;

This is working for me!

Please find the OML file attached.


Let me know if you have any questions or troubles.


Kind regards,

FC

Personal_TestOS_FC.oml
2024-09-04 05-41-42
Pratap Singh Naruka

Thank you 

Fábio Miguel Ferreira Coelho for your time. 

2022-10-11 21-19-04
Fábio Miguel Ferreira Coelho
Solution

Hello Pratap,


Regarding your issue see the explanation below:

  1. I created an action to save in the DB the Private Key, Public Key, Ciphertext, Plaintext and URL and I store all the values on the DB (CryptoKey Entity). So you have all the values that you might need stored in the DB; 
  2. I created another action to retrieve the CryptoKey by Id that you have stored in the DB and I used as you asked the "RSA_Decrypt" action;

This is working for me!

Please find the OML file attached.


Let me know if you have any questions or troubles.


Kind regards,

FC

Personal_TestOS_FC.oml
2022-10-11 21-19-04
Fábio Miguel Ferreira Coelho
Solution

Hello Pratap,


I hope you're doing well.


I did the same logic flow as you but I added the action "RSA_GetPublicKey" because this action returns the Public Key that you need to use as input parameter on the action "RSA_Encrypt".


You have that error on your logic because you don't have the Public Key to use on the "RSA_Encrypt" action.


This worked for me.

Let me know if this solved your situation.


Kind regards,

FC


2024-09-04 05-41-42
Pratap Singh Naruka

@Fábio Miguel Ferreira Coelho 

I tried your solution as well 
I tried to save private key in DB and while decryption perform like this
Still this error

2022-10-11 21-19-04
Fábio Miguel Ferreira Coelho
Solution

Hello Pratap,


Regarding your issue see the explanation below:

  1. I created an action to save in the DB the Private Key, Public Key, Ciphertext, Plaintext and URL and I store all the values on the DB (CryptoKey Entity). So you have all the values that you might need stored in the DB; 
  2. I created another action to retrieve the CryptoKey by Id that you have stored in the DB and I used as you asked the "RSA_Decrypt" action;

This is working for me!

Please find the OML file attached.


Let me know if you have any questions or troubles.


Kind regards,

FC

Personal_TestOS_FC.oml
2024-09-04 05-41-42
Pratap Singh Naruka

Thank you 

Fábio Miguel Ferreira Coelho for your time. 

2025-10-10 00-19-44
Bruno Rendeiro

@Pratap Singh Naruka 

https://www.outsystems.com/forums/discussion/66604/how-to-use-cryptoapi/


2024-09-04 05-41-42
Pratap Singh Naruka

Hi Fábio Miguel Ferreira Coelho 


I have used AES Encryption-decryption method and it worked for me.
Anyway thanks for your help

2022-10-11 21-19-04
Fábio Miguel Ferreira Coelho

I'm glad I could help you.

Let me know if you have more questions or doubts regarding OS.

Have fun with OS!

2021-06-02 20-50-04
Márcio Carvalho

Why was @Fábio Miguel Ferreira Coelho answer unmarked as the solution?

An RSA is an Asymmetric algorithm that needs a public key to encrypt and a private key to decrypt.

An AES encryption is a Symmetric Key algorithm that needs just a key (shared key) to encrypt and decrypt.

The origin of the question is about RSA and not AES.

Kind Regards,

Márcio

2024-09-04 05-41-42
Pratap Singh Naruka

Because I wanted some more queries to get resolved before question thread to be completed as I am newbie to CryptoAPI compenent 
moreover i am aware of RSA and AES definations just needed help in hands on implementations.

Thanks for your Words.

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