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
1 answer

How to implement asymmetric cryptography for distributed app where keys can both be stored as strings?

I have what seems to be a simple need - I want to generate a public key that I can put into an app, and use to to encrypt data that may be exposed to others. Later, using a private key known only to myself, I want to be able to decrypt that…
David H
  • 40,852
  • 12
  • 92
  • 138
0
votes
1 answer

opening a text file in python and reading the contains as str

I am trying to encrypt a file using RSA algo in python for that i have stored all the possible values that can be written in a normal text file. like this SYMBOLS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890 !?.' now i have a…
0
votes
1 answer

Encrypting a file using saved RSA keys in python

I am trying to encrypt an image file using RSA keys that are generated by another script and saved into a .pem file. when i am trying to encrypt the file its showing errors like this Traceback (most recent call last): File "rsaencrypt.py", line…
0
votes
1 answer

Encryption a message which was generated in .NET Core 2.1 under linux adds leading bytes

If have the follwoing situation: A Client app runs on Raspian with .NETCore 2.1 (Linux) It encrypts a message with a public cert (RSA) Sends this encrypted message to a windows server This server decrypts the message Now the data has 2 more bytes…
0
votes
1 answer

How to separate marshalled ecdsa public and private keys in GoLang

So far, I have: key, err := ecdsa.GenerateKey(elliptic.P521(), rand.Reader) if err != nil { os.Exit(-1) } marshalled, err := x509.MarshalECPrivateKey(key) // marshalls data to byte stream if err != nil { os.Exit(-1) } Basically, what I am…
Matt
  • 29
  • 4
0
votes
1 answer

How to extract the fields (Country, State, ... E-mail) from a p12 file without password

I have a file.p12 which contains the private key protected with a password (that i have not) and the public certificate. I have tried the following commands in the cmd of windows: pkcs12 -in file.p12 -clcerts -nokeys -out publicCert.pe But it…
James
  • 1
  • 1
  • 1
  • 2
0
votes
1 answer

CipherInputStream .available() returns ZERO in decryption phase

I'm trying to use encryption tools flexiprovider in my android app by using the example provided for ECIES. When I run the code in my local machine Enc/Dec work without any problem. But when I'm trying to run it as an android app using the android…
Majid
  • 23
  • 5
0
votes
1 answer

Java private/public encrypt exception data must not be greater than 256 bytes

I have this code below for encrypting objects, which does a job. But I have an object containing a list of another object. When I encrypt the object I have the error that data must be greater than 256 bytes. When I remove the list, the encryption is…
boycod3
  • 5,033
  • 11
  • 58
  • 87
0
votes
2 answers

OpenSSL Decryption - EVP_DecryptFinal_ex fails

I'm using this decryption function to get the plain text value of a cipher which was encrypted using EVP AES 265 GCM; I can see data in rawOut but ret = EVP_DecryptFinal_ex(ctx, rawOut, &len); returns 0; can you provide any insight as to why? I've…
Ol1v3r
  • 758
  • 1
  • 10
  • 23
0
votes
0 answers

c# : How can I create a certificate with key size of 168 using CERTENROLLLib.CX509PrivateKey?

I am working with EDI - AS2. So I have to create a PrivateKey certificate (.pfx) and a PublicKey certificate (.cer). Here I sign my message with my PrivateKey certificate (.pfx) and share the PublicKey certificate (.cer) with my trading partner, so…
0
votes
1 answer

Securing a Client Talking to an AWS Server Instance

We have an AWS server instance running Ubuntu 18.04, and acting as host for a RESTful API (written in Python). The API interfaces with an RDS instance (mySQL) and basically performs database tasks; but this is not important. We are looking at how…
0
votes
0 answers

How can I tell if given data is encrypted with a public key

I'm going to re-phrase my question completely so it makes more general sense (and correct my blunder with AES/RSA). Alice has a large block of data to send to Bob via a local mailbox that isn't secure. To keep her data from prying eyes, she does…
0
votes
1 answer

HTTPS communication security

I have an ambiguity about HTTPS communication and my question had may be asked but I didn't find and clear response: In HTTPS communication, the server is sharing it's public key with "everyone" If this key is shared with public, than doesn't anyone…
Zizou
  • 831
  • 1
  • 10
  • 19
0
votes
1 answer

decryption error occurring when using rsa in java.

My aim is to take in a message containing a challenge and an origin. On receiving this msg a rsa keypair must be generated which is then used to manipulate the data as shown below. Certain part of the data is encrypted using the generated public…
0
votes
1 answer

JavaScript Signing a message using an ETH address as a public key

As far as I understand, on Ethereum every wallet has a private and a public key. The public key is the address. What I want to achieve is to SIGN a "string" with a public address, so that only that address (with the private key) can "read" the…
Ziba Leah
  • 2,484
  • 7
  • 41
  • 60