Note Encryption

Within the nocturne protocol, notes created via a JoinSplit are encrypted and then published on-chain in a manner such that only the recipient's viewing key can decrypt it. This allows users to privately and trustlessly detect incoming notes.

Overview

Nocturne uses a variant of Hybrid Public Key Encryption (HPKE) to accomplish this. Before we describe Nocturne's scheme in detail, for context, we'll describe at a high level how HPKE works:

  1. The Sender...

    1. generates an ephemeral, single-use symmetric encryption key.

    2. uses the recipient's public key to "encapsulate" the symmetric encryption key. Only the recipient can "decapsulate" it. This mechanism is commonly referred to as a Key Encapsulation Module (KEM).

    3. encrypts the message using the symmetric key using an authenticated encryption scheme to prevent malicious actors from modifying the ciphertext in transit.

    4. sends encapsulated key along with the ciphertext to the recipient

  2. The recipient...

    1. attempts to decapsulate the encapsulated key. If it succeeds, they can recover the ephemeral secret key. If it fails, they reject the message.

    2. attempts to decrypt the message using the symmetric encryption key. If it fails, they reject the message.

Public key encryption allows us to encrypt a message to the recipient without sharing secret information but is slow. On the other hand, symmetric key encryption is fast but requires a secret to be shared between parties. HPKE gives us the best of both worlds, which is important because we need to encrypt many notes on resource-constrained devices, but we also have no trustless mechanism for sharing secret keys.

Detailed Description

Context out of the way, we'll now describe Nocturne's note encryption scheme in detail. First, some definitions:

Spelled out, encryption takes as input:

And proceeds as follows:

Decryption takes as input:

And proceeds as follows:

Last updated