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
9
votes
4 answers

Asymmetric encryption using PHP

I have a problem that is driving me crazy. I have created a pair of keys doing: $res = openssl_pkey_new(array('private_key_bits' => 2048)); /* Extract the private key from $res to $privKey */ openssl_pkey_export($res, $privKey); /* Extract the…
Dail
  • 4,622
  • 16
  • 74
  • 109
9
votes
1 answer

exchange public/private key in PKCS#1 OAEP encryption/decryption

I only have some very rudimentary theoretical knowledge about RSA. While reading different sources about how to use it in practice, it seemed that PKCS#1 OAEP would be a good thing. For a test implementation, I use Python with PyCrypto. E.g. this is…
Albert
  • 65,406
  • 61
  • 242
  • 386
8
votes
1 answer

RSA code in matlab

I want to encrypt a message such as 'HELO1234 and then decrypt to get the original one.I have written RSA code in matlab which is not working correctly. PARAMETER…
shree
  • 125
  • 1
  • 4
  • 15
8
votes
2 answers

Digital signature public key

I'm newbie to encryption. In Public Key Cryptography we have pair of keys - one for encryption and one for decryption. In case Alice wants Bob to send her secret message, she publishes her encryption key (it'll be called public key) and keeps…
dimba
  • 26,717
  • 34
  • 141
  • 196
8
votes
4 answers

openssl decryption in javascript in browser

I am searching for a way to clientside decode RSA respectively openssl encoded messages. Idea: Special data is only stored encrypted with a public key on the server so that nobody is able to see the real data - even in case of server hacks. An admin…
Tobias P.
  • 4,537
  • 2
  • 29
  • 36
8
votes
2 answers

Deserializing public key with python's cryptography module

I am writing a python script that involves sending a public key over a network. I am using public_key = self.node.public_key pem = public_key.public_bytes( …
8
votes
1 answer

How to Encrypt Data in Javascript with RSA public key?

Server generates RSA public and private keys and store them in the session. Over a server call the client html page recieves the public key. Now I want to encrypt data using it. I have tried using jsencrypt but it doesn't recognize the public key my…
8
votes
1 answer

Public Key Generation from .cer file not working on Android 28

I have a method that generates a public key from .cer file. I conver the .cer file contents into an input stream and once I get the stream I call this method to generate public key public static void generatePublicKey(InputStream inputStream) { …
8
votes
2 answers

How to protect my encryption key in Android?

I have implemented SQLCipher in my Android application to make it's database secure. SQLCipher needs a key to encrypt database file. The problem I am facing is key protection, if my application is used on a rooted device or is reverse engineered…
8
votes
1 answer

java.security.InvalidKeyException: invalid key format on generating RSA public key

Background: I have created an applet to extract public key of a certificate extracted from a smart card. This public key is then stored in database. The private key of certificate is used to sign data and the public key is then used to verify the…
user3619997
  • 197
  • 2
  • 2
  • 12
8
votes
2 answers

Converting NSData to SecKeyRef

i have a public key which i gathered from a remote server and i want to perform RSA encryption with that public key. But the problem is i get the public key data as byte array in buffer. I can convert it to NSData but i can not convert to SecKeyRef…
M. Salih Kocak
  • 189
  • 2
  • 14
8
votes
2 answers

Which public key (SP or remote IDP) to use while signing SAML request

I am trying to configure my application (SP) to work with remote IDP. The IDP provided me with a certificate to configure with SP. For SAML request, do I use SP's public key or IDP's? Also, where can I find good resources to study SAML in detail…
doon
  • 2,311
  • 7
  • 31
  • 52
8
votes
3 answers

Android In-app security recommendation - what does this mean?

The Android developer says the following about storing your app public key in your project: Security Recommendation: It is highly recommended that you do not hard-code the exact public license key string value as provided by Google Play.…
Plastic Sturgeon
  • 12,527
  • 4
  • 33
  • 47
8
votes
2 answers

Public Private Key Encryption Tutorials

Do you know of a tutorial that demonstrates Public Private Key encryption(PPKE) in C++ or C? I am trying to learn how it works and eventually use Crypto++ to create my own encryptions using public private keys. Maybe theres a Crypto++ PPKE…
sazr
  • 24,984
  • 66
  • 194
  • 362
7
votes
5 answers

How to combine a private key and a public key for a shared secret in Java

I'm reading the wikipedia about public-key Public-key cryptography ( http://en.wikipedia.org/wiki/Public-key_cryptography ) and in it it says: In the Diffie–Hellman key exchange scheme, each party generates a public/private key pair and…
Wudong
  • 2,320
  • 2
  • 32
  • 46