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

'Cannot find the requested object' exception while creating X509Certificate2 from string

I am trying to create X509Certificate2 from string. Let me show an example: string keyBase64String = Convert.ToBase64String(file.PKCS7); var cert = new X509Certificate2(Convert.FromBase64String(keyBase64String)); and keyBase64String has a such…
StepUp
  • 36,391
  • 15
  • 88
  • 148
25
votes
1 answer

Using ECC Curve25519 to encrypt/decrypt data in Java

I am trying to use Curve25519 in my Android app to encrypt/decrypt AES encryption key locally. I don't need any key exchange, key agreement or signing. Why I need to use that particular curve? Because I need to be able to provide private key myself…
25
votes
5 answers

Pushing to TFS git using public/private key

I have a TFS server which is using git for source-control. How do I use ssh style public/private keys to push/pull/fetch from the TFS server? That is, where do I add my public key on the TFS server?
Marius
  • 57,995
  • 32
  • 132
  • 151
25
votes
1 answer

How to Verify Signature, Loading PUBLIC KEY From CRT file?

I reviewed many forums and examples, but none helped me. I need verify signature from any webservice. I have test.crt file with public key for verify. static bool Verify(string text, string signature) { X509Certificate2 cert = new…
drup
  • 365
  • 3
  • 10
22
votes
1 answer

How to convert from String to PublicKey?

I've used the following code to convert the public and private key to a string KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance("RSA"); keyPairGen.initialize(2048); KeyPair keyPair = keyPairGen.genKeyPair(); PublicKey …
The Coder
  • 2,562
  • 5
  • 33
  • 62
20
votes
4 answers

Using Base64 encoded Public Key to verify RSA signature

In a nutshell, this is my problem: private string publicKeyString =…
jscheppers
  • 213
  • 1
  • 2
  • 8
20
votes
3 answers

How to make a simple public-key cryptographic algorithm?

I want to make a simple public-key(asymmetric) encryption. It doesn't have the be secure, I just want to understand the concepts behind them. For instance, I know simple symmetric ciphers can be made with an XOR. I saw in a thread on stackexchange…
19
votes
1 answer

Android app licensing new and old - doubts

Just few weeks ago Google changed Android LVL API (License Verification Library). In old LVL license checking was based on license verification using public/private keys generated on per account base. New one suppose to use public/private keys per…
Barmaley
  • 16,638
  • 18
  • 73
  • 146
18
votes
1 answer

Implementation of kleptography in Python (SETUP attack)

My task is to reproduce the plot below: It comes from this journal (pg 137-145) In this article, the authors describe a kleptographic attack called SETUP against Diffie-Hellman keys exchange. In particular, they write this algorithm: Now, in 2 the…
18
votes
3 answers

The argument "-i" passed to GIT_SSH_COMMAND is being ignored

I want to use other IdentityFile for git. I want to use it dynamically, not via config. I'm doing this: $ GIT_SSH_COMMAND='ssh -i /home/my_user/.ssh/id_ed25519' git pull origin master repository access denied. fatal: Could not read from remote…
jerry
  • 827
  • 2
  • 7
  • 10
17
votes
5 answers

.NET implementation (libraries) of elliptic curve cryptography

Please can you suggest any implementation of elliptical curve cryptography to be used on .NET platform? Also if you have used them, can you tell me the recommended curves that should be used? [EDIT] As @FatCat mentioned, its implementation is…
Hemant
  • 19,486
  • 24
  • 91
  • 127
17
votes
1 answer

Encrypting a file with RSA in Python

I'm implementing file encryption with RSA, using PyCrypto. I know it's somewhat wrong, first of all because RSA is very slow and second because PyCrypto RSA can only encrypt 128 characters, so you have to explode the file in 128 characters…
Cristi Constantin
  • 554
  • 1
  • 6
  • 19
17
votes
3 answers

GDPR: Encrypted logging in C#

The suggestion to encrypt log files as a means of protecting the personal data that might be contained in them is widespread. What I've not seen is a good reference implementation, which is surprising given how many companies will need this. In our…
pjc50
  • 1,856
  • 16
  • 18
17
votes
3 answers

How to get public key from an OpenPGP smart card without using key servers?

I am working on a use-case where OpenPGP is being used to generate a public key pair on a smart card (Yubikey). The smart card is then to be shipped off to the user. Trying to emulate this locally the following is being done: generate keys on smart…
Stelios
  • 1,294
  • 3
  • 12
  • 28
17
votes
4 answers

How to generate ssh compatible id_rsa(.pub) from Java

I'm looking for a way to programmatically create ssh compatible id_rsa and id_rsa.pub files in Java. I got as far as creating the KeyPair: KeyPairGenerator generator; generator = KeyPairGenerator.getInstance("RSA"); // or: generator =…
Carsten
  • 4,204
  • 4
  • 32
  • 49