#!/usr/bin/expect spawn gpgsm --gen-key -o sign.crt expect "Your selection?" send -- "3\r" expect "Your selection?" send -- "3\r" expect "Your selection?" send -- "2\r" expect "Enter the X.509 subject name:" send -- "CN=Signing key for canokey,O=example,C=DE\r" expect "Enter email addresses (end with an empty line):" send -- "test@example.org\r\r" expect "Enter DNS names (optional; end with an empty line):" send -- "\r" expect "Enter URIs (optional; end with an empty line):" send -- "\r" expect "Create self-signed certificate? (y/N)" send -- "y\r" expect "Proceed with creation? (y/N)" send -- "y\r" expect eof