In 2010 the PlayStation 3's firmware signing key was recovered not by breaking ECDSA but because the signer used the same nonce for every signature. A few years later, Android wallets drained because a weak SecureRandom handed out colliding nonces to Bitcoin's ECDSA. In both cases the curve was fine, the key length was fine, the math was fine. One reused per-signature number undid all of it.
For a licensing system this is the nightmare scenario, because the signing key is the entire security story. A Keyright license key is a signed claims payload — tier, seats, expiry — that your application verifies offline against an embedded public key. Recover the private key and an attacker does not crack one license; they mint unlimited valid ones that every copy of your software in the field will trust. So the question underneath "which curve?" is quieter and sharper: where does each signature's nonce come from, and what happens if it is ever wrong?
The nonce is the whole exposure
An ECDSA signature over a message whose hash is e, using private key d and a per-signature secret nonce k, is the pair:
r = (k · G).x mod n s = k⁻¹ · (e + r · d) mod n G is the curve's base point and n the group order. Two things matter here. First, r depends only on k and the fixed base point — not on the message. Second, k must be secret and must never repeat. The reason is the second equation: it is a single linear relation that mixes the secret you must protect (d) with the secret you must keep fresh (k). Reuse k and you hand an attacker a second equation in the same two unknowns.
Two signatures, one key
Suppose Keyright signs two different license payloads and, through a bad RNG or a careless custom signer, both signings use the same k. Because r is a function of k alone, both signatures carry the identical r. That single repeated value is the tell, and it is visible to anyone who collects two of your keys.
Write the s equation for each signature and subtract. The r·d term is identical in both, so it cancels:
s₁ − s₂ = k⁻¹ · (e₁ − e₂) mod n k = (e₁ − e₂) · (s₁ − s₂)⁻¹ mod n Now k is known. Put it back into the first signature's equation and solve for the one remaining unknown:
d = (s₁ · k − e₁) · r⁻¹ mod n That is the private signing key. Everything on the right-hand side — r, s₁, s₂, e₁, e₂ — is public, present in the two license keys an attacker already holds. The recovery is not an approximation or a search; it is exact arithmetic. In C# with System.Numerics.BigInteger it is a handful of lines, because n is prime and the modular inverse is a single ModPow:
static BigInteger Mod(BigInteger x, BigInteger n) => ((x % n) + n) % n; static BigInteger Inv(BigInteger x, BigInteger n) => BigInteger.ModPow(Mod(x, n), n - 2, n); // Two signatures (r, s1), (r, s2) that reused k, over message hashes e1, e2. static BigInteger RecoverPrivateKey( BigInteger r, BigInteger s1, BigInteger s2, BigInteger e1, BigInteger e2, BigInteger n) { BigInteger k = Mod((e1 - e2) * Inv(s1 - s2, n), n); return Mod((s1 * k - e1) * Inv(r, n), n); // = d } And the honest, more alarming point: you do not need full reuse. If k is merely biased — a few bits predictable because the RNG was seeded poorly or truncated — lattice attacks recover d from a few dozen signatures without any two ever colliding. "The nonce must be uniform and unique" is not a style guideline. It is load-bearing.
RFC 6979: take the RNG out of the loop
The fix is to stop drawing k from a random source at all. RFC 6979 derives the nonce deterministically by running HMAC-DRBG seeded from the private key and the message hash:
k = HMAC_DRBG( seed = d ‖ H(message) ) This gives you everything the security proof needs. The nonce is unique per message, because the message hash is part of the seed. It is unpredictable to anyone without d, because it comes out of an HMAC keyed by the private key. And it depends on no runtime entropy whatsoever — a virtual machine with a broken RNG, a cloned container, an early-boot process with an unseeded pool all produce the correct nonce anyway, because the nonce was never random to begin with.
The property that makes this safe to adopt is that it is invisible on the wire. The output is still an ordinary (r, s) pair over the same curve. A verifier recomputes nothing about k; it only checks the relation holds against the public key. So switching to deterministic nonces changes no verification code, no public key, no key format — it is a change entirely on the signing side that a client can neither detect nor care about.
One thing to settle up front, because it is a common misconception: RFC 6979 is a property of a particular signing implementation, and .NET's built-in ECDsa does not provide it. In .NET you reach deterministic ECDSA through a third-party library such as BouncyCastle, or you sidestep the question entirely with Ed25519. The next section shows what the in-box API does instead — and it is not this.
What .NET actually does
On .NET, ECDsa.SignData does not use RFC 6979. It draws a fresh, random nonce for every signature from the platform crypto provider — ECDsaCng on Windows, ECDsaOpenSsl on Linux and macOS — so the output is non-deterministic by design. Here is Keyright signing a canonical license payload:
// Stable, sorted, whitespace-free bytes — the same input must hash the same way. byte[] payload = LicenseCodec.Canonicalize(claims); using ECDsa signingKey = ECDsa.Create(); signingKey.ImportPkcs8PrivateKey(privateKeyDer, out _); // Compact 64-byte r‖s on P-256 so the key stays typeable. byte[] signature = signingKey.SignData( payload, HashAlgorithmName.SHA256, DSASignatureFormat.IeeeP1363FixedFieldConcatenation); You can see this directly — the randomness is observable. Sign the same bytes twice and compare: because k is fresh each time, r differs and the two signatures do not match.
byte[] a = signingKey.SignData(payload, HashAlgorithmName.SHA256); byte[] b = signingKey.SignData(payload, HashAlgorithmName.SHA256); bool deterministic = a.AsSpan().SequenceEqual(b); // false on .NET: ECDsa draws a fresh random nonce each time A false here is expected, not a vulnerability. Randomized k is perfectly safe as long as the generator behind it is sound — the danger was never randomness per se, but reuse or bias, which a healthy OS CSP does not produce. Running the test is still worthwhile: it documents that your signer is randomized, and it would catch the opposite surprise — a signer that is unexpectedly deterministic because someone swapped in a library or a broken provider.
It is worth looking at what the signing call compiles to, because it explains why the safety of k is a property of the runtime's provider and not of your code. The method above lowers to this:
.method private hidebysig static uint8[] SignPayload( class [System.Security.Cryptography]System.Security.Cryptography.ECDsa key, uint8[] payload) cil managed { .maxstack 8 IL_0000: ldarg.0 IL_0001: ldarg.1 IL_0002: call valuetype [System.Security.Cryptography]System.Security.Cryptography.HashAlgorithmName [System.Security.Cryptography]System.Security.Cryptography.HashAlgorithmName::get_SHA256() IL_0007: ldc.i4.1 IL_0008: callvirt instance uint8[] [System.Security.Cryptography]System.Security.Cryptography.ECDsa::SignData( uint8[], valuetype HashAlgorithmName, valuetype DSASignatureFormat) IL_000d: ret } Read what is on the evaluation stack before the callvirt: the key, the payload, the hash name, and the integer 1 for the P1363 format. That is all. There is no call into any random source, no local holding k, nothing your code contributes to the nonce. The entire choice of k happens inside SignData, which is precisely why "is my nonce safe?" reduces to "what crypto provider is my runtime bound to?" rather than anything your IL reveals.
How this applies to signing license keys
The practical rules fall straight out of the mechanism:
- Never supply
kyourself. There is noSignDataoverload that asks you for a nonce, and that is a feature. The most dangerous value in the system belongs on the code path least likely to mishandle it — the framework's, not yours. - Know whether your signer is randomized or deterministic. Run the two-signature comparison above in your issuing process, on the runtime and OS you deploy. On the in-box
ECDsait returnsfalse(randomk), which is fine — what you are confirming is that you understand which mode you are in, and that a dependency swap has not silently changed it. - Canonicalize before you sign. Deterministic signing only helps if the input is deterministic. If
Canonicalizeemits keys in hash-map order or includes incidental whitespace, the same logical license hashes two different ways and you have reintroduced variability one layer up. - Keep the raw 64-byte
IEEE P1363form. It keeps the key short and fixed-width; a DER-wrapped signature wobbles in length and complicates parsing. (It has no bearing on nonce safety — just on key ergonomics.)
When it still breaks
ECDsa.SignData's randomized nonce is exactly as safe as the entropy source behind it, and no safer. That is usually fine — a modern OS CSP does not reuse or bias k. But the guarantee is the RNG's, not the algorithm's: a cloned VM that forks a seeded pool, a broken or early-boot generator, or a container image that ships predictable entropy can all drag you toward the PS3's position without a line of your code changing. And remember that bias, not just reuse, is enough — a few predictable bits across a few dozen signatures suffices — so a hand-rolled "deterministic" nonce is not obviously safer than the framework's if it is flawed. The clean ways out are an audited RFC 6979 implementation (a library such as BouncyCastle, not the BCL) or an algorithm with no nonce to get wrong.
If you would rather not reason about the entropy source at all, remove the nonce as a user-visible concept: Ed25519 folds deterministic nonce derivation into the signature algorithm itself, so there is no k to reuse regardless of runtime, RNG or language. That is why it is Keyright's default. ECDSA stays a strong, standards-conformant choice when a target constrains you to it — just understand that the BCL hands you a random nonce, and that making it deterministic means reaching for RFC 6979 through a library rather than flipping a flag in the box.
Takeaway
ECDSA's security rests on a per-signature secret you never see and must never repeat, and the cost of getting it wrong is not a forged license but your entire signing key. On .NET that secret is random, drawn from the platform RNG — safe while that generator is healthy, and dangerous exactly when it is not. RFC 6979 (through a library) or Ed25519 remove that dependence at the root by deriving k from the key and the message, so a broken RNG can no longer leak the key; both keep the signature an ordinary, verifiable (r, s) pair. Sign canonical bytes, never supply k yourself, and if you want randomness out of the trust equation, reach for Ed25519 — Keyright's default — rather than trusting every machine's entropy.