RSA encryption scheme
The gcEVM utilizes the RSA encryption scheme to acquire the user AES key necessary for encrypting and decrypting data.
The SDK provides several RSA functionalities to support this.
Below are the function signatures for these functionalities, provided in Python, JavaScript, and Go languages:
Generate RSA key pair
Encrypt
Decrypt
Example usage - Onboard user
The gcEVM employs AES keys unique to each user for the encryption and decryption of their values.
To retrieve the AES key, a contract is provided that requests the system to return the key associated with the sending user. Further details regarding this process are outlined in the onboard user section:
Onboard AccountThe getUserKey
function in Solidity takes a signed RSA public key as a parameter. It then verifies the signature to ensure the authenticity of the RSA public key. Once the signature is verified, the function proceeds to encrypt the AES key using the verified RSA public key.
For a comprehensive understanding of the sign process, please refer to the detailed explanation provided at:
ECDSA SignatureWe offer a script that accomplishes the following tasks:
Generates an RSA key pair.
Signs the public key.
Invokes the
getUserKey
function in Solidity, passing the signed public key.Accepts the encrypted AES key.
Decrypts the AES key using the private RSA key.
Below are examples of such scripts implemented in both Python and JavaScript languages:
Last updated