gen-key non-interactively

David Shaw dshaw at jabberwocky.com
Thu Feb 8 17:10:02 CET 2007


On Thu, Feb 08, 2007 at 07:44:02AM -0800, snowcrash+gnupg-users wrote:
> here's an "expect"-based function i use in a bash script for just such purpose,
> 
> # function: "DO_GENKEY_SESSION"
> 	# auto-execute a GPG --gen-key session
> 	# usage:
> 		# 	DO_GENKEY_SESSION (SELECTION) $NOTATION $COMMENT
> 	# gen-key dialog options (SELECTION):
> 	# Please select what kind of key you want:
> 	#   (1) DSA and Elgamal (default)
> 	#   (2) DSA (sign only)
> 	#   (3) DSA (set your own capabilities)
> 	#   (5) RSA (sign only)
> 	#   (7) RSA (set your own capabilities)
> DO_GENKEY_SESSION () {
> 	echo "START: $COMMENT"
> 	VAR=$($EXPECT -c "

I strongly advise against using expect to generate keys.  Your expect
script will break when we change the text that GPG displays.  If you
want to generate keys unattended, then use the --batch --gen-key
interface.

David



More information about the Gnupg-users mailing list