@whitehat-xyz/ed25519-ecies
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Ed25519 ECIES

SIE1: A BIE1-based ECIES implementation that is compatible with Ed25519 keys on Solana.

Encryption

The encryption protocol does the following:

  1. Converts an Ed25519 public and private key to their X25519 keys. If no private key is provided, a new one is generated on the fly.
  2. Computes a shared secret using ECDH
  3. Creates a Public key from the shared secret
  4. SHA512 hashes it and splits the resulting bytes into iv, kE and kM
  5. AESCBC encrypts the desired message with kE and iv
  6. Checksums the message with kM using SHA256-HMAC

Decryption

The decryption protocol reverses this by:

  1. Takes in the private key of the opposing public key provided in the encryption phase
  2. Extracts the public key of the opposing private key provided/created in the encryption phase
  3. Computes the same shared secret using ECDH, but with the opposing keys to those in the encryption phase
  4. Creates a Public key from the shared secret
  5. SHA512 hashes it and splits the resulting bytes into iv, kE and kM
  6. AESCBC decrypts the ciphertext with kE and iv
  7. Calculates the SHA256-HMAC of the message to ensure the provided checksum matches

Readme

Keywords

none

Package Sidebar

Install

npm i @whitehat-xyz/ed25519-ecies

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

12.5 kB

Total Files

11

Last publish

Collaborators

  • ez-krk