Will JavaScript type annotations kill TypeScript?
The creators of Svelte and Turbo 8 both dropped TS recently saying that "it's not worth it".
Yes: If JavaScript gets type annotations then there's no reason for TypeScript to exist.
No: TypeScript remains the best language for structuring large enterprise applications.
TBD: The existing user base and its corpensource owner means that TypeScript isn’t likely to reach EOL without a putting up a fight.
I hope they both die. I mean, if you really need strong types in the browser then you could leverage WASM and use a real programming language.
I don’t know and I don’t care.
Security / Software Development

The Best Public and Private Keygen Algorithm — and Why

The most widely adopted asymmetric crypto algorithms in the PKI world are RSA, DSA, ECDSA, and EdDSA. So which one is best?
Nov 12th, 2020 10:00am by
Featued image for: The Best Public and Private Keygen Algorithm — and Why
Feature image via Pixabay.

Virag Mody
Virag joined Gravitational in January of 2020, after co-founding a software code auditing company for Ethereum applications. He continues to learn about trending technologies and produces high quality written and video content.

What’s worse than leaving private keys lying unattended? Having public keys that can be brute-forced.

The “secure” in “secure shell” comes from the combination of hashing, symmetric encryption, and asymmetric encryption. Together, SSH uses cryptographic primitives to safely connect clients and servers. In the 25 years since its founding, computing power and speeds in accordance with Moore’s Law have necessitated increasingly complicated low-level algorithms.

As of 2020, the most widely adopted asymmetric crypto algorithms in the PKI world are RSA, DSA, ECDSA, and EdDSA. So which one is best?

So Which to Use?

Choosing the right algorithm depends on a few criteria:

  • Implementation: Can the experts handle it, or does it need to be rolled?
  • Compatibility: Are there SSH clients that do not support a method?
  • Performance: How long will it take to generate a sufficiently secure key?
  • Security: Can the public key be derived from the private key? (The use of quantum computing to break encryption is not discussed in this article.)


Implementation RSA libraries can be found for all major languages, including in-depth libraries

(JS, Python, Go, Rust, C).

Compatibility Usage of SHA-1 (OpenSSH) or public keys under 2048-bits may be unsupported.
Performance Larger keys require more time to generate.
Security Specialized algorithms like Quadratic Sieve and General Number Field Sieve exist to factor integers with specific qualities.

Time has been RSA’s greatest ally and greatest enemy. First published in 1977, RSA has the widest support across all SSH clients and languages and has truly stood the test of time as a reliable key generation method. Subsequently, it has also been subject to Moore’s Law for decades and key bit-length has grown in size. According to NIST standards, achieving 128-bit security requires a key with a length of 3072 bits, whereas other algorithms use smaller keys. Bit security measures the number of trials required to brute-force a key. 128-bit security means 2128 trials to break.


Implementation DSA was adopted by FIPS-184 in 1994. It has ample representation in major crypto libraries, similar to RSA.
Compatibility While DSA enjoys support for PuTTY-based clients, OpenSSH 7.0 disables DSA by default.
Performance Significant improvement in key generation times to achieve comparable security strengths, though recommended bit-length is the same as RSA.
Security DSA requires the use of a randomly generated unpredictable and secret value that, if discovered, can reveal the private key.

What makes DSA different from RSA is that DSA uses a different algorithm. It solves an entirely different problem, known as the discrete logarithm problem, using a different set of equations, elements and steps.

This algorithm involves the use of a randomly generated number, m, which is used with signing a message along with a private key, k. This number m must be kept privately. The value mis meant to be a nonce, which is a unique value included in many cryptographic protocols. However, the additional conditions of unpredictability and secrecy make the nonce more akin to a key, and therefore extremely important.

Not only is it difficult to ensure true randomness within a machine, but improper implementation can break encryption. For example:

  1. Android’s Java SecureRandom class was known to create colliding R values. In other words, the class reused some randomly generated numbers. This exposed a number of different Android-based Bitcoin wallets to having their private keys stolen. The requirements of the nonce m mean that any two instances with the same nonce value could be reverse-engineered and reveal the private key used to sign transactions.
  2. Taking this a step further, fail0verflow discovered the private key used to sign firmware updates for the Sony Playstation 3. In other words, programmers could write their own code, sign it with the revealed private key, and run it on the PS3. As it turns out, Sony was using the same random number to sign each message.


The two examples above are not entirely sincere. Both Sony and the Bitcoin protocol employ ECDSA, not DSA proper. ECDSA is an elliptic curve implementation of DSA. Functionally, where RSA and DSA require key lengths of 3072 bits to provide 128 bits of security, ECDSA can accomplish the same with only 256-bit keys. However, ECDSA relies on the same level of randomness as DSA, so the only gain is speed and length, not security.

In response to the desired speeds of elliptic curves and the undesired security risks, another class of curves has gained some notoriety. EdDSA solves the same discrete log problem as DSA/ECDSA, but uses a different family of elliptic curves known as the Edwards Curve (EdDSA uses a Twisted Edwards Curve). While offering slight advantages in speed over ECDSA, its popularity comes from an improvement in security. Instead of relying on a random number for the nonce value, EdDSA generates a nonce deterministically as a hash making it collision-resistant.

Taking a step back, the use of elliptic curves does not automatically guarantee some level of security. Not all curves are the same. Only a few curves have made it past rigorous testing. Luckily, the PKI industry has slowly come to adopt Curve25519 — in particular for EdDSA. Put together that makes the public-key signature algorithm, Ed25519.

Implementation EdDSA is fairly new. Crypto++ and cryptlib do not currently support EdDSA.
Compatibility Compatible with newer clients, Ed25519 has seen the largest adoption among the Edward Curves; although NIST also proposed Ed448 in their recent draft of SP 800-186.
Performance Ed25519 is the fastest performing algorithm across all metrics. As with ECDSA, public keys are twice the length of the desired bit security.
Security EdDSA provides the highest security level compared to key length. It also improves on the insecurities found in ECDSA.

Basically, RSA or EdDSA

When it comes down to it, the choice is between RSA 2048/4096 and Ed25519 and the trade-off is between performance and compatibility. RSA is universally supported among SSH clients, while EdDSA performs much faster and provides the same level of security with significantly smaller keys. Peter Ruppel puts the answer succinctly:

“The short answer to this is: as long as the key strength is good enough for the foreseeable future, it doesn’t really matter. Because here we are considering a signature for authentication within an SSH session. The cryptographic strength of the signature just needs to withstand the current, state-of-the-art attacks.” — Ed25519 for SSH

Just don’t use ECDSA/DSA!

Group Created with Sketch.
TNS owner Insight Partners is an investor in: Pragma, Teleport, Bit.
THE NEW STACK UPDATE A newsletter digest of the week’s most important stories & analyses.