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
44
votes
5 answers

How to load the RSA public key from file in C#

I need to load the following RSA public key from a file for use with the RSACryptoServiceProvider class. How can I do this? -----BEGIN PUBLIC…
goodolddays
  • 2,595
  • 4
  • 34
  • 51
42
votes
1 answer

How to convert Byte array to PrivateKey or PublicKey type?

I am using RSA algorithm to generate public and private key final KeyPairGenerator keyGen = KeyPairGenerator.getInstance(ALGORITHM); keyGen.initialize(1024); final KeyPair key = keyGen.generateKeyPair(); final PrivateKey…
sufala
  • 553
  • 4
  • 11
  • 19
41
votes
1 answer

Use and utility of .p12 certificate/file

What is the utility of .p12 file/certificate? I am not getting any correct definition when searching the internet: In one site I got "it stores server side certificates along with intermediate certificates and private key in one file. Its mostly…
Pallab
  • 687
  • 1
  • 7
  • 15
41
votes
5 answers

Encrypt in Javascript, decrypt in PHP, using public-key cryptography

I'd like to encrypt in JavaScript, decrypt in PHP, using public-key cryptography. I've been trying to find libraries that can accomplish this, but am having issues. I am currently looking at openpgpjs, but I need support in all browsers, and even…
oxygen
  • 5,891
  • 6
  • 37
  • 69
36
votes
13 answers

Permission denied (publickey,gssapi-keyex,gssapi-with-mic) on openshift

I am having issues with committing changes to my gear. I have tried to run rhc setup, I also deleted my .ssh folder and executed rhc setup again but that also didnt work. Not sure what changed but it worked couple of hours ago. >git push -u…
special0ne
  • 6,063
  • 17
  • 67
  • 107
35
votes
12 answers

How do I convert multi public key into a single line?

I'm trying to make a txt file with a generated key into 1 line. example: <----- key start -----> lkdjasdjskdjaskdjasdkj skdhfjlkdfjlkdsfjsdlfk kldshfjlsdhjfksdhfksdj jdhsfkjsdhfksdjfhskdfh jhdfkjsdhfkjsdhfkjsdhf <----- key stop -----> I want it to…
john
  • 1,330
  • 3
  • 20
  • 34
34
votes
1 answer

What is GitHub's public GPG key?

If you make an edit through GitHub's website, or merge a pull request, then the resulting commits are automatically signed with GitHub's GPG key. It looks like this: I would like to have the full public key so that I can add it as a trusted key on…
Aaron Franke
  • 3,268
  • 4
  • 31
  • 51
33
votes
5 answers

How to sign string with private key

How can I get the signature of a string using SHA1withRSA if I already have the Private Key as byte[] or String?
xain
  • 13,159
  • 17
  • 75
  • 119
31
votes
5 answers

C# How to simply encrypt a text file with a PGP Public Key?

I've researched a bit about how to achieve what I said in the question and found several APIs but most of them look very complicated and since I'm just a noobie in this area I just want a simple method like: public String Encrypt(String message,…
Leo
  • 2,173
  • 6
  • 28
  • 37
31
votes
4 answers

Could not generate ssh public key for heroku in Windows 7

While I am trying heroku login through cmd in my machine, it says Could not find existing public key Would you like to generate one? [YN] After that when I press 'y' and enter it says Generating new ssh public key Could not generate key:…
Suman Sapkota
  • 570
  • 1
  • 6
  • 15
27
votes
1 answer

Converting Strings to encryption keys and vice versa java

I'm currently working on a way to convert keys into strings and vice versa. It works for the public key conversions, and converts a private key into a String. For some reason the same code won't convert a String back into a private key, which I just…
user478087
27
votes
4 answers

Why does git sign with GPG keys rather than using SSH keys?

What are the differences between SSH and GPG asymmetric keys and why does git support signing with GPG rather than using the SSH agent?
Dan Kowalczyk
  • 4,103
  • 2
  • 18
  • 29
27
votes
1 answer

SSH: "Bad passphrase" after generation of public key

When I execute these commands (setting a passphrase, after the first)... $ ssh-keygen -t dsa $ chmod 600 my_key $ chmod 600 my_key.pub ...and then, to test the passphrase... $ ssh-add my_key.pub ...I keep getting: Bad passphrase, try again for…
TomDogg
  • 3,803
  • 5
  • 33
  • 60
26
votes
2 answers

git setup for multiple repos on same server

Probably a simple question, but I am at a loss here... In github one can add a deployment key for each repository which only gives access to that single repository. But for one client I have two projects managed with git on the same server (project…
Max
  • 15,693
  • 14
  • 81
  • 131
26
votes
2 answers

C# RSA Public Key Output Not Correct

I am currently trying to generate and send a public RSA key using C#. It should be a 2048 bit long key in PEM format. I have successfully done so using OpenSSL command with the following (some output are shortened): $ openssl genrsa 2048 Generating…
Pettor
  • 491
  • 2
  • 6
  • 16
1 2
3
77 78