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

How to verify JWT produced by Azure Ad?

Problem When I receive a JWK from Azure AD in Python, I would like to validate and decode it. I, however, keep getting the error "Signature verification failed". My Setup I have the following setup: Azure Setup In Azure I have created an app…
9
votes
1 answer

How to establish a secure connection by using Synapse?

I'm testing Synapse and want to know how can I establish a secure connection. I noticed it supports SSL, but I'm not sure whether it suits my needs. I don't have a certificate from CA. I just want to encrypt all data between my server program and…
trudger
  • 917
  • 2
  • 12
  • 20
9
votes
1 answer

Reading a PKCS#1 or SPKI public key in Java without libraries

I need to use a public key to verify some data in Java, but I can't seem to format the key in such a way that Java can use without third-party plugins. I'm generating the key with Node.js's crypto library, which gives me the option of PKCS#1 or…
Chris Watts
  • 6,197
  • 7
  • 49
  • 98
9
votes
3 answers

How to generate a private/public key pair to encrypt messages

I need to generate a keypair in my flutter App, but it seems that there aren't any libraries to do so. There is one library called RSA which does parse a pair of public/private keys and is able to encrypt and decrypt strings using them, but it…
Shamshun
  • 462
  • 1
  • 5
  • 17
9
votes
1 answer

PGP key armored encoding in Go's openpgp package

I am trying to print a PGP public key in an ASCII armored encoding using Go's openpgp/armor package. The output I would expect: -----BEGIN PGP PUBLIC KEY BLOCK----- -----END PGP PUBLIC KEY…
max
  • 677
  • 1
  • 9
  • 34
9
votes
1 answer

How to manage Asymmetric (Public/Private) Keys in AWS

I need to develop a solution to store both symmetric and asymmetric keys securely in AWS. These keys will be used by applications that are running on EC2s and Lambdas. The applications will need to be set up with policies that will allow the…
9
votes
2 answers

Is KeyFactory thread-safe?

There is a service class that needs to generate PublicKey instances from X.509-encoded public key representations. One instance of this class will service multiple threads. Is it correct to do something like this? public class MyService { …
Roman Puchkovskiy
  • 11,415
  • 5
  • 36
  • 72
9
votes
1 answer

Swift 3 export SecKey to String

I am developing an iOS app using swift 3. I need to export an SecKey (which is the user RSA publickey reference) to a string (e.g base64) in order to share it through a generated QRCode. It also has to work the other way since the other user that…
Scaraux
  • 3,841
  • 4
  • 40
  • 80
9
votes
1 answer

Decrypt Non-Armored PGP Files With OpenPGP.js

I am working on a Node application into which I have built a decrypter function, and have used the Openpgp.js npm module to make this work. I take in various submitted PGP client files made with our public key, decrypt them using our private key as…
9
votes
2 answers

How to I securely store social security numbers in a database?

I'm working on a web application which the users will need to submit their social security numbers. I would like to use asymmetric keys for encryption so if the web server is compromised the private key will still be safe. The application won't be…
harlyd
  • 91
  • 1
  • 1
  • 4
9
votes
2 answers

How to Encrypt String With Public Key and Decrypt with Private key ?

i want to encrypt a password with a key from server and decrypt the encrypted password in serverside. this is the code i have used in my application /* * To change this license header, choose License Headers in Project Properties. * To change this…
Rajorshi Biswas
  • 107
  • 1
  • 1
  • 2
9
votes
3 answers

Seckey from public key string from server in Swift

I want to encrypt data using RSA , I tried to generate the key in my code and it's working , But what I actually need is to get the public key as a string from server and then use it as Seckey so I can use it to encrypt data using RSA, I tried this…
9
votes
4 answers

Get the key parameter is not a valid public key error in openssl_public_encrypt()

$publicKey = "../ssh/public/pub"; $plaintext = "String to encrypt"; $pubKey = openssl_pkey_get_public($publicKey); openssl_public_encrypt($plaintext, $encrypted, $pubKey); echo $encrypted; //encrypted string above code generating following…
poojitha
  • 335
  • 1
  • 3
  • 12
9
votes
4 answers

Encryption PHP, Decryption Java

I have a web-service in php that generates a keypair to encrypt a message, and one application in java that retrives the privatekey and decrypt the message. For php I'm using http://phpseclib.sourceforge.net/ and have this two…
9
votes
4 answers

Two private key asymmetric encryption - possible?

I am wondering if there exists some asymmetric encryption algorithm that would work with two different private keys, so that the encrypted message can be decrypted by either one of such private keys?