Hi - I have a public key with two encryption subkeys (see note below). I am attempting to clobber together a bash script to select a given subkey and use that subkey for encryption. Using the following sample key and sample script, `afile` is encrypted with subkey CCCCCCCC (and not the expected BBBBBBBB subkey). Note that no matter what subkey register slot I provide to `--edit-key` in the sample script, `gpg` always encrypts using the CCCCCCCC subkey. How can I selectively use a given encryption subkey in a noninteractive session?
Sample public key: pub 4096R/AAAAAAAA 2009-08-11 [expires: 2020-12-31] uid Name (Comment) <email> sub 4096g/BBBBBBBB 2009-12-25 [expires: 2010-12-31] sub 4096R/CCCCCCCC 2010-09-25 [expires: 2010-11-30] Sample script: #!/bin/bash gpg --quiet --batch --edit-key AAAAAAAA "key 1"; # Select subkey BBBBBBBB (I also tried a value of "key 2") cat afile | gpg --quiet --batch --hidden-recipient AAAAAAAA --passphrase-file sfile --sign --encrypt - > newfile; Note: It was not my decision to use two encryption subkeys, but I've been requested to use each under certain circumstances. Also, anyone the copies/ pastes the above code should avoid the use of the `--passphrase-file` option as I am only using this in testing. Many thanks.
_______________________________________________ Gnupg-users mailing list Gnupg-users@gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-users