-
Notifications
You must be signed in to change notification settings - Fork 5
Encryption Specification (ECIES)
All Private-Public Key pairs are created with the P256 Elliptic Curve algorithm. Public keys are 65-byte serialized. Byte 1 is 0x04, the next 32 bytes are the X-coordinate, and the next 32 bytes are the Y-coordinate.
-
Start with the Recipient’s ECC Public Key and Plaintext
-
Generate a Random ECC Public-Private Key Pair
-
Scalar-Multiply the Random Private Key with the Recipient’s Public Key to generate the Encryption Public Key
-
Take the SHA-512 Hash of the serialized Encryption Public Key
-
Use the first 32-bytes of the hash as the AES-256 encryption key for the Plaintext to generate the Ciphertext
-
Use the last 32-bytes of the hash as the HMAC/SHA-256 key of the Plaintext to generate the HMAC
-
Return the AES-256 IV, the Random Public Key, the Ciphertext, and the HMAC as the combined encrypted message.
-
Start with the AES-256 IV, the Random Public Key, the Ciphertext, the HMAC, and the Recipient’s Private Key.
-
Scalar-Multiply the Random Public Key and the Recipient’s Private Key to generate the Encryption Public Key
-
Take the SHA-512 Hash of the serialized Encryption Public Key
-
Use the last 32-bytes of the hash as the key to validate the HMAC
-
Use the first 32-bytes of the hash as the AES-256 Decryption key on the Ciphertext and IV to generate the Plaintext
-
Return the Plaintext as the unencrypted message.