Skip to main content
77 votes

Can I get a public key from an RSA private key?

can I get a public key? It's easy using openssl rsa: $ openssl rsa -in the-private-key-from-your-question.pem -pubout writing RSA key -----BEGIN PUBLIC KEY----- ...
Steffen Ullrich's user avatar
64 votes

What is RSA OAEP & RSA PSS in simple terms

"Textbook"/"raw"/"unpadded" RSA has an "oops, the real world happened" problem. Consider any RSA key whose modulus is 4096-bit. It should be nearly impossible ...
bartonjs's user avatar
  • 1,878
49 votes

How does OpenSSL generate a big prime number so fast?

Testing for primality is much easier than performing integer factorization. There are several ways to test for primality, such as the deterministic Sieve of Eratosthenes and the probabilistic Miller–...
forest's user avatar
  • 67k
48 votes

Can I get a public key from an RSA private key?

In practice, yes, you can get the public key from the private key. In principle, it would be possible to create an RSA private key from which the corresponding public key cannot be easily obtained, ...
Ilmari Karonen's user avatar
47 votes
Accepted

PEM, CER, CRT, P12 - what is it all about?

openssl genrsa -out private.pem gives me a PEM file which includes only private key Not really. In principle RSA can store just a privatekey with no publickey, but the RSAPrivateKey format used by ...
dave_thompson_085's user avatar
39 votes

Is allowing root login in SSH with "PermitRootLogin without-password" a secure method?

This is a common misunderstanding for the PermitRootLogin feature. The without-password option does not mean there is no authentication and anyone can get in without a password. All this option means ...
forest's user avatar
  • 67k
39 votes

Why don't folks seem to use ECC for TLS root certificate signature?

There's a slide deck on NIST by Rick Andrews, Senior Technical Director and Distinguished Engineer of Symantec, titled Symantec’s View of the Current State of ECDSA on the Web (published 2015) ...
phbits's user avatar
  • 1,062
34 votes

SSH Key: Ed25519 vs RSA

According to gitlab The book Practical Cryptography With Go suggests that ED25519 keys are more secure and performant than RSA keys. and recommends If you use RSA keys for SSH ... that you use a ...
M-892's user avatar
  • 441
33 votes
Accepted

ssh-keygen: What is the passphrase for?

$ man ssh-keygen [...] It is possible to specify a passphrase when generating the key; that passphrase will be used to encrypt the private part of this file using 128-bit AES. So this passphrase just ...
Luc's user avatar
  • 33k
28 votes
Accepted

Which host key algorithm is best to use for SSH?

Currently, RSA is still recommended as a gold standard (strong, widely compatible). ed25519 is good (independent of NIST, but not compatible with all old clients). Server is usually providing more ...
Jakuje's user avatar
  • 5,879
27 votes

Why don't folks seem to use ECC for TLS root certificate signature?

TL;DR: There is nothing technically wrong with ECC; in fact it has better bandwidth and server CPU load than RSA (but higher CPU load on browsers, thanks @CodesInChaos), but for historical reasons it ...
Mike Ounsworth's user avatar
25 votes
Accepted

JWT: Choosing between HMAC and RSA

HMAC is used to prevent manipulation by someone who does not have access to the secret. Typically this means preventing manipulation by the client if the secret is only known to the server or to ...
Steffen Ullrich's user avatar
23 votes
Accepted

Manually walking through the signature validation of a certificate

This is an awesome idea - to manually trace through the cert validation process! I've enjoyed reading through your steps, since I've never actually done it myself! Answering your questions: First ...
Mike Ounsworth's user avatar
23 votes

Which host key algorithm is best to use for SSH?

Since the algorithms are in a state of flux, I find that using an ssh-audit tool (available on Github) (here's a more recent fork) to be extremely useful. Example output of a current but secured SSH ...
John Greene's user avatar
23 votes
Accepted

SSH key strength factor besides key length (say ed25519 vs rsa-4096)

Right, welcome to a crypto-nerd battle. Let's try and break this down. Key length: ed25519 is from a branch of cryptography called "elliptic curve cryptography (ECC)". RSA is based on fairly simple ...
Mike Ounsworth's user avatar
22 votes

What's the difference between the endorsement key and the attestation identity key within the TPM?

Unfortunately there is not a single source of truth about attestation. I'll try to make it as clear as possible and cite when necessary. TL;DR: The Endorsement Key is used to prove that you are ...
MemAllox's user avatar
  • 591
22 votes
Accepted

How to ensure identity for server-to-server communication over IP

Basically you are trying to re-invent certificate based authentication since you only have an IP address and not a domain. But certificate based authentication can be used without a domain too, for ...
Steffen Ullrich's user avatar
20 votes
Accepted

Is using "SHA-256 with RSA-2048 Encryption" a secure certificate hashing algorithm?

The technical answer is actually "no, because SHA-256 with RSA-2048 Encryption is not a certificate hashing algorithm. However, SHA-256 is a perfectly good secure hashing algorithm and quite suitable ...
CBHacking's user avatar
  • 49.6k
20 votes

Which host key algorithm is best to use for SSH?

CHOOSING AN ALGORITHM AND KEY SIZE SSH supports several public key algorithms for authentication keys. These include: rsa - an old algorithm based on the difficulty of factoring large numbers. A key ...
cdmo's user avatar
  • 309
20 votes
Accepted

When exactly is Diffie-Hellman used in TLS?

DH is a key exchange algorithm, it is used to derive the session key that's later used in the symmetric encryption. DH by itself is not authenticated, so while you can derive the session key without a ...
Lie Ryan's user avatar
  • 31.5k
19 votes
Accepted

RSA key exchange

TL;DR: Skip to "Using result of DH". Because you started with "I want to create a message exchange program" together with "I don’t know how to use DH", a tedious preface: ...
Z.T.'s user avatar
  • 8,534
18 votes
Accepted

What are the differences between the RSA, DSA, and ECDSA keys that SSH uses?

What are these files for? These are your host keys uniquely identifying your host. When OpenSSH is started for the first time, it will generate these keypairs. When an SSH client connects to your ...
forest's user avatar
  • 67k
18 votes
Accepted

The maximum size of a file that I can encrypt with a specific key size

First of all, a 1024-bit RSA key is much too small for comfort. Current recommendations for RSA are a debate between 3072 or 4096 (better security margin) vs. 2048 (better performance). See: https://...
Luis Casillas's user avatar
17 votes

Is it less secure to encrypt an hexadecimal encoded string?

It makes absolutely no difference to the cryptographic strength. If the contents of the plaintext affected the security of the cipher, then the cipher would be broken. That said, it looks like the ...
Polynomial's user avatar
  • 135k
15 votes

Recommended asymmetric algorithms for JWT?

The short answer is to use RS256, to be understood as SHA 256 with RSA 2048 bits keys. See RFC 7518 JSON Web Algorithms (JWA) for all supported algorithms. On signing algorithms There are two major ...
user5994461's user avatar
  • 1,296
15 votes
Accepted

Why don't folks seem to use ECC for TLS root certificate signature?

It's uncommon to see a signature by a root certificate using ECDSA, because most root certificates contain RSA public keys, not ECC public keys. Moreover, because root certificates must be installed ...
mti2935's user avatar
  • 23.7k
14 votes
Accepted

Checking if an RSA private key is passphrase protected

Just open it, if it's encrypted it will begin with -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: AES-128-CBC,0F5C7993DCFA4C0962CE249CFD854B91 if it is not it will begin directly ...
Sefa's user avatar
  • 1,754
14 votes
Accepted

Where to store private and public keys?

Public key: that's the easy part, it can be almost anywhere (known URL, some type of file store like S3/GCS/..., even source control). The only concern is to make sure it is not modified, but it can ...
Marc's user avatar
  • 4,301
13 votes
Accepted

Is it more secure for SSH clients to use a Private Key (RSA-2048) or a long random password (256 bits of entropy)?

Quantum computing is not yet a reality, so it is premature for you to invest resources in combating this ahead of the SSH standard. Assuming identity of the server is verified, both options are ...
700 Software's user avatar
13 votes
Accepted

How to interpret this statement against 4096-bit RSA

The reasoning in the quoted advice is poor: The United States’ National Institute of Standards and Technology (NIST) states that RSA‑2048 gives roughly 112 bits of security and RSA‑3072 gives roughly ...
fgrieu's user avatar
  • 1,253

Only top scored, non community-wiki answers of a minimum length are eligible