pgp

Run system command in ruby and interact with it

青春壹個敷衍的年華 提交于 2019-11-30 03:11:20
问题 I need to run a command on the command-line that asks for a user response. In case it helps the command is: gpg --recipient "Some Name" --encrypt ~/some_file.txt when you run this, it warns about something then asks: Use this key anyway? (y/N) Responding 'y' let's it finish correctly. I have been trying to use the open4 gem but I have not been able to get it to specify the 'y' correctly. Here is what I tried: Open4::popen4(cmd) do |pid, stdin, stdout, stderr| stdin.puts "y" stdin.close puts

PGP Encrypt and Decrypt

﹥>﹥吖頭↗ 提交于 2019-11-30 00:30:29
I am really struggling with this, I need to encrypt and decrypt a string using BouncyCastle in C#. I really did try to do this on my own. I did manage to create my own keys (private and public). Please keep in mind that I am fresh out of college. It took me a while to find a decent example of using bouncy castle for PGP. This is what I use in production. I'm pretty sure it originated from here . using System; using System.IO; using Org.BouncyCastle.Bcpg; using Org.BouncyCastle.Bcpg.OpenPgp; using Org.BouncyCastle.Security; using Org.BouncyCastle.Utilities.IO; namespace FileEncryptionTasks

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

一曲冷凌霜 提交于 2019-11-29 23:02:05
问题 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. 回答1: 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

Bouncycastle PGP decrypt and verify

孤人 提交于 2019-11-29 13:07:09
问题 I'm trying to decrypt and verify a PGP message using the java BouncyCastle libraries, but am running into issues, complaining about premature ends of PartialInputStream. I know the encrypt works fine, because I can decrypt and verify messages created with the encrypt function using gpg on the command line. Here's the code: public static void signEncryptMessage(InputStream in, OutputStream out, PGPPublicKey publicKey, PGPPrivateKey secretKey, SecureRandom rand) throws Exception { out = new

PGP/GPG Signed Python code

爱⌒轻易说出口 提交于 2019-11-29 08:25:42
问题 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

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

僤鯓⒐⒋嵵緔 提交于 2019-11-29 06:06:18
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 directory--not good. My question is: what is a good method for securely retrieving the private key and

PgP Encryption and Decryption using BouncyCastle c#

自作多情 提交于 2019-11-28 21:39:35
I've seen a number of posts, followed a number of tutorials but none seems to work. Sometimes, they make reference to some classes which are not found. Can I be pointed to a place where I can get a simple tutorial showing how to encrypt and decrypt a file. I'm very new to Pgp and any assistance is welcomed. Chris B. Behrens How's this: PartialInputStream during Bouncycastle PGP decryption Also, the zip contains examples here: http://www.bouncycastle.org/csharp/ Hope this helps. If you're still stuck, post some more detail about what classes the compiler is complaining about and the community

Sign git commits with GPG

扶醉桌前 提交于 2019-11-28 18:37:16
Is there a way to sign git commits with gpg? It's so easy with tags (using -s instead of -a ), it seems there would be a similar function for commits. git commit -S (requires git >= 1.7.9). VonC Note: Adding the -S option all the time can be cumbersome. In git 2.0 and later, you can add a config which will take care of that option for you. See commit 2af2ef3 by Nicolas Vigier (boklm) : Add the commit.gpgsign option to sign all commits If you want to GPG sign all your commits, you have to add the -S option all the time. The commit.gpgsign config option allows to sign all commits automatically.

How to encrypt a string/stream with bouncycastle pgp without starting with a file

让人想犯罪 __ 提交于 2019-11-28 16:21:35
I need to encrypt a stream with pgp using the bouncycastle provider. All of the examples I can find are about taking a plain text file and encrypting that however I won't have a file and it's important that the plain text never be written to disk. Most of the methods I've seen are using PGPUtil.writeFileToLiteralData which wants the plaintext passed in. I'd rather passin a byte[] or an inputStream. Can someone point me to an example that starts from string/byte[]/inputstream encrypts said string/byte[] to an outputStrem that I can write to a file decrypts from an inputStream In case anyone

C# How to simply encrypt a text file with a PGP Public Key?

天涯浪子 提交于 2019-11-28 05:55:55
I've researched a bit about how to achieve what I said in the question and found several APIs but most of them look very complicated and since I'm just a noobie in this area I just want a simple method like: public String Encrypt(String message, PublicKey publicKey) Don't know if this can be done? If not then please someone enlighten me another way to achieve this :) Thank you. UPDATE: So far I have only seen that all of the library for OpenPGP encryption require both the public key and private key to do the encrypt while I only want to encrypt with the public key (because I don't have the