You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ethan Gordon edited this page Aug 27, 2014
·
1 revision
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.
Message Encryption
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.
Message Decryption
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