3
# gpgsm-gencert.c - Generate X.509 certificates through GPGSM.
4
# Copyright (C) 2004 Free Software Foundation, Inc.
6
# This file is part of GnuPG.
8
# GnuPG is free software; you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation; either version 2 of the License, or
11
# (at your option) any later version.
13
# GnuPG is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program; if not, write to the Free Software
20
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
29
INPUT FD=$ASSUAN_FP_IN\n\
30
OUTPUT FD=$ASSUAN_FP_OUT --armor\n\
53
for choice in "$@"; do
55
echo " [$i] $choice" >&2
60
echo -n "Your selection: " >&2
63
while [ $j -lt $i -o $j -eq $i ]; do
64
if [ "$idx" = $j ]; then
69
if [ $j -lt $i -o $j -eq $i ]; then
75
for choice in "$@"; do
77
if [ $i -eq $idx ]; then
84
echo "You selected: $ANSWER" >&2
87
query_user_menu "Key type" "RSA"
90
query_user_menu "Key length" "1024" "2048"
93
query_user_menu "Key usage" "sign, encrypt" "sign" "encrypt"
99
query_user "E-Mail address"
100
EMAIL_ADDRESS=$ANSWER
102
file_parameter=$(mktemp "/tmp/gpgsm.XXXXXX")
103
outfile=$(mktemp "/tmp/gpgsm.XXXXXX")
105
cat > "$file_parameter" <<EOF
107
Key-Length: $KEY_LENGTH
108
Key-Usage: $KEY_USAGE
110
Name-Email: $EMAIL_ADDRESS
113
echo -e "$ASSUAN_COMMANDS" | \
114
gpgsm --server 4< "$file_parameter" 5>"$outfile" >/dev/null
118
rm "$file_parameter" "$outfile"