How can I extract the --embedded-filename for scripting?
Peter Lebbing
peter at digitalbrains.com
Wed May 8 13:22:16 CEST 2013
> Do you see any way to get the embedded file name for variables?
I see two options.
One: get the name before you write the decrypted file. Since the name is
obviously encrypted, you do need your private key.
$ gpg --with-colons --list-packets foo.gpg
:pubkey enc packet: version 3, algo 1, keyid 26F7563E73A33BEE
data: [2043 bits]
:encrypted data packet:
length: 86
mdc_method: 2
gpg: encrypted with 2048-bit RSA key, ID 73A33BEE, created 2009-11-12
"Peter Lebbing <peter at digitalbrains.com>"
:compressed packet: algo=2
:literal data packet:
mode b (62), created 1368011777, name="Hi Michael",
raw data: 16 bytes
I created a file named "Hi Michael" filled with 16 bytes of randomness.
Two: get the name from status-fd during writing the decrypted file.
$ gpg --status-fd 1 --use-embedded-filename foo.gpg
[GNUPG:] ENC_TO 26F7563E73A33BEE 1 0
[GNUPG:] CARDCTRL 3
gpg: encrypted with 2048-bit RSA key, ID 73A33BEE, created 2009-11-12
"Peter Lebbing <peter at digitalbrains.com>"
[GNUPG:] BEGIN_DECRYPTION
[GNUPG:] DECRYPTION_INFO 2 7
[GNUPG:] PLAINTEXT 62 1368011777 Hi%20Michael
[GNUPG:] PLAINTEXT_LENGTH 16
[GNUPG:] DECRYPTION_OKAY
[GNUPG:] GOODMDC
[GNUPG:] END_DECRYPTION
HTH,
Peter.
--
I use the GNU Privacy Guard (GnuPG) in combination with Enigmail.
You can send me encrypted mail if you want some privacy.
My key is available at <http://digitalbrains.com/2012/openpgp-key-peter>
More information about the Gnupg-users
mailing list