123 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
62 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,233
57 votes
Accepted

Why is key exchange necessary at all?

If the attacker is able to passively capture data and later gets access to the private key of the certificates (i.e. stealing, heartbleed attack or law enforcement), then the attacker could decode all ...
Steffen Ullrich's user avatar
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
  • 3,338
37 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
26 votes

"Diffie-Hellman Key Exchange" in plain English

The key exchange problem A secure connection requires the exchange of keys. But the keys themselves would need to be transfered on a secure connection. There are two possible solution: exchange the ...
aiao's user avatar
  • 409
26 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,542
23 votes
Accepted

Which host key algorithm is best to use for SSH?

Currently, RSA is still recommended as a gold standard (strong, wide compatible) ed25519 is good (independent of NIST, but not compatible with all old clients). Server is usually providing more ...
Jakuje's user avatar
  • 5,549
20 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
20 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
18 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 ...
cdmo's user avatar
  • 281
17 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
  • 66.3k
16 votes

Why is key exchange necessary at all?

There are many steps needed to understand the reasons and I will try to guide you through each. 1) Use encryption correctly... With RSA algorithm, Alice and Bob can just share their public keys (...
Gudradain's user avatar
  • 6,971
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
  • 44.5k
14 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,266
13 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
  • 231
13 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
  • 771
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
  • 52.8k
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.2k
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
  • 66.3k
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
  • 22.1k
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,194
8 votes

What are the disadvantages of using public key cryptography when encrypting files?

Your friend is correct in that private key encryption is not the tool for the job. This answer on Cryptography.SE does a good job of explaining why. Some highlights: Any public-key encryption ...
Anders's user avatar
  • 65.2k

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