pgp

Decrypt PGP encrypted file with passphrase only in Java

那年仲夏 提交于 2019-12-02 07:06:26
问题 I have a PGP file named 'filename.txt.pgp' that I need to decrypt. When I run decryption from command-line it asks me only for the password. I use gpg command: gpg filename.txt.pgp The password is enough and my file is decrypted. I can read it's content. Now, I should create an utility in Java. After research I see that Bouncy Castle library is my best choice. But all the examples in Java I can find use public/private key file which I do not have. Could you please help me with an example in

Decrypt PGP encrypted file with passphrase only in Java

梦想的初衷 提交于 2019-12-02 01:22:57
I have a PGP file named 'filename.txt.pgp' that I need to decrypt. When I run decryption from command-line it asks me only for the password. I use gpg command: gpg filename.txt.pgp The password is enough and my file is decrypted. I can read it's content. Now, I should create an utility in Java. After research I see that Bouncy Castle library is my best choice. But all the examples in Java I can find use public/private key file which I do not have. Could you please help me with an example in Java that decrypts PGP file using just a password? Thank you. If you look at the documentation section

Is there any benefit to encrypting twice using pgp? [closed]

橙三吉。 提交于 2019-12-01 17:36:50
I am asking from a "more secure" perspective. I can imagine a scenario with two required private keys needed for decryption scenarios that may make this an attractive model. I believe it is not adding any additional security other than having to compromise two different private keys. I think that if it was any more secure than encrypting it one million times would be the best way to secure information. Update a couple of years later: As Rasmus Faber points out 3DES encryption was added to extend the life of DES encryption which had widespread adoption. Encrypting twice using the same key

Is there any benefit to encrypting twice using pgp? [closed]

喜夏-厌秋 提交于 2019-12-01 16:31:33
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I am asking from a "more secure" perspective. I can imagine a scenario with two required private keys needed for decryption scenarios that may make this an attractive model. I believe it is not adding any additional security other than having to compromise two different private keys. I think that if it was any

Exception on decrypting file using BouncyCastle PGP

烂漫一生 提交于 2019-11-30 23:11:27
I was trying to decrypt this sample file given by the client, using a class called PgpDecrypt. But when the code comes to this line: Stream clear = pbe.GetDataStream(privKey); it returns an error: exception decrypting secret key Here's my decryption code: PgpDecrypt test = new PgpDecrypt(string.Concat(pathh, "TestDecryptionFile"), string.Concat(pathh, "mypgpprivatekey.key"), "mypassphrase", @"d:/test/", string.Concat(pathh, "clientpublickey.key")); FileStream fs = File.Open(string.Concat(pathh, "TestDecryptionFile"), FileMode.Open); test.Decrypt(fs, @"d:\test\"); I am using BouncyCastle as my

Bouncy Castle C# PGP Decryption example

痴心易碎 提交于 2019-11-30 21:39:21
I have been looking all day yesterday, and I can't seem to find a working example of PGP decryption using Bouncy Castle in c# Finally got it to work. The main issue I had with other samples was the fact that the private key ring I had included a key for signing which was coming up first when trying to load the key for decryption. This is why why I had to add a check for the ElGamalPrivateKeyParameters type on the key. Below is my code. Not very clean, but it works. private static PgpPrivateKey GetPrivateKey(string privateKeyPath) { using (Stream keyIn = File.OpenRead(privateKeyPath)) using

How to sign a txt file with a PGP key in C# using Bouncy Castle library

孤者浪人 提交于 2019-11-30 15:53:56
Does anyone have an example of how I can sign a txt file, using a PGP key in C# and Bouncy Castle library. Not to encrypt the file, only to add a signature. public void SignFile(String fileName, Stream privateKeyStream, String privateKeyPassword, Stream outStream) { PgpSecretKey pgpSec = ReadSigningSecretKey(privateKeyStream); PgpPrivateKey pgpPrivKey = null; pgpPrivKey = pgpSec.ExtractPrivateKey(privateKeyPassword.ToCharArray()); PgpSignatureGenerator sGen = new PgpSignatureGenerator(pgpSec.PublicKey.Algorithm, KeyStore.ParseHashAlgorithm(this.hash.ToString())); sGen.InitSign(PgpSignature

Secure method for storing/retrieving a PGP private key and passphrase?

蓝咒 提交于 2019-11-30 08:10:03
问题 I have a web application that needs to store server login information. I'm using a 2048bit PGP public key to encrypt inserted passwords (see the insertServerDef ) and a private key with a passphrase to decrypt the passwords (see getServerDef ). As I understand things, the weakest link in this chain is the handling of the private key and passphrase. As you can see from my code below, I'm just using file_get_contents to retrieve the key and passphrase from files located in the current web

PGP/GPG Signed Python code

六月ゝ 毕业季﹏ 提交于 2019-11-30 07:07:46
I'd like to (PGP/GPG) sign python code. Yes, I have read this and many other sites that talk about protecting and obfuscating python code - this all is not what I want. I DON'T want to obfuscate code. I want customers and users to see the code, they could modify code, copy it and make derivative work, I'd like to have the software under the GPLv3. But I want to have plugins that are "signed", so they can be kind of trusted during execution. Is this possible in Python? Can I import a library after checking its gpg signing? What would be easy: check the gpg signing of a file, and then load it

Bouncy Castle C# PGP Decryption example

会有一股神秘感。 提交于 2019-11-30 05:22:18
问题 I have been looking all day yesterday, and I can't seem to find a working example of PGP decryption using Bouncy Castle in c# 回答1: Finally got it to work. The main issue I had with other samples was the fact that the private key ring I had included a key for signing which was coming up first when trying to load the key for decryption. This is why why I had to add a check for the ElGamalPrivateKeyParameters type on the key. Below is my code. Not very clean, but it works. private static