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

Whose key is used to encrypt a HTTPS response?

I have a web server built up relying on HTTPS. So, my server maintains its private key and publish a public key that any clients can use to encrypt their request. Since my server is the only one who has the private key to decrypt any message…
Bruce
  • 1,608
  • 2
  • 17
  • 29
17
votes
3 answers

Calculate d from n, e, p, q in RSA?

Not sure if this is the correct place to ask a cryptography question, but here goes. I am trying to work out "d" in RSA, I have worked out p, q, e, n and ø(n); p = 79, q = 113, e = 2621 n = pq ø(n) = (p-1)(q-1) n = 79 x 113 = 8927…
user3423572
  • 559
  • 1
  • 7
  • 21
16
votes
4 answers

Cube root modulo P -- how do I do this?

I am trying to calculate the cube root of a many-hundred digit number modulo P in Python, and failing miserably. I found code for the Tonelli-Shanks algorithm which supposedly is simple to modify from square roots to cube roots, but this eludes me.…
Seth
  • 707
  • 1
  • 9
  • 20
15
votes
2 answers

How to protect media content (video, audio) on Android from being saved/redistributed?

What opportunities are there for regular app developers (with that I mean, you're not a million dollar content producing company or distribution channel provider, but a regular, small app development company) to secure video/audio content for the…
Mathias Conradt
  • 28,420
  • 21
  • 138
  • 192
15
votes
4 answers

Which symmetric key algorithm does SSL use?

I understand that through SSL, the browser gets the public key of the secured website and through public key encryption rsa algorithm, these 2 establish session key and then continue communication thru some symmetric algorithm, because symmetric key…
xyz
  • 8,607
  • 16
  • 66
  • 90
15
votes
2 answers

how to convert raw modulus & exponent to RSA public key (.pem format)

I have the modulus & exponent of an RSA public key embedded into a binary file, and I am trying to extract the entire blob and create a usable .pem public key. Currently, I am extracting the full 260 bytes (4 bytes for the exponent, 256 bytes for…
Erik Nyquist
  • 1,267
  • 2
  • 12
  • 26
15
votes
3 answers

How does perfect forward secrecy (PFS) work

I'm in an infosec class and I stumbled upon this concept online and it intrigued me. I've also looked at a few websites and wikipedia that explain the concept, as well as a few posts on stackoverflow, but I'm still getting confused. From what I…
Tim
  • 311
  • 2
  • 6
  • 16
15
votes
3 answers

why is integer factorization a non-polynomial time?

I am just a beginner of computer science. I learned something about running time but I can't be sure what I understood is right. So please help me. So integer factorization is currently not a polynomial time problem but primality test is. Assume…
14
votes
3 answers

How to implement OpenSSL functionality in Python?

I would like to encrypt a secret text by public-key and decrypt it by private-key in Python. I can achieve that with the openssl command: echo "secrettext/2011/09/14 22:57:23" | openssl rsautl -encrypt -pubin -inkey public.pem | base64 …
user966151
  • 235
  • 1
  • 5
  • 10
14
votes
3 answers

Android Decryption Error

I am trying to encrypt and decrypt Strings in my Android application but I keep getting an InvalidKeyException error. Here is my code: //Generate Keys method public void generateKeys() { Calendar cal = Calendar.getInstance(); Date now =…
Donal Rafferty
  • 19,707
  • 39
  • 114
  • 191
14
votes
2 answers

How can I get the public key of a webpage?

How can I get the public key of a website like VeriSign and all other websites which use https(secure protocol)?
shalki
  • 890
  • 3
  • 14
  • 31
14
votes
1 answer

Verify user's private key for website login

I'm trying to implement a login system to sign into a website using public key authentication. I'm not sure if this is feasible. This is what I plan to do:- While signing up, user's public key is saved in the website. When the user tries to login…
Sparky
  • 4,769
  • 8
  • 37
  • 52
13
votes
1 answer

Encrypt and decrypt a string of text with RSA and DES3 key

I am using the Linux command line, I have created a Private Key using the following command: openssl genrsa -des3 -out private.pem 2048 I have extracted the public key from the private key like so: openssl rsa -in private.pem -out public.pem…
JMK
  • 27,273
  • 52
  • 163
  • 280
13
votes
4 answers

Heroku HIPAA Compliance

Is it possible to run apps on Heroku that are HIPAA compliant? More specifically, I need two apps, one that stores member information and another that stores private health information of the members. I intend to encrypt sensitive data using both…
Joseph Ridgway
  • 233
  • 2
  • 8
13
votes
3 answers

When to use X509EncodedKeySpec vs RSAPublicKeySpec?

I have a certificate in a text file, its contents look like: -----BEGIN PUBLIC KEY----- xxxx xxxx xxxx -----END PUBLIC KEY----- I believe this is a pem encoded certificate? So I want to load it now, I'm trying the following: X509EncodedKeySpec…
user3203425
  • 2,919
  • 4
  • 29
  • 48