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
10
votes
3 answers

How can I encrypt data with a public key in Node.js?

In crypto, I see only Signer/Verifier for doing digital signature and Cipher/Decipher with symmetric key encryption. How do I encrypt data with public key?
teerapap
  • 5,303
  • 7
  • 33
  • 40
10
votes
2 answers

RSA encryption in C#: What part defines the public key?

I've generated a new public/private key pair and exported it as an XML string: RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(2048); string publicPrivateKey = RSA.ToXmlString(true); The XML string in publicPrivateKey looks like this…
Mike
  • 1,992
  • 4
  • 31
  • 42
10
votes
1 answer

Can I store Apple's public key for verifying token signature?

In order to implement OAuth with Apple, we make a call GET https://appleid.apple.com/auth/keys. (According to the documentation in…
10
votes
2 answers

RSA Encryption in Java: Cross Platform Issues?

The Situation I'm working with RSA encryption in Java. I'm trying to encrypt data on an HTC Saphire (32B) developer phone equipped with Cyanogenmod's Android 2.2 and then decrypt said data on a 64 bit server running Mandriva Linux 2010. I am using…
10
votes
1 answer

Android public key encryption

My Android app implements RSA encryption, however the backend can not decrypt the token generated by the app. Here is the code, the beginning and end lines of the public key have been removed before making the calls, what could be the…
Ray
  • 16,025
  • 5
  • 31
  • 51
10
votes
2 answers

How to store modulus, public exponent and private exponent securely on Android?

I have given modulus, public exponent and private exponent and I need to store those values securely on Android. How can I achieve that? Most examples are creating public and private keys without getting n,d,e parameters. I have given those n,e,d…
Figen Güngör
  • 12,169
  • 14
  • 66
  • 108
10
votes
2 answers

RSA Java encryption and Node.js decryption is not working

I have a system that requires a RSA keypair to be generated in javascript, have the public key then stored in a database at the server side (as a string), then the server side which is in Java will encrypt a string with the stored public key and…
AugGust
  • 251
  • 2
  • 7
10
votes
2 answers

get x and y components from ecc public key in PEM format using openssl

I am generating a KeyPair for ECC from curve 'secp128r1' using openssl Steps I followed : first I generated a private key using the command openssl ecparam -genkey -name secp128r1 -noout -out private.pem then i viewed the corresponding public…
10
votes
2 answers

X.509 Certificate Public Key in Base64

I am trying to find the base64 public key for a certificate I am working with. The public key I find in the detail tab of the certificate is not base64 and I am requested to provide the base64 public key. Is there a way I can get a base64 version of…
user2220871
  • 113
  • 1
  • 1
  • 7
10
votes
2 answers

Ensuring Data completeness and validity on third party storage

I'm dealing with untrusted external storage and need to ensure the storage provider does not withhold any records in a query. Example: I have two trusted entities TA and TB, those entities should be able to alter the data that is stored in the…
worenga
  • 5,776
  • 2
  • 28
  • 50
10
votes
1 answer

How should an RSA Public Key be exposed over HTTP?

We have a requirement to expose an RSA Public Key as an HTTP resource - so http://myhost.com/publickeys/akeyid returns a public key. I would like to return it with a correct Internet Media Type. What should that be? I confess I find the crypto RFCs…
Robert Elliot
  • 1,372
  • 13
  • 20
10
votes
5 answers

Can a public key have a different length (encryption) than the private key?

I have a 1024 bits private key, and use it to generate a public key. Does that automatically mean that my public key also has 1024 encryption? Or can it be of a lesser encryption size? (512, 256...) PS: What i'm mostly interested in, and talking…
Rolf
  • 5,550
  • 5
  • 41
  • 61
10
votes
5 answers

Whats wrong with being your own Certificate Authority and self-signing for your email encryption?

Is there any real reason to use a 3rd party Certificate Authority for your own email security? ( meaning using S/MIME ) I found I am able to become my own CAuthority and create my own self-signed root certificates...and they work just fine installed…
10
votes
3 answers

is it safe to store ssh keys on github?

I would like to know if is it safe to store public and private key on a public git repository ? These keys are password protected. I'm willing to do that in order to save my current linux configuration. If it's not safe to do so, do you know a way…
Erèbe
  • 323
  • 1
  • 2
  • 8
9
votes
1 answer

Can org.bouncycastle.openssl.PEMReader read java.security.PrivateKey?

I have following code: PrivateKey key = null; X509Certificate cert = null; KeyPair keyPair = null; final Reader reader = new StringReader(pem); try { final PEMReader pemReader = new PEMReader(reader, new PasswordFinder() { @Override …