Replies: 5 comments 41 replies
-
A post per feature. Reply to this or other posts. The first point is AES-GCM IV.
I'd argue against 1 because collisions are likely in long-running conversations, with 12-byte nonces. |
Beta Was this translation helpful? Give feedback.
-
The second point is the need for MAC. It doesn't seem to be needed, since we have signed messages? But we can't just leave NIP04 AES-CBC in, because CBC mode is pretty bad. |
Beta Was this translation helpful? Give feedback.
-
The third point is AES-GCM vs ChaCha20 / XChaCha20. I feel like maybe we should discuss this since we're changing the encryption method. Advantages:
Disadvantages:
If ChaCha is in, I can probably create a secure ChaCha package in a week or so. |
Beta Was this translation helpful? Give feedback.
-
i would like to start the conversation from here:
i see no reason to play with dangerous iv's anymore. a new key every time ... derived from 16 bytes. unassailable is better than using times, which can be attacked. |
Beta Was this translation helpful? Give feedback.
-
this is an ephemeral public key encryption standard proposal layered on the nip04 replacement above async nipXXEncrypt(pubkey: string, inner: UnsignedEvent, version: number): Promise<NostrEvent> {
const event = await this.signEvent(inner)
const content = JSON.stringify(event)
const iv = randomBytes(16)
const dpriv_n = (BigInt("0x" + this.privKey) * BigInt("0x" + Buffer.from(iv).toString("hex"))) % secp256k1.CURVE.n
const epriv = dpriv_n.toString(16)
const epub = getPublicKey(epriv)
const encrypted = await this.nip04XEncrypt(epriv, pubkey, content, version, iv)
const unsigned = {
kind: 99,
content: encrypted,
pubkey: this.pubKey,
tags: [["p", pubkey]]
}
const signed = await this.signEventWith(unsigned, epriv, epub)
return signed
} the need for this is to layer other protocols on top of it... not as a "blinded DM" although that works too! this allows you to send someone a message with the following properties:
this is suitable for a NIP38 group chat invitation, for example. the advantage to having one standard is that it improves plausible deniability |
Beta Was this translation helpful? Give feedback.
-
I have opened pull request for (allegedly) NIP-44 Encrypted Direct Message (Versioned): #574
It uses versioning, XChaCha20 and hashed shared secret. Algorithm choice rationale is described in the pull request. New Versioning feature explicitly requires non-compatible versions to throw user-visible errors.
Please take a look at it! Any comments are welcome.
(old message)
Continuation of #107 and #303 with precise ideas.
I'll be listing points that must be clarified in separate posts each so that we can have a separate tree-based discussion branches for comfort.
So it seems like we're moving towards hashed ECDH key and xchacha20. My proposal:
Beta Was this translation helpful? Give feedback.
All reactions