Created
February 12, 2016 22:04
-
-
Save charlesmims/7e183a3bd4286f6532c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# make this file executable and save it in /usr/local/bin/. | |
# pipe gpg ascii-armored code to it to strip it into a simple string | |
# pipe the simple string to it to get the original formatting back which | |
# you can pipe into gpg. | |
import fileinput | |
message = '' | |
for line in fileinput.input(): | |
message += line | |
if '-----BEGIN PGP MESSAGE-----' in message: | |
print(message.replace('\n','').replace('-----BEGIN PGP MESSAGE-----Version: GnuPG v1','').replace('-----END PGP MESSAGE-----','')) | |
else: | |
print('-----BEGIN PGP MESSAGE-----') | |
print('Version: GnuPG v1') | |
for line in [message[i:i+64] for i in range(0,len(message), 64)]: | |
print(line) | |
print('-----END PGP MESSAGE-----') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[16:02:54] cmims@MBP:~$ echo foo | gpg -aer charles | strypt
hQEMAy+srmFFNvA3AQf/em40tc/gqYANTYZRbgLSFyZXn3r4vZ0ApBBEpkdxHIuaSG5zc1ea6k9ZYAIYbyKtoX2K9DCKBUWFbhHBSiSlNvZh1SzTH6ouEk3UPGtCUn+1uYnJJildUP1TtT5QvDVz8iedmSf9T0j1UcyJ+wm4LejE27aUMM+yBXz+6FWK+r7FLWCnC5wewsDUaGxvYSmRLk+VHS2X9K7r/kcW18zdH1A9J9mJ+t4vF1v294mTjBVry2hAF7xqpQBxYFYcx5eeFHL03zmI3G1EFDa2miaFNOvgoLxK8o+DyAy/iNNiTq7vxV6bNwxgQUD5IdvSaSfl5x1bNh29KhyZtAp9gNBpD9I/AZiULd0WDTGlrjF7EIVmhPz9UGIHD7cMraLAa4MSLAGton+kvZNroNkEI4XskVlhyac/KFMuWVU0/LYAWtnz=oF5J
[16:03:03] cmims@MBP:~$ echo hQEMAy+srmFFNvA3AQf/em40tc/gqYANTYZRbgLSFyZXn3r4vZ0ApBBEpkdxHIuaSG5zc1ea6k9ZYAIYbyKtoX2K9DCKBUWFbhHBSiSlNvZh1SzTH6ouEk3UPGtCUn+1uYnJJildUP1TtT5QvDVz8iedmSf9T0j1UcyJ+wm4LejE27aUMM+yBXz+6FWK+r7FLWCnC5wewsDUaGxvYSmRLk+VHS2X9K7r/kcW18zdH1A9J9mJ+t4vF1v294mTjBVry2hAF7xqpQBxYFYcx5eeFHL03zmI3G1EFDa2miaFNOvgoLxK8o+DyAy/iNNiTq7vxV6bNwxgQUD5IdvSaSfl5x1bNh29KhyZtAp9gNBpD9I/AZiULd0WDTGlrjF7EIVmhPz9UGIHD7cMraLAa4MSLAGton+kvZNroNkEI4XskVlhyac/KFMuWVU0/LYAWtnz=oF5J | strypt | gpg -d
You need a passphrase to unlock the secret key for
user: "Charles Mims [email protected]"
2048-bit RSA key, ID 4536F037, created 2015-12-08 (main key ID 56987D7F)
gpg: encrypted with 2048-bit RSA key, ID 4536F037, created 2015-12-08
"Charles Mims [email protected]"
foo