#Ed25519

2025-06-13

it turns out it is /annoying/ to get #python to match the same #ed25519 clamping as #golang #cryptography #tor #onion

codeberg.org/risottobias/halo

basically 61 lines python, ~78 lines go (103 with comments)

python implementation of halo.golang implementation of halo
Pixelcode 🇺🇦pixelcode@social.tchncs.de
2025-03-23

As I need an Ed25519-SK SSH key generated with a hardware token, I tried to use my Nitrokey #FIDO2 for that, but: no.

Years ago, #ed25519 had experimentally been added to the firmware (not released) but later #Nitrokey stated that customers should've donated on top of the selling price to get firmware updates & advised to buy the new product instead.

The latter would be OK if the old key wasn't sold anymore, but it is still sold & the firmware was last updated in 2021.

github.com/Nitrokey/nitrokey-f

Jason 🦓 Gerard 🦀 DeRose_json420@fosstodon.org
2025-01-30

I've reached 420 commits in ZebraChain. All 69 unit tests are passing.

github.com/zebrafactory/zebrac

Not joking, `cargo test` for yourself 😏

#Rust #PostQuantumCryptography #Dilithium #ed25519

2025-01-30

@soatok LOADS of #banks are still using RSA X-D shiiiiite X-D
anyone seen #https using #Ed25519 not me

2025-01-30

@soatok alright got it :D using #Ed25519 for ssh since a long time :D en.wikipedia.org/wiki/Elliptic but what about https? duckduckgo.com/?q=https+Ed25519

Jason 🦓 Gerard 🦀 DeRose_json420@fosstodon.org
2025-01-23

I'm now doing post quantum secure hybrid signing with #Dilithium and #ed25519 (in #Rust of course):
github.com/zebrafactory/zebrac

2025-01-15

Don’t Use Session (Signal Fork)

Last year, I outlined the specific requirements that an app needs to have in order for me to consider it a Signal competitor.

Afterwards, I had several people ask me what I think of a Signal fork called Session. My answer then is the same thing I’ll say today:

Don’t use Session.

The main reason I said to avoid Session, all those months ago, was simply due to their decision to remove forward secrecy (which is an important security property of cryptographic protocols they inherited for free when they forked libsignal).

Lack of forward secrecy puts you in the scope of Key Compromise Impersonation (KCI) attacks, which serious end-to-end encryption apps should prevent if they want to sit at the adults table. This is why I don’t recommend Tox.

And that observation alone should have been enough for anyone to run, screaming, in the other direction from Session. After all, removing important security properties from a cryptographic security protocol is exactly the sort of thing a malicious government would do (especially if the cover story for such a change involves the introduction of swarms and “onion routing”–which computer criminals might think sounds attractive due to their familiarity with the Tor network).

Unfortunately, some people love to dig their heels in about messaging apps. So let’s take a closer look at Session.

I did not disclose this blog post privately to the Session developers before pressing publish.

I do not feel that cryptographic issues always require coordinated disclosure with the software vendor. As Bruce Schneier argues, full disclosure of security vulnerabilities is a “damned good idea”.

I have separated this blog post into two sections: Security Issues and Gripes.

Security Issues

  1. Insufficient Entropy in Ed25519 Keys
  2. In-Band Negotiation for Message Signatures
  3. Using Public Keys as AES-GCM Keys

Insufficient Entropy in Ed25519 Keys

One of the departures of Session from Signal is the use of Ed25519 rather than X25519 for everything.

Ed25519 Keypairs generated from their KeyPairUtilities object only have 128 bits of entropy, rather than the ~253 bits (after clamping) you’d expect from an Ed25519 seed.

fun generate(): KeyPairGenerationResult {    val seed = sodium.randomBytesBuf(16)    try {        return generate(seed)    } catch (exception: Exception) {        return generate()    }}fun generate(seed: ByteArray): KeyPairGenerationResult {    val padding = ByteArray(16) { 0 }    val ed25519KeyPair = sodium.cryptoSignSeedKeypair(seed + padding)

As an implementation detail, they encode a recovery key as a “mnemonic” (see also: a gripe about their mnemonic decoding).

Does This Matter?

You might think that clearing the highest 128 bits of the Ed25519 seed is fine for one of the following reasons:

  1. It’s hashed with SHA512 before clamping.
  2. Ed25519 only offers 128 bits of security.
  3. Some secret third (and possibly unreasonable) argument.

It’s true that Ed25519 targets the 128-bit security level, if you’re focused on the security of the Elliptic Curve Discrete Logarithm Problem (ECDLP).

Achieving 128 bits of security in this model requires 256-bit secrets, since the best attack against the ECDLP finds a discrete logarithm in guesses.

Additionally, having 256-bit secrets makes the multi-user security of the scheme easy to reason about, whereas 128-bit secrets makes it a lot harder. (This mostly comes up in criticism of AES, which has a 128-bit block size.)

When your secret only has possible values, your multi-user security is no longer as secure as Ed25519 expects.

Additionally, you can shove the SHA512 + clamping in your attack script (thus negating the first objection) and find the corresponding secret key in queries if you know the top 128 bits were initialized to 0, using a modified version of Pollard’s rho for discrete logarithms.

This means that Session’s KeyPairUtilities class only provides 64 bits of ECDLP security.

CMYKat

What does 64 bits of ECDLP Security actually mean?

I provided a technical definition already, but that’s probably not meaningful to most people outside computer security.

What this means is that a distributed computing effort can find the secret key for a given Ed25519 public key generated from this algorithm in only queries.

For flavor, queries is approximately the attack cost to find a SHA1 collision, which we know is possible and economical.

Based on this attack, the authors projected that a collision attack on SHA-1 may cost between US$75K and US$120K by renting GPU computing time on Amazon EC2 using spot-instances, which is significantly lower than Schneier’s 2012 estimates.

— from the Shattered paper, page 2.

I don’t know if this was mere stupidity or an intentional NOBUS backdoor that only well-resourced adversaries can crack. (I also don’t have hundreds of thousands of dollars lying around to test this myself.)

How would you exploit this in practice?

If you’re not familiar with Pollard’s rho, then this section might be a bit abstract and difficult to follow.

Instead of directly passing a full 256-bit value to your oracle with each iteration (like you do with a standard Pollard’s rho implementation), you would need mutate the output the same way Session does (n.b., replace 128 bits of the seed with zeroes), hash & clamp that, and then perform the scalar multiplication.

It should be a bit more expensive than a raw ECDLP attack against a 128-bit curve (due to the hashing), but the strategy should succeed in the expected number of queries (average case).

Although this makes the attack totally feasible for a nation state, I do not have the resources to build and test a proof of concept against a candidate keypair. If anyone does, get in touch, it would make for a fun research project.

CMYKat

Alternatively, Pollard’s kangaroo might be a better cryptanalysis technique for Session’s setup.

Note: If there is any classified government algorithm especially suited for cracking Ed25519 keys constructed exactly like Session does, it’s not one I’ve ever heard of. I don’t have any security clearances, nor do I want one.

However, ECDLP security of elliptic curve-based protocols is extremely well-understood in the cryptography literature.

In-Band Negotiation for Message Signatures

If you thought the previous issue was mitigated by the use of Ed25519 signatures on each message, don’t worry, the Session developers screwed this up too!

// 2. ) Get the message partsval signature = plaintextWithMetadata.sliceArray(plaintextWithMetadata.size - signatureSize until plaintextWithMetadata.size)val senderED25519PublicKey = plaintextWithMetadata.sliceArray(plaintextWithMetadata.size - (signatureSize + ed25519PublicKeySize) until plaintextWithMetadata.size - signatureSize)val plaintext = plaintextWithMetadata.sliceArray(0 until plaintextWithMetadata.size - (signatureSize + ed25519PublicKeySize))// 3. ) Verify the signatureval verificationData = (plaintext + senderED25519PublicKey + recipientX25519PublicKey)try {    val isValid = sodium.cryptoSignVerifyDetached(signature, verificationData, verificationData.size, senderED25519PublicKey)    if (!isValid) { throw Error.InvalidSignature }} catch (exception: Exception) {    Log.d("Loki", "Couldn't verify message signature due to error: $exception.")    throw Error.InvalidSignature}

What this code is doing (after decryption):

  1. Grab the public key from the payload.
  2. Grab the signature from the payload.
  3. Verify that the signature on the rest of the payload is valid… for the public key that was included in the payload.

Congratulations, Session, you successfully reduced the utility of Ed25519 to that of a CRC32!

Art: AJ

Using Public Keys As AES-GCM Keys

I wasn’t entirely sure whether this belongs in the “gripes” section or not, because it’s so blatantly stupid that there’s basically no way Quarkslab would miss it if it mattered.

When encrypting payloads for onion routing, it uses the X25519 public key… as a symmetric key, for AES-GCM. See, encryptPayloadForDestination().

val result = AESGCM.encrypt(plaintext, x25519PublicKey)deferred.resolve(result)

Session also does this inside of encryptHop().

val plaintext = encode(previousEncryptionResult.ciphertext, payload)val result = AESGCM.encrypt(plaintext, x25519PublicKey)

In case you thought, maybe, that this is just a poorly named HPKE wrapper… nope!

 /** * Sync. Don't call from the main thread. */internal fun encrypt(plaintext: ByteArray, symmetricKey: ByteArray): ByteArray {    val iv = Util.getSecretBytes(ivSize)    synchronized(CIPHER_LOCK) {        val cipher = Cipher.getInstance("AES/GCM/NoPadding")        cipher.init(Cipher.ENCRYPT_MODE, SecretKeySpec(symmetricKey, "AES"), GCMParameterSpec(gcmTagSize, iv))        return ByteUtil.combine(iv, cipher.doFinal(plaintext))    }}

This obviously doesn’t encrypt it such that only the recipient (that owns the secret key corresponding to the public key) can decrypt the message. It makes it to where anyone that knows the public key can decrypt it.

I wonder if this impacts their onion routing assumptions?

Why should I trust session?

(…)

When using Session, your messages are sent to their destinations through a decentralised onion routing network similar to Tor (with a few key differences) (…)

Session FAQs

Gripes

Some of these aren’t really security issues, but are things I found annoying as a security engineer that specializes in applied cryptography.

  1. Mnemonic Decoding Isn’t Constant-Time
  2. Unsafe Use of SecureRandom on Android

Mnemonic Decoding Isn’t Constant-Time

The way mnemonics are decoded involves the modulo operator, which implicitly uses integer division (which neither Java nor Kotlin nor Swift implement in constant-time).

return wordIndexes.windowed(3, 3) { (w1, w2, w3) ->    val x = w1 + n * ((n - w1 + w2) % n) + n * n * ((n - w2 + w3) % n)    if (x % n != w1.toLong()) throw DecodingError.Generic    val string = "0000000" + x.toString(16)    swap(string.substring(string.length - 8 until string.length))}.joinToString(separator = "") { it }

This isn’t a real security problem, but I did find it annoying to see in an app evangelized as “better than Signal” on privacy forums.

Unsafe Use of SecureRandom on Android

The recommended way to get secure random numbers on Android (or any Java or Kotlin software, really) is simply new SecureRandom(). If you’re running a service in a high-demand environment, you can take extra care to make a thread-local instance of SecureRandom. But a local RNG for a single user isn’t that.

What does Session do? They use SHA1PRNG, of course.

public static byte[] getSecretBytes(int size) {  try {    byte[] secret = new byte[size];    SecureRandom.getInstance("SHA1PRNG").nextBytes(secret);    return secret;  } catch (NoSuchAlgorithmException e) {    throw new AssertionError(e);  }}

And again here.

SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");

Why would anyone care about this?

On modern Android devices, this isn’t a major concern, but the use of SHA1PRNG used to be a source of vulnerabilities in Android apps. (See also: this slide deck.)

Closing Thoughts

There are a lot of Session’s design decisions that are poorly specified in their Whitepaper and I didn’t look at. For example, how group messaging keys are managed.

When I did try to skim that part of the code, I did find a component where you can coerce Android clients into running a moderately expensive Argon2 KDF by simply deleting the nonce from the message.

val isArgon2Based = (intermediate["nonce"] == null)if (isArgon2Based) {    // Handle old Argon2-based encryption used before HF16

That’s hilarious.

Cryptography nerds should NOT be finding the software that activists trust with their privacy hilarious.

CMYKat

So if you were wondering what my opinion on Session is, now you know: Don’t use Session. Don’t let your friends use Session.

If you’re curious about the cryptography used by other messaging apps, please refer to this page that collects my blogs about this topic.

#AESGCM #Android #asymmetricCryptography #cryptography #E2EE #Ed25519 #Java #Kotlin #messagingApps #OnlinePrivacy #privateMessaging #Session #Signal #SignalAlternatives #vuln

Don't Use Session (Signal Fork)Facepaw
tuxsoultuxsoul
2025-01-05

actualmente uso dos llaves una y otra , estare usando aun la rsa este año, pero poco a poco ire cambiando todo a ed25519 ... assets.tuxsoul.com/uploads/key

Pixelcode 🇺🇦pixelcode@social.tchncs.de
2024-12-10

You may have noticed that I updated my #Keyoxide profile link in various places. That was legit – my old RSA #OpenPGP key had expired back in early November without me noticing, and yesterday, I created a new #ed25519 key. If you still see my old Keyoxide link somewhere, please tell me. #pgp #rsa

🔗 keyoxide.org/FEF07E34F003F58EF

First, however, I had to manually update #GPG to version 2.4 by compiling it from source. 🤡

🔗 procustodibus.com/blog/2023/02

QT fed.brid.gy/r/https://bsky.app

2024-12-05

As of 5 hours ago, Ed25519 is now merged into the WebCrypto specification!

#cryptography #ed25519

w3c.github.io/webcrypto/#ed255

Surprisingly, Safari and Firefox support it and not the Chromium-kingdom: developer.mozilla.org/en-US/do

Perhaps this will move out of a feature flag soon!

2024-12-04

so the internet agrees, that #ed25519 is the way to do signatures (see random 1st search hit scottbrady91.com/jose/jwts-whi) and yet, neither webauthn.io nor #yubico demo-site, nor #github actually supports that algo.

#webauthn

卡拉今天看了什麼ai_workspace@social.mikala.one
2024-09-15

Better-performing “25519” elliptic-curve cryptography - Amazon Science

Link
📌 Summary:
本篇文章探討了在AWS LibCrypto(AWS-LC)中的x25519和Ed25519加密演算法實現如何透過自動推理和針對特定CPU微架構的優化提高效能與正確性,特別是在保護隱私和對抗側信道攻擊方面。AWS-LC使用自動推理證明功能正確性,同時對於不同微架構的優化設計,使得這些演算法在多種硬體環境下性能顯著提升。根據2023年的數據,新的實作在運算速度上平均提升達到113%,證明了這些方法的有效性,並提供安全的API讓開發人員更容易整合這些加密功能。

🎯 Key Points:
- 文章介紹自動推理在加密演算法中的應用,特別針對AWS-LC中的x25519和Ed25519演算法。
- 最新的實作對於AWS Graviton 2、Graviton 3及Intel Ice Lake微架構的運行速度大幅提升,並且改善功能正確性。
- 確保執行時保護隱私,提升了對側信道攻擊的抵抗能力,實現了恒定且預測性的方法。
- 使用HOL Light進行形式驗證,以保證代碼的正確性,並要求所有代碼變更必須通過正式的正確性證明。
- AWS已釋出各種API以促進與多種程式語言的整合,增加開源使用案例。

🔖 Keywords:
#automated_reasoning #cryptography #x25519 #Ed25519 #AWS_LC

2024-09-13

Native support for ed25519/x25519 in the browser would be a huge step forward for in-browser/client-side cryptography.

Looks like Google is holding up our ability to use it in production.

(Firefox and Safari both have support enabled by default.)

caniuse.com/mdn-api_subtlecryp

#ed25519 #x25519 #cryptography #browsers #web #mozilla #apple #google #firefox #safari #chrome #privacy #security #WebCryptoAPI

Victoria (K8VSY) (she/her)k8vsy@mastodon.radio
2024-09-10

in case you may have not known, if you have a #yubikey or an #onlykey or something similar you can generate SSH keys that require them, for example:

`ssh-keygen -t ed25519-sk`

more info:

security.stackexchange.com/a/2

#SSH #security #ed25519 #sshkeys #linux #openssh

Andrew Tropinabcdw@fosstodon.org
2024-07-30

Refreshing my knowledge on cryptography related topics: OpenPGP, RSA, ed25519.

Looking around yubikey firmware updates and curious what they mean "Expansion and enhancement of public key algorithms" in firmware 5.7. I think RSA-4096 and ed25519 are already supported since 5.2.3. 🤔

yubico.com/blog/now-available-

My current yubikey 5c nano have a broken sensor, so I can't use it for FIDO/TOTP, considering to replace it with 5 nano and 5 NFC (backup)

#openpgp #gnupg #fido #totp #rsa #ed25519 #yubikey

Kevin Karhan :verified:kkarhan@infosec.space
2024-06-17

@soatok @kouhai congratulations, they ported #multisig from #Monero to #ed25519...

  • Which is good...

Tho whoever puts critical tech into the cloud should rethink their career choice, because there is no cloud, only foreign corporations' servers!

Client Info

Server: https://mastodon.social
Version: 2025.04
Repository: https://github.com/cyevgeniy/lmst