Questions tagged [public-key-encryption]

An cryptographic scheme which uses two mathematically related keys; a public and a private key where a message encrypted with public key can only be decrypted with the private key and vice-versa.

The most important element of public key encryption is that the public and private keys are related in such a way that only the public key can be used to encrypt a message and only the matching private key can be used to decrypt it. In addition, it is practically impossible to derive the private key with only the knowledge of the public key. Public-key systems such as PGP, SSL and many others benefit from this mathematically well-defined behavior of public key encryption. It is important to note that public key encryption is mostly called asymmetric encryption because it uses two keys instead of one key as opposed to symmetric encryption.

1918 questions
552
votes
10 answers

Use RSA private key to generate public key?

I don't really understand this one: According to https://www.madboa.com/geek/openssl/#key-rsa, you can generate a public key from a private key. openssl genrsa -out mykey.pem 1024 openssl rsa -in mykey.pem -pubout > mykey.pub My initial thinking…
c2h2
  • 11,911
  • 13
  • 48
  • 60
328
votes
10 answers

How does a public key verify a signature?

I am trying to get a better grapple on how public/private keys work. I understand that a sender may add a digital signature to a document using his/her private key to essentially obtain a hash of the document, but what I do not understand is how the…
310
votes
6 answers

Is there a way to "autosign" commits in Git with a GPG key?

Is there an easy way to make Git always signs each commit or tag that is created? I tried it with something like: alias commit = commit -S But that didn't do the trick. I don't want to install a different program to make this happen. Is it doable…
MindTooth
  • 4,992
  • 4
  • 20
  • 15
209
votes
15 answers

Unable to load config info from /usr/local/ssl/openssl.cnf on Windows

While using OpenSSL on Windows: openssl genrsa -out privatekey.pem 1024 --> Created successfully openssl req -new -x509 -key privatekey.pem -out publickey.cer -days 365 ----> Showing error message as unable to load config info from…
karthik
  • 2,333
  • 2
  • 13
  • 11
177
votes
2 answers

gnupg: There is no assurance this key belongs to the named user

I'm trying to use interesting password management tool named Pass. I did the following: Installed gpg tool $ sudo dnf install gpg Generated a key using $ gpg --gen-key Typed $ pass init "foobar id of my gpg key" as stated here Got mkdir: created…
Ivan Talalaev
  • 6,014
  • 9
  • 40
  • 49
174
votes
3 answers

RSA Public Key format

Where can i find some documentation on the format of an RSA public key? An RSA public key formatted by OpenSSH: ssh-rsa…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
160
votes
6 answers

How to extract public key using OpenSSL?

The following command generates a file which contains both public and private key: openssl genrsa -des3 -out privkey.pem 2048 Source: here With OpenSSL, the private key contains the public key information as well, so a public key doesn't need to be…
Jake
  • 16,329
  • 50
  • 126
  • 202
121
votes
13 answers

Setting up OpenSSH for Windows using public key authentication

I am having issues setting up OpenSSH for Windows, using public key authentication. I have this working on my local desktop and can ssh with a key from Unix machines or other OpenSSH for Windows machines. I have replicated the build onto a server, I…
Cambolie
  • 1,415
  • 2
  • 12
  • 14
107
votes
5 answers

What's the difference between id_rsa.pub and id_dsa.pub?

Is one more secure than the other?
Andrew
  • 1,071
  • 2
  • 8
  • 3
81
votes
1 answer

what is the difference between various keys in public key encryption

I am confused between various keys used in encryption. Amazon gave me key.pem In linux i generate keys like id_rsa and id_rsa.pub Now putty used key like key.ppk I am really confused what type of key is used where
user22
  • 1,199
  • 2
  • 12
  • 15
61
votes
12 answers

gpg decryption fails with no secret key error

I have a gpg .key file that is used as passphrase for decrypting a .dat.pgp file. The encrypted .data.pgp file gets successfully decrypted on one server with same .key file using following command cat xxx_gpg.key | /usr/bin/gpg --batch --quiet -o…
fortm
  • 4,066
  • 5
  • 49
  • 79
60
votes
12 answers

Cracking short RSA keys

Given the following RSA keys, how does one go about determining what the values of p and q are? Public Key: (10142789312725007, 5) Private Key: (10142789312725007, 8114231289041741)
Donald T
  • 10,234
  • 17
  • 63
  • 91
57
votes
6 answers

Encrypting data with a public key in Node.js

I need to encrypt a string using a public key (.pem file), and then sign it using a private key (also a .pem). I am loading the .pem files fine: publicCert = fs.readFileSync(publicCertFile).toString(); But after hours of scouring Google, I can't…
Clint
  • 2,871
  • 2
  • 25
  • 28
51
votes
1 answer

Can we have multiple public keys with a single private key for RSA?

Can we have multiple public keys associated with a single private key for RSA public-key encryption?
Priyank Bolia
  • 14,077
  • 14
  • 61
  • 82
50
votes
5 answers

RSA Encryption Decryption in Android

I am implementing a demo for RSA Encryption and Decryption in Android. I can Perform Encryption very well, but In Decryption I get an Exception: >>java.security.InvalidKeyException: unknown key type passed to RSA. KeyPairGenerator kpg; …
Riddhi Barbhaya
  • 1,205
  • 1
  • 11
  • 19
1
2 3
99 100