Questions tagged [public-key]

Public-key (or asymmetric) cryptography is a form of cryptography that does not require common secrets between the communicating partners.

Public-key cryptography or asymmetric cryptography is a form of cryptography that does not require common secrets between the communicating partners. It thus solves the problem of key-exchange. In many modern cryptosystems, public-key cryptography is used to establish a secret key, and the faster symmetric key crypto is used to actually encrypt and decrypt data.

Public-key cryptography is generally based on "one-way" mathematical functions - operations that are easy to perform, but difficult to undo. An example (on which RSA is based) is multiplication vs. factoring. Given two enormous primes p and q, it is simple (for a computer) to multiply them together to get p*q = n, but it turns out it is very difficult (even for a computer) to factor n in a reasonable amount of time.

1163 questions
25
votes
1 answer

What are the differences between JWT RS256, RS384, and RS512 algorithms?

I'm using JWT RS256 algorithm in my current project, but I'm wondering what are the differences between algorithms RS256, RS384, and RS512. Can someone explain to me what are the key differences in these algorithms?
Jayampathy Wijesena
  • 1,670
  • 1
  • 18
  • 26
25
votes
7 answers

Read public key from file in keystore

Hi I want to extract public key from KeyStore using Java code I am creating a keystore keytool -genkey -alias mykeystore -keyalg RSA -keystore mykeystore.jks -keysize 2048 And exporting the public into another file keytool -export -alias mykeystore…
iCode
  • 8,892
  • 21
  • 57
  • 91
24
votes
3 answers

How to check a public RSA key file

Inside a shell script I want verify public RSA file. All I want to do is that find a way to check this file is a genuine public key file, nothing else. Can I ask experts here what are the ways I can verify this input file to check this is a genuine…
csf
  • 529
  • 1
  • 4
  • 16
23
votes
3 answers

How can I get SecKeyRef from DER/PEM file

I need to integrate my iPhone app with a system, and they require to encrypt data by a given public key, there are 3 files in 3 different format .xml .der and .pem, I have researched and found some articles about getting SecKeyRef from DER/PEM, but…
Son Nguyen
  • 3,481
  • 4
  • 33
  • 47
22
votes
13 answers

Google Cloud Platform: SSH to Google cloud instance will have "Permission denied (publickey)"

I have come across the issue as below when I use ssh login google cloud instance $ ssh -i DD2 root@35.237.32.84 Permission denied (publickey). After some testing, I found that the cause of the error is that public key signature is not consistent…
wherby
  • 704
  • 1
  • 5
  • 16
22
votes
3 answers

How to resolve Java UnknownHostKey, while using JSch SFTP library?

I'm running a java program where I transfer a file from one folder to another, using Java SFTP. The problem I'm having is that I'm getting the following error in my Java SFTP (using JSch)…
Caffeinated
  • 11,982
  • 40
  • 122
  • 216
21
votes
3 answers

Get public key from private in Java

I remember do this long time ago with OpenSSL, but I want to know if it's possible and how, I've never used Cryptography on java.
BRabbit27
  • 6,333
  • 17
  • 90
  • 161
21
votes
2 answers

Where does jwt.io get the public key from JWT token?

I was decoding a JWT token via jwt.io (in the Debugger section) to see Headers, Payload. Surprisingly, it also verified, and I could see it (jwt.io debugger) is able to retrieve the public key as well. So my question is: Does JWT token provide the…
CuriousMind
  • 8,301
  • 22
  • 65
  • 134
19
votes
8 answers

DSA: What can a hacker do with *just* a public key?

The shareware registration system I'm currently developing embeds the public DSA key in the executable itself, and the private key resides on a server. (For the sake of discussion let's assume that the server is 100% secure, and there is no way for…
kurige
  • 3,749
  • 2
  • 21
  • 24
19
votes
2 answers

.ssh config with amazon ec2 and git

I have a strange problem with cloning a git repository from an amazon ec2 server. It works without any problems on one of my computers running ubuntu 12.04, while on another one using 12.10 it gives me an error: ssh: Could not resolve hostname…
Pio
  • 4,044
  • 11
  • 46
  • 81
19
votes
1 answer

Extract public key from certificate in DER format

I have a .cer certificate file, and need to extract the Public Key. I can only extract to PEM format. The "outform" parameter does nothing. openssl x509 -inform PEM -in certificate.cer -outform DER -pubkey -noout > publickey.der Is it possible to…
marcolopes
  • 9,232
  • 14
  • 54
  • 65
18
votes
1 answer

SSH Public Key Authentication with Libssh2 C++

I am working on a project where I am doing port forwarding to MySQL using libssh2 in C++. I've got it working for username/password authentication but I now want do it using public/private key authentication. The documentation for libssh2 is pretty…
Boardy
  • 35,417
  • 104
  • 256
  • 447
18
votes
3 answers

How to create a X509 certificate using Java?

I want to create a X509 certificate using Java language and then extract public key from it. I have searched the internet and found many code examples, but all of them have errors (unknown variable or unknown type) or have many warnings that say…
leyla moazami
  • 217
  • 1
  • 2
  • 10
18
votes
6 answers

Reading PEM RSA Public Key Only using Bouncy Castle

I am trying to use C# to read in a .pem file that contains only a RSA public key. I do not have access to the private key information, nor does my application require it. The file myprivatekey.pem file begins with -----BEGIN PUBLIC KEY----- and…
cytinus
  • 5,467
  • 8
  • 36
  • 47
17
votes
3 answers

Ruby - hosting private gems

By any chance, is there any place it's possible to host private ruby gems? So I could allow it to be pulled only for specific places by using public key or something like that? Thanks
zanona
  • 12,345
  • 25
  • 86
  • 141