[CryptoAPI] Can't use GetPrivateKey as input to GetRSAPublicKey

[CryptoAPI] Can't use GetPrivateKey as input to GetRSAPublicKey

  
Forge Component
(9)
Published on 2015-11-29 by Ricardo Silva
9 votes
Published on 2015-11-29 by Ricardo Silva

Steve Sommers wrote:


It seems that there's a mismatch in data types between the functions GetPrivateKey and GetRSAPublicKey. 

I would expect to be able to pass the function GetPrivateKey as the first parameter to GetRSAPublicKey, but GetRSAPublicKey requires the PrivateKey parameter to be of type Text, while GetPrivateKey returns binary data.


Hi Steve,

GetPrivateKey does not obtain an RSA Private key, it obtains the AES key the platform uses to encrypt sensitive information. The output of GetPrivateKey is meant to be used with the KEncrypt action, not with the RSA family of functions.

If you need an RSA private key, you'll need to generate and store one yourself.

Ricardo Silva wrote:

Steve Sommers wrote:


It seems that there's a mismatch in data types between the functions GetPrivateKey and GetRSAPublicKey. 

I would expect to be able to pass the function GetPrivateKey as the first parameter to GetRSAPublicKey, but GetRSAPublicKey requires the PrivateKey parameter to be of type Text, while GetPrivateKey returns binary data.


Hi Steve,

GetPrivateKey does not obtain an RSA Private key, it obtains the AES key the platform uses to encrypt sensitive information. The output of GetPrivateKey is meant to be used with the KEncrypt action, not with the RSA family of functions.

If you need an RSA private key, you'll need to generate and store one yourself.

Okay. Thanks for your response, Ricardo.