Skip to main content
129 votes

Is it completely safe to publish an ssh public key?

Public Keys are designed for sharing, read access to and or publishing a public key is fine Private Keys are secret, they should only be accessible to the owner of said private key. To drive this ...
CaffeineAddiction's user avatar
65 votes

Is it completely safe to publish an ssh public key?

Is it completely safe to publish an ssh public key? No, but you can do it anyway without worries (lots of people do, just look at https://sks-keyservers.net/i/ or https://pgp.mit.edu/) The reason why ...
Out of Band's user avatar
  • 9,283
41 votes
Accepted

Does public key cryptography provide any security advantages, or even just a different security model, over symmetric cryptography?

You incorrectly assume that a secure channel is needed to obtain a public key. This is not the case. It's sufficient to have a trusted third party bind a public key to a specific identity through a ...
Ja1024's user avatar
  • 12k
40 votes

Is it completely safe to publish an ssh public key?

Nothing is "completely safe"; the question is whether it adds any additional risks. The SSH protocol sends the client's public key encrypted, only after it has negotiated a symmetric session ...
Luis Casillas's user avatar
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

Is it completely safe to publish an ssh public key?

No, unless you use a unique one per service. It lets attackers identify you. If you use the same public key for service A and service B, and your public key gets leaked for both of them, this will ...
user541686's user avatar
  • 2,572
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
22 votes
Accepted

What is the difference between Key, Certificate and Signing in GPG?

In public key cryptography, the key is usually a key pair, consisting of a public key and a private key, and it is what you do encryption, decryption, signing, and verification with. "A key ...
Matei David's user avatar
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
18 votes
Accepted

Why is asymmetric encryption less efficient than symmetric encryption?

This depends on the algorithm. Especially with asymmetric cryptography, the speeds vary wildly. You may want to check out eBACS for more detailed and machine-independent benchmarking of various crypto ...
forest's user avatar
  • 67k
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
14 votes

Is it completely safe to publish an ssh public key?

There is a slight risk of revealing your identity if your public key contains your hostname as a comment at the end, e.g. ssh-rsa C4F3B4B3... [email protected]. If your name is fairly uncommon ...
whirlwin's user avatar
  • 241
14 votes
Accepted

Why do the roles of public/private keys reverse when talking about public key encryption and digital signatures?

I cannot reconcile in my head how or why the roles of the keys suddenly reverses. (I'm primarily focusing on RSA signatures.) Anyone can produce an encrypted message (by using your public key) and ...
Arminius's user avatar
  • 45k
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
12 votes
Accepted

How to encrypt using a private key file generated by OpenSSL?

Do not use the OpenSSL command line to encrypt or sign anything. The OpenSSL command line is a debugging tool. To encrypt or sign a message, use a tool designed for this purpose, such as GPG. A ...
Gilles 'SO- stop being evil''s user avatar
12 votes

Does public key cryptography provide any security advantages, or even just a different security model, over symmetric cryptography?

In addition to the factors mentioned in other answers, preshared keys force the third party (Carol, in your example) to know exactly which parties are communicating. With public-key certificates, Bob ...
ruakh's user avatar
  • 229
11 votes

"Diffie-Hellman Key Exchange" in plain English

Securing data as it passes through the internet usually requires protecting it in two ways: Confidentiality -- assuring no one except the intended recipients can read the data Integrity -- assuring ...
Eddie's user avatar
  • 781
11 votes
Accepted

Ways to generate symmetric and asymmetric keys

You seem to ask for a comparative study on the PRNG (pseudo-random number generators) used by default by OpenSSL and the Linux kernel. This could most probably fill a volume full of mathematical ...
WhiteWinterWolf's user avatar
11 votes

How to encrypt using a private key file generated by OpenSSL?

The private key is used to decrypt, and to sign things. You don't use it to encrypt. You use the public key for that. But openssl genrsa will not generate the public key, only the private. To encrypt ...
ThoriumBR's user avatar
  • 54.6k
10 votes

Can data be decrypted with the public key if encrypted with the private key?

The usage of asymmetric keys is as follows: Encryption is done using the public key Signing is done using the private key Encryption: The data is encrypted using the public key The encrypted data ...
Yaron's user avatar
  • 522
10 votes
Accepted

How does the Certificate Authority work

The CA doesn't send any public keys to clients. The CA signs the server's public key with their private key and then gives that signature to the server. When the client connects to a server, the ...
Philipp's user avatar
  • 49.5k
10 votes

What gpg defaults can be improved, when performance is not an issue?

1) password hashing iterations If you don't care about waiting a little longer, you can use the maximum count value, which is 65011712. This isn't strictly the number of iterations so much as the ...
forest's user avatar
  • 67k
10 votes
Accepted

Create encryption key from decryption key (password)?

One way to do this is to use elliptic curve (EC) cryptography. Alice could start by taking a SHA256 hash of her password, which would result in a 256-bit value which she could use as her private key. ...
mti2935's user avatar
  • 23.7k
9 votes
Accepted

Log in without password using SSH, knowing authorized_keys?

You cannot generate a private key from a public key. That's the whole point of public-key cryptography. The public key is not encrypted. Even if you don't understand what the numbers do, they're in a ...
Gilles 'SO- stop being evil''s user avatar
9 votes

Can data be decrypted with the public key if encrypted with the private key?

Looks like public key is not secret. But if I encrypt with private, someone can decrypt with public which is easy accessible. Where is logic? So let's go the public encrypt -> private decrypt route. ...
Kritner's user avatar
  • 231
9 votes
Accepted

Asymmetric encryption of very small messages

Probably the best you can do is to use Curve25519 to derive a secret and then use the secret to derive a key and IV which are used to encrypt the data symmetrically with an AEAD. That would expand ...
bk2204's user avatar
  • 9,574
8 votes

Why do the roles of public/private keys reverse when talking about public key encryption and digital signatures?

I understand the principles of these two uses of public key cryptography, but I cannot reconcile in my head how or why the roles of the keys suddenly reverses. That is the only way it makes ...
mat's user avatar
  • 1,272
7 votes
Accepted

Why don't digital signatures reveal the senders Private Key

There seems to be some confusion here about the difference between digitally signing and directed message encryption. If I digitally sign something I indeed need a private key to do so. But you can ...
Nalaurien's user avatar
  • 1,664
7 votes

Storing User's Private Keys in DB

IMHO you have a questionable design here. When I read my server application can sign files on their [my users] behalf all lights suddenly flash red. If your application can sign something on ...
Serge Ballesta's user avatar
7 votes

Does public key cryptography provide any security advantages, or even just a different security model, over symmetric cryptography?

Emphasis mine: Alice's public key is useless to Bob unless he can prove that the public key came from Alice. To do this, Bob and Alice can establish a secure channel to exchange Alice's the public ...
Jason's user avatar
  • 71

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