Axis-Fi / axis-core

Axis Protocol
https://axis.finance
Other
6 stars 1 forks source link

EMPA: Encryption conversion: RSA -> ECIES #49

Closed Oighty closed 5 months ago

Oighty commented 6 months ago

Objective

Replace the RSA-based encryption methodology with a simplified ECIES using BN254 (aka alt_bn128) curve, which has precompiles on Ethereum.

Rationale

The two main issues with RSA are:

Design

Idea: use a simplified version of the Elliptic Curve Integrated Encryption Scheme (ECIES) where the auction creator provides a public key on the AltBN128 curve. Bidders create a shared key off-chain and conceal it using the public key of the auction. To settle, the private key for the auction can be provided and the encrypted amounts out can be decrypted directly using the AltBN128 ecMul precompile for ~6,000 gas. We use a simple, hash-based key derivation function and XOR encryption, which are weak by themselves, but are likely sufficient behind the EC public key cryptography.

Oighty commented 6 months ago

Implemented in PR #46