23
Views
4
Comments
[CryptoAPI] not getting public key from generated private key
Question
Forge component by Ricardo Silva
34
Published on 03 Mar 2019

Hi,


I'm getting an error when trying the component.

First: I tried using

RSA_NewKey

and it gives me the private key, when I use the function 

RSA_GetPublicKey

to extract public key from the private one generated, I get empty text.



So I thought of sending the private key without these two texts "<RSAKeyValue><Modulus>" and "</RSAKeyValue>" and i'm getting wrong syntax, any lead how to do so?



Thanks,


attached OML for better understanding.



DigitalSignature.oml

Champion
Rank: #106

Hi Abeer,

Does this answer your query https://www.outsystems.com/forums/discussion/16673/digital-signatures/#Post63418?

Regards,

Swatantra

Staff
Rank: #63

Abeer ElAssal wrote:

Hi,


I'm getting an error when trying the component.

First: I tried using

RSA_NewKey

and it gives me the private key, when I use the function 

RSA_GetPublicKey

to extract public key from the private one generated, I get empty text.



So I thought of sending the private key without these two texts "<RSAKeyValue><Modulus>" and "</RSAKeyValue>" and i'm getting wrong syntax, any lead how to do so?



Thanks,


attached OML for better understanding.



 Hi Abeer,


After looking at your code I noticed 2 things.

The first is that you are calling several server actions in sequence in the client-side scope.

Instead, you should group the CryptoAPI calls in a single server call, this will improve network performance.

As for why you don't get the expected result when you are calling the RSA_NewKey and then the RSA_GetPublicKey, you are missing the final assignment of that result.



I've attached your module with a couple of changes that demonstrate how you can get both the private and public key using RSA_NewKey and then the RSA_GetPublicKey

DigitalSignature.oml