How do I encrypt plaintext with GnuPG?

What about: $ echo “hello” | gpg –symmetric –armor –passphrase “asdf” —–BEGIN PGP MESSAGE—– Version: GnuPG v1.4.11 (Darwin) jA0EAwMCWfhRZo0AiwVgyRw5Q26Tf+i6OCiQOVoUNJZEfz5ekBJw6BdVpE88 =ecV3 —–END PGP MESSAGE—– If this is what you’re looking for, you’ll want to setup gpg-agent to handle the passphrase… Passing it in from the command line like that is fairly insecure (as any program on … Read more

How do I verify a gpg signature matches a public key file?

The only way to use a specific public key file like a keyring is if the file is in the GPG (OpenPGP) file format and not an ASCII armoured version (e.g. pubkey.gpg not pubkey.asc). So this will verify the file: gpg –no-default-keyring –keyring /path/to/pubkey.gpg –verify /path/to/file.txt.gpg And this will not: gpg –no-default-keyring –keyring /path/to/pubkey.asc –verify … Read more

where can I find the public key for Gnu Emacs?

If you try to verify the signature using gpg –verify <pkg>.key you’ll get an output like the following: gpg: Signature made 02/17/05 14:02:42 GTB Standard Time using DSA key ID BE216115 gpg: Can’t check signature: No public key The key ID you are looking for is BE216115, so you ask gpg to retrieve it using: … Read more

Prevent git from asking for the GnuPG password during signing a commit

Git never gets hold of the GnuPG passphrase. You must rely on GnuPG’s capabilities of caching passphrases, which happens through gpg-agent which are easily set up by editing ~/.gnupg/gpg-agent.conf (hidden somewhere in your AppData folder in Windows). Set default-cache-ttl to the number of seconds the passphrase is cached after each invocation of GnuPG. maximum-cache-ttl sets … Read more

Avoid gpg signing prompt when using Maven release plugin

Just set it up in a profile in settings.xml and activate it by default: <settings> <profiles> <profile> <id>gpg</id> <properties> <gpg.executable>gpg2</gpg.executable> <gpg.passphrase>mypassphrase</gpg.passphrase> </properties> </profile> </profiles> <activeProfiles> <activeProfile>gpg</activeProfile> </activeProfiles> </settings> As you can see you can do that with any property .. e.g. also other usernames and passwords for the jarsigner plugin and so on. This should … Read more

Generating a GPG key for git tagging

First you need check if there is a gpg key for your ID. $ gpg –list-key If you have should appear something like this: pub 2048R/6AB3587A 2013-05-23 uid xxx (gpg for xxx) sub 2048R/64CB327A 2013-05-23 If there is no gpg key. You should create $ gpg –gen-key Next you have this output: gpg (GnuPG) 2.0.14; … Read more

How to do PGP in Python (generate keys, encrypt/decrypt)

You don’t need PyCrypto or PyMe, fine though those packages may be – you will have all kinds of problems building under Windows. Instead, why not avoid the rabbit-holes and do what I did? Use gnupg 1.4.9. You don’t need to do a full installation on end-user machines – just gpg.exe and iconv.dll from the … Read more

Is there a way to gpg sign all previous commits?

My approach is git rebase –exec “git commit –amend –no-edit -n -S” -i 8fd7b22 All commits started from the next after 8fd7b22 will be rebased with no changes except signing. To change all commits started from the very first one you may use –root (since Git v1.7.12): git rebase –exec “git commit –amend –no-edit -n … Read more

Is there a good GnuPG encryption library for Java/Scala? [closed]

You can try to call the JAVA API of BouncyCastle.org. Its documentation mentions: The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. You have here an example of openpgp ByteArrayHandler. There might be some incompatibility between BouncyCastle encryption and GnuGP encryption though, since BouncyCastle does not use GnuPG, but rather implements OpenPGP … Read more