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
0
votes
2 answers

libsodium crypto_box_seal_open failing

I am using the following function to create a sealed box using libsodium: void encrypt_message(char *msg, char *enc_msg, int db_id) { unsigned char pk[crypto_box_PUBLICKEYBYTES] = { '\0' }; char key[BUFLEN] = { '\0' }; …
hermetik
  • 115
  • 9
0
votes
0 answers

Java KeyFactory.generatePublic equivalent in C# for RSA Encryption

I have this Java code to create a public key based on base64 byte array in Java: return KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(base64PublicKeyBytes)); That line is subsequently used to encrypt some data. Assume that I…
Klaus Nji
  • 18,107
  • 29
  • 105
  • 185
0
votes
1 answer

How to create a public key file in gpg from a given public key

A colleague of mine gave me their public key in text format and now I want to use that public key to encrypt my plain messages. The thing is, I don't know how to create a key for an existing public key. As in how do I import the public key in GnuPG…
0
votes
1 answer

Python encrypt with PGP

i want to encrypt a sting with a public PGP key from my database. till now i search trough a lot of libsa and apps and such but i simply dont find a good working way here. I dont need any Key management and to be honest, it would be wonderful not to…
user10000033
0
votes
1 answer

Signing Xml from "es-staging.crt" certicate before sending via httpClient to service provider

I have got es-staging.crt file from service provider whose service I am using. I need to send signed xml with this es-staging.crt certificate. I do not know how to achieve it. How to solve this in java language? I have read certificate information…
Ashu
  • 81
  • 1
  • 1
  • 6
0
votes
1 answer

Error while using RSA encryption on BlackBerry

I'm trying to use RSA encryption on Blackberry with their native API's. I made a public/private key pair in Java and saved the Modulus and Exponents of the keys as strings so i can generate the keys from this for encryption and decryption. The…
8vius
  • 5,786
  • 14
  • 74
  • 136
0
votes
1 answer

How to encrypt and decrypt data with Openssl RSA public private key pair in Golang?

I am trying to write a program which encrypts data using a RSA public key and and decrypts data using private key. The RSA keys were generated with openssl tool. I found Spacemonkeygo Openssl https://github.com/spacemonkeygo/openssl wrapper for this…
dinu0101
  • 461
  • 2
  • 5
  • 18
0
votes
0 answers

Asymmetric decryption fails over tcp connection seemingly because of encoding issues

I am trying to exchange public keys over a tcp connection. It is easier for me if I can do this while storing these keys in a packet class, serializing the packet object, converting it to a byte array and then sending it over the tcp connection. The…
Xuid
  • 21
  • 5
0
votes
1 answer

RSA encryption with OpenSSL using char array public key

I have a public key stored in a variable like so: static const char publicKey[] = "-----BEGIN PUBLIC…
user3670011
  • 194
  • 11
0
votes
1 answer

How to encrypt the stanzas sent to ejabberd

I am currently using ejabberd. My app is working fine but I have a question. How can I encrypt the stanzas sent to ejabberd from the client (Presence, Message, IQ). I am currently using TLS transport protocol for client to server communication and…
Ahmed
  • 1,229
  • 2
  • 20
  • 45
0
votes
1 answer

Replacing cryptico.js with WebCryptoAPI - how do I get Public Key string?

I hope someone can help. I have been using cryptico.js and have been generating keys via: var RSAkey = cryptico.generateRSAKey(passphrase, 512); var publicKeyString = cryptico.publicKeyString(RSAkey); Giving me clean good access to a public key,…
0
votes
0 answers

Encrypting with 2 public keys

Is it possible to encrypt a secret with 2 public keys such that either of the 2 private keys can decrypt the secret? I've seen it said that this can be done with GPG but I need to find a library that can do it and so far find no leads. I'm not set…
virullius
  • 939
  • 6
  • 17
0
votes
1 answer

Encryption of an public rsa key file with Poco fails with "file access error"

I'm trying to encrypt an rsa public key that I have generated using libary poco crypto. The idea came from these answers (C++ Encrypt a text file, allow use of decrypt via ifstream). The pubkey is in the form of "MIIBIDANBgkqhkiG.........== I'm…
dk13
  • 1,461
  • 4
  • 20
  • 47
0
votes
0 answers

Is there an implementation of collective signature for anonymous signing?

I want to sign anonymously with my private key combined with a collective signature. So the signature will only prove that it was made by somebody who participated in the collective signature.
Oleg
  • 486
  • 6
  • 12
0
votes
1 answer

Encrypting using publicKey from seckeygeneratepair

Our iOS developer generated a private / public key using the following documentation. The other details includes using RSA 2048 and padding is PKCS1. https://developer.apple.com/documentation/security/1395339-seckeygeneratepair?language=objc I've…
MichaelChan
  • 1,808
  • 17
  • 34