1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-06-01 22:28:02 +02:00

Add help strings for all commands.

This commit is contained in:
Werner Koch 2009-11-04 12:22:09 +00:00
parent 0781afbd9e
commit 0f4a5db22e
2 changed files with 339 additions and 337 deletions

View File

@ -1,7 +1,7 @@
2009-11-04 Werner Koch <wk@g10code.com> 2009-11-04 Werner Koch <wk@g10code.com>
* command.c (register_commands): Add NULL arg to * command.c (register_commands): Add help arg to
assuan_register_command. assuan_register_command. Add help strings to all commands.
2009-11-02 Marcus Brinkmann <marcus@g10code.de> 2009-11-02 Marcus Brinkmann <marcus@g10code.de>

View File

@ -466,25 +466,25 @@ open_card (ctrl_t ctrl, const char *apptype)
} }
/* SERIALNO [APPTYPE] static const char hlp_serialno[] =
"SERIALNO [<apptype>]\n"
Return the serial number of the card using a status reponse. This "\n"
function should be used to check for the presence of a card. "Return the serial number of the card using a status reponse. This\n"
"function should be used to check for the presence of a card.\n"
If APPTYPE is given, an application of that type is selected and an "\n"
error is returned if the application is not supported or available. "If APPTYPE is given, an application of that type is selected and an\n"
The default is to auto-select the application using a hardwired "error is returned if the application is not supported or available.\n"
preference system. Note, that a future extension to this function "The default is to auto-select the application using a hardwired\n"
may allow to specify a list and order of applications to try. "preference system. Note, that a future extension to this function\n"
"may allow to specify a list and order of applications to try.\n"
This function is special in that it can be used to reset the card. "\n"
Most other functions will return an error when a card change has "This function is special in that it can be used to reset the card.\n"
been detected and the use of this function is therefore required. "Most other functions will return an error when a card change has\n"
"been detected and the use of this function is therefore required.\n"
Background: We want to keep the client clear of handling card "\n"
changes between operations; i.e. the client can assume that all "Background: We want to keep the client clear of handling card\n"
operations are done on the same card unless he calls this function. "changes between operations; i.e. the client can assume that all\n"
*/ "operations are done on the same card unless he calls this function.";
static gpg_error_t static gpg_error_t
cmd_serialno (assuan_context_t ctx, char *line) cmd_serialno (assuan_context_t ctx, char *line)
{ {
@ -521,77 +521,75 @@ cmd_serialno (assuan_context_t ctx, char *line)
} }
static const char hlp_learn[] =
"LEARN [--force] [--keypairinfo]\n"
/* LEARN [--force] [--keypairinfo] "\n"
"Learn all useful information of the currently inserted card. When\n"
Learn all useful information of the currently inserted card. When "used without the force options, the command might do an INQUIRE\n"
used without the force options, the command might do an INQUIRE "like this:\n"
like this: "\n"
" INQUIRE KNOWNCARDP <hexstring_with_serialNumber> <timestamp>\n"
INQUIRE KNOWNCARDP <hexstring_with_serialNumber> <timestamp> "\n"
"The client should just send an \"END\" if the processing should go on\n"
The client should just send an "END" if the processing should go on "or a \"CANCEL\" to force the function to terminate with a Cancel\n"
or a "CANCEL" to force the function to terminate with a Cancel "error message.\n"
error message. "\n"
"With the option --keypairinfo only KEYPARIINFO lstatus lines are\n"
With the option --keypairinfo only KEYPARIINFO lstatus lines are "returned.\n"
returned. "\n"
"The response of this command is a list of status lines formatted as\n"
The response of this command is a list of status lines formatted as "this:\n"
this: "\n"
" S APPTYPE <apptype>\n"
S APPTYPE <apptype> "\n"
"This returns the type of the application, currently the strings:\n"
This returns the type of the application, currently the strings: "\n"
" P15 = PKCS-15 structure used\n"
P15 = PKCS-15 structure used " DINSIG = DIN SIG\n"
DINSIG = DIN SIG " OPENPGP = OpenPGP card\n"
OPENPGP = OpenPGP card " NKS = NetKey card\n"
NKS = NetKey card "\n"
"are implemented. These strings are aliases for the AID\n"
are implemented. These strings are aliases for the AID "\n"
" S KEYPAIRINFO <hexstring_with_keygrip> <hexstring_with_id>\n"
S KEYPAIRINFO <hexstring_with_keygrip> <hexstring_with_id> "\n"
"If there is no certificate yet stored on the card a single 'X' is\n"
If there is no certificate yet stored on the card a single "X" is "returned as the keygrip. In addition to the keypair info, information\n"
returned as the keygrip. In addition to the keypair info, information "about all certificates stored on the card is also returned:\n"
about all certificates stored on the card is also returned: "\n"
" S CERTINFO <certtype> <hexstring_with_id>\n"
S CERTINFO <certtype> <hexstring_with_id> "\n"
"Where CERTTYPE is a number indicating the type of certificate:\n"
Where CERTTYPE is a number indicating the type of certificate: " 0 := Unknown\n"
0 := Unknown " 100 := Regular X.509 cert\n"
100 := Regular X.509 cert " 101 := Trusted X.509 cert\n"
101 := Trusted X.509 cert " 102 := Useful X.509 cert\n"
102 := Useful X.509 cert " 110 := Root CA cert in a special format (e.g. DINSIG)\n"
110 := Root CA cert in a special format (e.g. DINSIG) " 111 := Root CA cert as standard X509 cert.\n"
111 := Root CA cert as standard X509 cert. "\n"
"For certain cards, more information will be returned:\n"
For certain cards, more information will be returned: "\n"
" S KEY-FPR <no> <hexstring>\n"
S KEY-FPR <no> <hexstring> "\n"
"For OpenPGP cards this returns the stored fingerprints of the\n"
For OpenPGP cards this returns the stored fingerprints of the "keys. This can be used check whether a key is available on the\n"
keys. This can be used check whether a key is available on the "card. NO may be 1, 2 or 3.\n"
card. NO may be 1, 2 or 3. "\n"
" S CA-FPR <no> <hexstring>\n"
S CA-FPR <no> <hexstring> "\n"
"Similar to above, these are the fingerprints of keys assumed to be\n"
Similar to above, these are the fingerprints of keys assumed to be "ultimately trusted.\n"
ultimately trusted. "\n"
" S DISP-NAME <name_of_card_holder>\n"
S DISP-NAME <name_of_card_holder> "\n"
"The name of the card holder as stored on the card; percent\n"
The name of the card holder as stored on the card; percent "escaping takes place, spaces are encoded as '+'\n"
escaping takes place, spaces are encoded as '+' "\n"
" S PUBKEY-URL <url>\n"
S PUBKEY-URL <url> "\n"
"The URL to be used for locating the entire public key.\n"
The URL to be used for locating the entire public key. " \n"
"Note, that this function may even be used on a locked card.";
Note, that this function may even be used on a locked card.
*/
static gpg_error_t static gpg_error_t
cmd_learn (assuan_context_t ctx, char *line) cmd_learn (assuan_context_t ctx, char *line)
{ {
@ -660,10 +658,10 @@ cmd_learn (assuan_context_t ctx, char *line)
/* READCERT <hexified_certid>|<keyid> static const char hlp_readcert[] =
"READCERT <hexified_certid>|<keyid>\n"
Note, that this function may even be used on a locked card. "\n"
*/ "Note, that this function may even be used on a locked card.";
static gpg_error_t static gpg_error_t
cmd_readcert (assuan_context_t ctx, char *line) cmd_readcert (assuan_context_t ctx, char *line)
{ {
@ -694,13 +692,13 @@ cmd_readcert (assuan_context_t ctx, char *line)
} }
/* READKEY <keyid> static const char hlp_readkey[] =
"READKEY <keyid>\n"
Return the public key for the given cert or key ID as an standard "\n"
S-Expression. "Return the public key for the given cert or key ID as a standard\n"
"S-expression.\n"
Note, that this function may even be used on a locked card. "\n"
*/ "Note, that this function may even be used on a locked card.";
static gpg_error_t static gpg_error_t
cmd_readkey (assuan_context_t ctx, char *line) cmd_readkey (assuan_context_t ctx, char *line)
{ {
@ -777,11 +775,10 @@ cmd_readkey (assuan_context_t ctx, char *line)
static const char hlp_setdata[] =
/* SETDATA <hexstring> "SETDATA <hexstring> \n"
"\n"
The client should use this command to tell us the data he want to "The client should use this command to tell us the data he want to sign.";
sign. */
static gpg_error_t static gpg_error_t
cmd_setdata (assuan_context_t ctx, char *line) cmd_setdata (assuan_context_t ctx, char *line)
{ {
@ -876,11 +873,10 @@ pin_cb (void *opaque, const char *info, char **retstr)
} }
/* PKSIGN [--hash=[rmd160|sha{1,224,256,384,512}|md5]] <hexified_id> static const char hlp_pksign[] =
"PKSIGN [--hash=[rmd160|sha{1,224,256,384,512}|md5]] <hexified_id>\n"
The --hash option is optional; the default is SHA1. "\n"
"The --hash option is optional; the default is SHA1.";
*/
static gpg_error_t static gpg_error_t
cmd_pksign (assuan_context_t ctx, char *line) cmd_pksign (assuan_context_t ctx, char *line)
{ {
@ -948,9 +944,9 @@ cmd_pksign (assuan_context_t ctx, char *line)
return rc; return rc;
} }
/* PKAUTH <hexified_id>
*/ static const char hlp_pkauth[] =
"PKAUTH <hexified_id>";
static gpg_error_t static gpg_error_t
cmd_pkauth (assuan_context_t ctx, char *line) cmd_pkauth (assuan_context_t ctx, char *line)
{ {
@ -998,9 +994,9 @@ cmd_pkauth (assuan_context_t ctx, char *line)
return rc; return rc;
} }
/* PKDECRYPT <hexified_id>
*/ static const char hlp_pkdecrypt[] =
"PKDECRYPT <hexified_id>";
static gpg_error_t static gpg_error_t
cmd_pkdecrypt (assuan_context_t ctx, char *line) cmd_pkdecrypt (assuan_context_t ctx, char *line)
{ {
@ -1043,18 +1039,18 @@ cmd_pkdecrypt (assuan_context_t ctx, char *line)
} }
/* GETATTR <name> static const char hlp_getattr[] =
"GETATTR <name>\n"
This command is used to retrieve data from a smartcard. The "\n"
allowed names depend on the currently selected smartcard "This command is used to retrieve data from a smartcard. The\n"
application. NAME must be percent and '+' escaped. The value is "allowed names depend on the currently selected smartcard\n"
returned through status message, see the LEARN command for details. "application. NAME must be percent and '+' escaped. The value is\n"
"returned through status message, see the LEARN command for details.\n"
However, the current implementation assumes that Name is not escaped; "\n"
this works as long as noone uses arbitrary escaping. "However, the current implementation assumes that Name is not escaped;\n"
"this works as long as noone uses arbitrary escaping. \n"
Note, that this function may even be used on a locked card. "\n"
*/ "Note, that this function may even be used on a locked card.";
static gpg_error_t static gpg_error_t
cmd_getattr (assuan_context_t ctx, char *line) cmd_getattr (assuan_context_t ctx, char *line)
{ {
@ -1082,18 +1078,19 @@ cmd_getattr (assuan_context_t ctx, char *line)
} }
/* SETATTR <name> <value> static const char hlp_setattr[] =
"SETATTR <name> <value> \n"
This command is used to store data on a a smartcard. The allowed "\n"
names and values are depend on the currently selected smartcard "This command is used to store data on a a smartcard. The allowed\n"
application. NAME and VALUE must be percent and '+' escaped. "names and values are depend on the currently selected smartcard\n"
"application. NAME and VALUE must be percent and '+' escaped.\n"
However, the current implementation assumes that NAME is not "\n"
escaped; this works as long as noone uses arbitrary escaping. "However, the current implementation assumes that NAME is not\n"
"escaped; this works as long as noone uses arbitrary escaping.\n"
A PIN will be requested for most NAMEs. See the corresponding "\n"
setattr function of the actually used application (app-*.c) for "A PIN will be requested for most NAMEs. See the corresponding\n"
details. */ "setattr function of the actually used application (app-*.c) for\n"
"details.";
static gpg_error_t static gpg_error_t
cmd_setattr (assuan_context_t ctx, char *orig_line) cmd_setattr (assuan_context_t ctx, char *orig_line)
{ {
@ -1134,17 +1131,17 @@ cmd_setattr (assuan_context_t ctx, char *orig_line)
} }
static const char hlp_writecert[] =
/* WRITECERT <hexified_certid> "WRITECERT <hexified_certid>\n"
"\n"
This command is used to store a certifciate on a smartcard. The "This command is used to store a certifciate on a smartcard. The\n"
allowed certids depend on the currently selected smartcard "allowed certids depend on the currently selected smartcard\n"
application. The actual certifciate is requested using the inquiry "application. The actual certifciate is requested using the inquiry\n"
"CERTDATA" and needs to be provided in its raw (e.g. DER) form. "\"CERTDATA\" and needs to be provided in its raw (e.g. DER) form.\n"
"\n"
In almost all cases a a PIN will be requested. See the related "In almost all cases a a PIN will be requested. See the related\n"
writecert function of the actually used application (app-*.c) for "writecert function of the actually used application (app-*.c) for\n"
details. */ "details.";
static gpg_error_t static gpg_error_t
cmd_writecert (assuan_context_t ctx, char *line) cmd_writecert (assuan_context_t ctx, char *line)
{ {
@ -1196,20 +1193,20 @@ cmd_writecert (assuan_context_t ctx, char *line)
} }
static const char hlp_writekey[] =
/* WRITEKEY [--force] <keyid> "WRITEKEY [--force] <keyid> \n"
"\n"
This command is used to store a secret key on a a smartcard. The "This command is used to store a secret key on a a smartcard. The\n"
allowed keyids depend on the currently selected smartcard "allowed keyids depend on the currently selected smartcard\n"
application. The actual keydata is requested using the inquiry "application. The actual keydata is requested using the inquiry\n"
"KEYDATA" and need to be provided without any protection. With "\"KEYDATA\" and need to be provided without any protection. With\n"
--force set an existing key under this KEYID will get overwritten. "--force set an existing key under this KEYID will get overwritten.\n"
The keydata is expected to be the usual canonical encoded "The keydata is expected to be the usual canonical encoded\n"
S-expression. "S-expression.\n"
"\n"
A PIN will be requested for most NAMEs. See the corresponding "A PIN will be requested for most NAMEs. See the corresponding\n"
writekey function of the actually used application (app-*.c) for "writekey function of the actually used application (app-*.c) for\n"
details. */ "details.";
static gpg_error_t static gpg_error_t
cmd_writekey (assuan_context_t ctx, char *line) cmd_writekey (assuan_context_t ctx, char *line)
{ {
@ -1263,29 +1260,27 @@ cmd_writekey (assuan_context_t ctx, char *line)
} }
static const char hlp_genkey[] =
/* GENKEY [--force] [--timestamp=<isodate>] <no> "GENKEY [--force] [--timestamp=<isodate>] <no>\n"
"\n"
Generate a key on-card identified by NO, which is application "Generate a key on-card identified by NO, which is application\n"
specific. Return values are application specific. For OpenPGP "specific. Return values are application specific. For OpenPGP\n"
cards 2 status lines are returned: "cards 2 status lines are returned:\n"
"\n"
S KEY-FPR <hexstring> " S KEY-FPR <hexstring>\n"
S KEY-CREATED-AT <seconds_since_epoch> " S KEY-CREATED-AT <seconds_since_epoch>\n"
S KEY-DATA [p|n] <hexdata> " S KEY-DATA [p|n] <hexdata>\n"
"\n"
--force is required to overwrite an already existing key. The "--force is required to overwrite an already existing key. The\n"
KEY-CREATED-AT is required for further processing because it is "KEY-CREATED-AT is required for further processing because it is\n"
part of the hashed key material for the fingerprint. "part of the hashed key material for the fingerprint.\n"
"\n"
If --timestamp is given an OpenPGP key will be created using this "If --timestamp is given an OpenPGP key will be created using this\n"
value. The value needs to be in ISO Format; e.g. "value. The value needs to be in ISO Format; e.g.\n"
"--timestamp=20030316T120000" and after 1970-01-01 00:00:00. "\"--timestamp=20030316T120000\" and after 1970-01-01 00:00:00.\n"
"\n"
The public part of the key can also later be retrieved using the "The public part of the key can also later be retrieved using the\n"
READKEY command. "READKEY command.";
*/
static gpg_error_t static gpg_error_t
cmd_genkey (assuan_context_t ctx, char *line) cmd_genkey (assuan_context_t ctx, char *line)
{ {
@ -1339,12 +1334,14 @@ cmd_genkey (assuan_context_t ctx, char *line)
} }
/* RANDOM <nbytes> static const char hlp_random[] =
"RANDOM <nbytes>\n"
Get NBYTES of random from the card and send them back as data. "\n"
"Get NBYTES of random from the card and send them back as data.\n"
Note, that this function may be even be used on a locked card. "This usually involves EEPROM write on the card and thus excessive\n"
*/ "use of this command may destroy the card.\n"
"\n"
"Note, that this function may be even be used on a locked card.";
static gpg_error_t static gpg_error_t
cmd_random (assuan_context_t ctx, char *line) cmd_random (assuan_context_t ctx, char *line)
{ {
@ -1354,7 +1351,8 @@ cmd_random (assuan_context_t ctx, char *line)
unsigned char *buffer; unsigned char *buffer;
if (!*line) if (!*line)
return set_error (GPG_ERR_ASS_PARAMETER, "number of requested bytes missing"); return set_error (GPG_ERR_ASS_PARAMETER,
"number of requested bytes missing");
nbytes = strtoul (line, NULL, 0); nbytes = strtoul (line, NULL, 0);
if ((rc = open_card (ctrl, NULL))) if ((rc = open_card (ctrl, NULL)))
@ -1380,13 +1378,15 @@ cmd_random (assuan_context_t ctx, char *line)
return rc; return rc;
} }
/* PASSWD [--reset] [--nullpin] <chvno> static const char hlp_passwd[] =
"PASSWD [--reset] [--nullpin] <chvno>\n"
Change the PIN or, if --reset is given, reset the retry counter of "\n"
the card holder verfication vector CHVNO. The option --nullpin is "Change the PIN or, if --reset is given, reset the retry counter of\n"
used for TCOS cards to set the initial PIN. The format of CHVNO "the card holder verfication vector CHVNO. The option --nullpin is\n"
depends on the card application. */ "used for TCOS cards to set the initial PIN. The format of CHVNO\n"
"depends on the card application.";
static gpg_error_t static gpg_error_t
cmd_passwd (assuan_context_t ctx, char *line) cmd_passwd (assuan_context_t ctx, char *line)
{ {
@ -1431,39 +1431,38 @@ cmd_passwd (assuan_context_t ctx, char *line)
} }
/* CHECKPIN <idstr> static const char hlp_checkpin[] =
"CHECKPIN <idstr>\n"
Perform a VERIFY operation without doing anything else. This may "\n"
be used to initialize a the PIN cache earlier to long lasting "Perform a VERIFY operation without doing anything else. This may\n"
operations. Its use is highly application dependent. "be used to initialize a the PIN cache earlier to long lasting\n"
"operations. Its use is highly application dependent.\n"
For OpenPGP: "\n"
"For OpenPGP:\n"
Perform a simple verify operation for CHV1 and CHV2, so that "\n"
further operations won't ask for CHV2 and it is possible to do a " Perform a simple verify operation for CHV1 and CHV2, so that\n"
cheap check on the PIN: If there is something wrong with the PIN " further operations won't ask for CHV2 and it is possible to do a\n"
entry system, only the regular CHV will get blocked and not the " cheap check on the PIN: If there is something wrong with the PIN\n"
dangerous CHV3. IDSTR is the usual card's serial number in hex " entry system, only the regular CHV will get blocked and not the\n"
notation; an optional fingerprint part will get ignored. There " dangerous CHV3. IDSTR is the usual card's serial number in hex\n"
is however a special mode if the IDSTR is sffixed with the " notation; an optional fingerprint part will get ignored. There\n"
literal string "[CHV3]": In this case the Admin PIN is checked " is however a special mode if the IDSTR is sffixed with the\n"
if and only if the retry counter is still at 3. " literal string \"[CHV3]\": In this case the Admin PIN is checked\n"
" if and only if the retry counter is still at 3.\n"
For Netkey: "\n"
"For Netkey:\n"
Any of the valid PIN Ids may be used. These are the strings: "\n"
" Any of the valid PIN Ids may be used. These are the strings:\n"
PW1.CH - Global password 1 "\n"
PW2.CH - Global password 2 " PW1.CH - Global password 1\n"
PW1.CH.SIG - SigG password 1 " PW2.CH - Global password 2\n"
PW2.CH.SIG - SigG password 2 " PW1.CH.SIG - SigG password 1\n"
" PW2.CH.SIG - SigG password 2\n"
For a definitive list, see the implementation in app-nks.c. "\n"
Note that we call a PW2.* PIN a "PUK" despite that since TCOS " For a definitive list, see the implementation in app-nks.c.\n"
3.0 they are technically alternative PINs used to mutally " Note that we call a PW2.* PIN a \"PUK\" despite that since TCOS\n"
unblock each other. " 3.0 they are technically alternative PINs used to mutally\n"
" unblock each other.";
*/
static gpg_error_t static gpg_error_t
cmd_checkpin (assuan_context_t ctx, char *line) cmd_checkpin (assuan_context_t ctx, char *line)
{ {
@ -1497,16 +1496,16 @@ cmd_checkpin (assuan_context_t ctx, char *line)
} }
/* LOCK [--wait] static const char hlp_lock[] =
"LOCK [--wait]\n"
Grant exclusive card access to this session. Note that there is "\n"
no lock counter used and a second lock from the same session will "Grant exclusive card access to this session. Note that there is\n"
be ignored. A single unlock (or RESET) unlocks the session. "no lock counter used and a second lock from the same session will\n"
Return GPG_ERR_LOCKED if another session has locked the reader. "be ignored. A single unlock (or RESET) unlocks the session.\n"
"Return GPG_ERR_LOCKED if another session has locked the reader.\n"
If the option --wait is given the command will wait until a "\n"
lock has been released. "If the option --wait is given the command will wait until a\n"
*/ "lock has been released.";
static gpg_error_t static gpg_error_t
cmd_lock (assuan_context_t ctx, char *line) cmd_lock (assuan_context_t ctx, char *line)
{ {
@ -1541,10 +1540,10 @@ cmd_lock (assuan_context_t ctx, char *line)
} }
/* UNLOCK static const char hlp_unlock[] =
"UNLOCK\n"
Release exclusive card access. "\n"
*/ "Release exclusive card access.";
static gpg_error_t static gpg_error_t
cmd_unlock (assuan_context_t ctx, char *line) cmd_unlock (assuan_context_t ctx, char *line)
{ {
@ -1569,34 +1568,33 @@ cmd_unlock (assuan_context_t ctx, char *line)
} }
/* GETINFO <what> static const char hlp_getinfo[] =
"GETINFO <what>\n"
Multi purpose command to return certain information. "\n"
Supported values of WHAT are: "Multi purpose command to return certain information. \n"
"Supported values of WHAT are:\n"
version - Return the version of the program. "\n"
pid - Return the process id of the server. "version - Return the version of the program.\n"
"pid - Return the process id of the server.\n"
socket_name - Return the name of the socket. "\n"
"socket_name - Return the name of the socket.\n"
status - Return the status of the current slot (in the future, may "\n"
also return the status of all slots). The status is a list of "status - Return the status of the current slot (in the future, may\n"
one-character flags. The following flags are currently defined: "also return the status of all slots). The status is a list of\n"
'u' Usable card present. This is the normal state during operation. "one-character flags. The following flags are currently defined:\n"
'r' Card removed. A reset is necessary. " 'u' Usable card present. This is the normal state during operation.\n"
These flags are exclusive. " 'r' Card removed. A reset is necessary.\n"
"These flags are exclusive.\n"
reader_list - Return a list of detected card readers. Does "\n"
currently only work with the internal CCID driver. "reader_list - Return a list of detected card readers. Does\n"
" currently only work with the internal CCID driver.\n"
deny_admin - Returns OK if admin commands are not allowed or "\n"
GPG_ERR_GENERAL if admin commands are allowed. "deny_admin - Returns OK if admin commands are not allowed or\n"
" GPG_ERR_GENERAL if admin commands are allowed.\n"
app_list - Return a list of supported applications. One "\n"
application per line, fields delimited by colons, "app_list - Return a list of supported applications. One\n"
first field is the name. " application per line, fields delimited by colons,\n"
*/ " first field is the name.";
static gpg_error_t static gpg_error_t
cmd_getinfo (assuan_context_t ctx, char *line) cmd_getinfo (assuan_context_t ctx, char *line)
{ {
@ -1677,17 +1675,16 @@ cmd_getinfo (assuan_context_t ctx, char *line)
} }
/* RESTART static const char hlp_restart[] =
"RESTART\n"
Restart the current connection; this is a kind of warm reset. It "\n"
deletes the context used by this connection but does not send a "Restart the current connection; this is a kind of warm reset. It\n"
RESET to the card. Thus the card itself won't get reset. "deletes the context used by this connection but does not send a\n"
"RESET to the card. Thus the card itself won't get reset. \n"
This is used by gpg-agent to reuse a primary pipe connection and "\n"
may be used by clients to backup from a conflict in the serial "This is used by gpg-agent to reuse a primary pipe connection and\n"
command; i.e. to select another application. "may be used by clients to backup from a conflict in the serial\n"
*/ "command; i.e. to select another application.";
static gpg_error_t static gpg_error_t
cmd_restart (assuan_context_t ctx, char *line) cmd_restart (assuan_context_t ctx, char *line)
{ {
@ -1709,11 +1706,11 @@ cmd_restart (assuan_context_t ctx, char *line)
} }
/* DISCONNECT static const char hlp_disconnect[] =
"DISCONNECT\n"
Disconnect the card if it is not any longer used by other "\n"
connections and the backend supports a disconnect operation. "Disconnect the card if it is not any longer used by other\n"
*/ "connections and the backend supports a disconnect operation.";
static gpg_error_t static gpg_error_t
cmd_disconnect (assuan_context_t ctx, char *line) cmd_disconnect (assuan_context_t ctx, char *line)
{ {
@ -1727,25 +1724,25 @@ cmd_disconnect (assuan_context_t ctx, char *line)
/* APDU [--atr] [--more] [--exlen[=N]] [hexstring] static const char hlp_apdu[] =
"APDU [--atr] [--more] [--exlen[=N]] [hexstring]\n"
Send an APDU to the current reader. This command bypasses the high "\n"
level functions and sends the data directly to the card. HEXSTRING "Send an APDU to the current reader. This command bypasses the high\n"
is expected to be a proper APDU. If HEXSTRING is not given no "level functions and sends the data directly to the card. HEXSTRING\n"
commands are set to the card but the command will implictly check "is expected to be a proper APDU. If HEXSTRING is not given no\n"
whether the card is ready for use. "commands are set to the card but the command will implictly check\n"
"whether the card is ready for use. \n"
Using the option "--atr" returns the ATR of the card as a status "\n"
message before any data like this: "Using the option \"--atr\" returns the ATR of the card as a status\n"
S CARD-ATR 3BFA1300FF813180450031C173C00100009000B1 "message before any data like this:\n"
" S CARD-ATR 3BFA1300FF813180450031C173C00100009000B1\n"
Using the option --more handles the card status word MORE_DATA "\n"
(61xx) and concatenates all reponses to one block. "Using the option --more handles the card status word MORE_DATA\n"
"(61xx) and concatenates all reponses to one block.\n"
Using the option "--exlen" the returned APDU may use extended "\n"
length up to N bytes. If N is not given a default value is used "Using the option \"--exlen\" the returned APDU may use extended\n"
(currently 4096). "length up to N bytes. If N is not given a default value is used\n"
*/ "(currently 4096).";
static gpg_error_t static gpg_error_t
cmd_apdu (assuan_context_t ctx, char *line) cmd_apdu (assuan_context_t ctx, char *line)
{ {
@ -1826,7 +1823,10 @@ cmd_apdu (assuan_context_t ctx, char *line)
} }
/* KILLSCD - Commit suicide. */ static const char hlp_killscd[] =
"KILLSCD\n"
"\n"
"Commit suicide.";
static gpg_error_t static gpg_error_t
cmd_killscd (assuan_context_t ctx, char *line) cmd_killscd (assuan_context_t ctx, char *line)
{ {
@ -1847,39 +1847,41 @@ register_commands (assuan_context_t ctx)
static struct { static struct {
const char *name; const char *name;
assuan_handler_t handler; assuan_handler_t handler;
const char * const help;
} table[] = { } table[] = {
{ "SERIALNO", cmd_serialno }, { "SERIALNO", cmd_serialno, hlp_serialno },
{ "LEARN", cmd_learn }, { "LEARN", cmd_learn, hlp_learn },
{ "READCERT", cmd_readcert }, { "READCERT", cmd_readcert, hlp_readcert },
{ "READKEY", cmd_readkey }, { "READKEY", cmd_readkey, hlp_readkey },
{ "SETDATA", cmd_setdata }, { "SETDATA", cmd_setdata, hlp_setdata },
{ "PKSIGN", cmd_pksign }, { "PKSIGN", cmd_pksign, hlp_pksign },
{ "PKAUTH", cmd_pkauth }, { "PKAUTH", cmd_pkauth, hlp_pkauth },
{ "PKDECRYPT", cmd_pkdecrypt }, { "PKDECRYPT", cmd_pkdecrypt,hlp_pkdecrypt },
{ "INPUT", NULL }, { "INPUT", NULL },
{ "OUTPUT", NULL }, { "OUTPUT", NULL },
{ "GETATTR", cmd_getattr }, { "GETATTR", cmd_getattr, hlp_getattr },
{ "SETATTR", cmd_setattr }, { "SETATTR", cmd_setattr, hlp_setattr },
{ "WRITECERT", cmd_writecert }, { "WRITECERT", cmd_writecert,hlp_writecert },
{ "WRITEKEY", cmd_writekey }, { "WRITEKEY", cmd_writekey, hlp_writekey },
{ "GENKEY", cmd_genkey }, { "GENKEY", cmd_genkey, hlp_genkey },
{ "RANDOM", cmd_random }, { "RANDOM", cmd_random, hlp_random },
{ "PASSWD", cmd_passwd }, { "PASSWD", cmd_passwd, hlp_passwd },
{ "CHECKPIN", cmd_checkpin }, { "CHECKPIN", cmd_checkpin, hlp_checkpin },
{ "LOCK", cmd_lock }, { "LOCK", cmd_lock, hlp_lock },
{ "UNLOCK", cmd_unlock }, { "UNLOCK", cmd_unlock, hlp_unlock },
{ "GETINFO", cmd_getinfo }, { "GETINFO", cmd_getinfo, hlp_getinfo },
{ "RESTART", cmd_restart }, { "RESTART", cmd_restart, hlp_restart },
{ "DISCONNECT", cmd_disconnect }, { "DISCONNECT", cmd_disconnect,hlp_disconnect },
{ "APDU", cmd_apdu }, { "APDU", cmd_apdu, hlp_apdu },
{ "KILLSCD", cmd_killscd }, { "KILLSCD", cmd_killscd, hlp_killscd },
{ NULL } { NULL }
}; };
int i, rc; int i, rc;
for (i=0; table[i].name; i++) for (i=0; table[i].name; i++)
{ {
rc = assuan_register_command (ctx, table[i].name, table[i].handler, NULL); rc = assuan_register_command (ctx, table[i].name, table[i].handler,
table[i].help);
if (rc) if (rc)
return rc; return rc;
} }