Blame doc/uiserver.texi

Packit Service 672cf4
@c uiserver.texi                    -*- mode: texinfo; coding: latin-1; -*-
Packit Service 672cf4
@c Specification of the UI server protocol.
Packit Service 672cf4
@c To be included by gpgme.texi
Packit Service 672cf4
Packit Service 672cf4
@node UI Server Protocol
Packit Service 672cf4
@appendix The GnuPG UI Server Protocol
Packit Service 672cf4
@cindex UI server
Packit Service 672cf4
@cindex user interface server
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
This section specifies the protocol used between clients and a User
Packit Service 672cf4
Interface Server (UI server).  This protocol helps to build a system
Packit Service 672cf4
where all cryptographic operations are done by a server and the server
Packit Service 672cf4
is responsible for all dialogs.  Although @acronym{GPGME} has no direct
Packit Service 672cf4
support for this protocol it is believed that servers will utilize the
Packit Service 672cf4
@acronym{GPGME} library; thus having the specification included in this
Packit Service 672cf4
manual is an appropriate choice.  This protocol should be referenced as
Packit Service 672cf4
`The GnuPG UI Server Protocol'.
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
A server needs to implement these commands:@footnote{In all examples we
Packit Service 672cf4
assume that the connection has already been established; see the Assuan
Packit Service 672cf4
manual for details.}
Packit Service 672cf4
Packit Service 672cf4
@menu
Packit Service 672cf4
* UI Server Encrypt::                Encrypt a message.
Packit Service 672cf4
* UI Server Sign::                   Sign a message.
Packit Service 672cf4
* UI Server Decrypt::                Decrypt a message.
Packit Service 672cf4
* UI Server Verify::                 Verify a message.
Packit Service 672cf4
* UI Server Set Input Files::        Specifying the input files to operate on.
Packit Service 672cf4
* UI Server Sign/Encrypt Files::     Encrypting and signing files.
Packit Service 672cf4
* UI Server Verify/Decrypt Files::   Decrypting and verifying files.
Packit Service 672cf4
* UI Server Import/Export Keys::     Managing certificates.
Packit Service 672cf4
* UI Server Checksum Files::         Create and verify checksums for files.
Packit Service 672cf4
* Miscellaneous UI Server Commands::   Commands not related to a specific operation.
Packit Service 672cf4
@end menu
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@node UI Server Encrypt
Packit Service 672cf4
@section UI Server: Encrypt a Message
Packit Service 672cf4
Packit Service 672cf4
Before encryption can be done the recipients must be set using the
Packit Service 672cf4
command:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command RECIPIENT @var{string}
Packit Service 672cf4
Packit Service 672cf4
Set the recipient for the encryption.  @var{string} is an RFC-2822
Packit Service 672cf4
recipient name ("mailbox" as per section 3.4).  This command may or may
Packit Service 672cf4
not check the recipient for validity right away; if it does not all
Packit Service 672cf4
recipients are expected to be checked at the time of the @code{ENCRYPT}
Packit Service 672cf4
command.  All @code{RECIPIENT} commands are cumulative until a
Packit Service 672cf4
successful @code{ENCRYPT} command or until a @code{RESET} command.
Packit Service 672cf4
Linefeeds are obviously not allowed in @var{string} and should be folded
Packit Service 672cf4
into spaces (which are equivalent).
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
To tell the server the source and destination of the data, the next two
Packit Service 672cf4
commands are to be used:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command INPUT FD=@var{n}
Packit Service 672cf4
Set the file descriptor for the message to be encrypted to @var{n}.  The
Packit Service 672cf4
message send to the server is binary encoded.
Packit Service 672cf4
Packit Service 672cf4
GpgOL is a Windows only program, thus @var{n} is not a libc file
Packit Service 672cf4
descriptor but a regular system handle.  Given that the Assuan
Packit Service 672cf4
connection works over a socket, it is not possible to use regular
Packit Service 672cf4
inheritance to make the file descriptor available to the server.
Packit Service 672cf4
Thus @code{DuplicateHandle} needs to be used to duplicate a handle
Packit Service 672cf4
to the server process.  This is the reason that the server needs to
Packit Service 672cf4
implement the @code{GETINFO pid} command.  Sending this command a second
Packit Service 672cf4
time replaces the file descriptor set by the last one.
Packit Service 672cf4
@c If @var{n} is not given, this commands uses the
Packit Service 672cf4
@c %last file descriptor passed to the application.
Packit Service 672cf4
@c %@xref{fun-assuan_sendfd, ,the assuan_sendfd function,assuan,the
Packit Service 672cf4
@c %Libassuan manual}, on how to do descriptor passing.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@deffn Command OUTPUT FD=@var{n} [--binary]
Packit Service 672cf4
Set the file descriptor to be used for the output (i.e. the encrypted
Packit Service 672cf4
message) to @var{n}.  If the option @code{--binary} is given the
Packit Service 672cf4
output shall be in binary format; if not given, the output for OpenPGP
Packit Service 672cf4
needs to be ASCII armored and for CMS Base-64 encoded.  For details on
Packit Service 672cf4
the file descriptor, see the @code{INPUT} command.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
The setting of the recipients, the data source and destination may
Packit Service 672cf4
happen in any order, even intermixed.  If this has been done the actual
Packit Service 672cf4
encryption operation is called using:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command ENCRYPT -@w{}-protocol=@var{name}
Packit Service 672cf4
Packit Service 672cf4
This command reads the plaintext from the file descriptor set by the
Packit Service 672cf4
@code{INPUT} command, encrypts it and writes the ciphertext to the file
Packit Service 672cf4
descriptor set by the @code{OUTPUT} command.  The server may (and
Packit Service 672cf4
should) overlap reading and writing.  The recipients used for the
Packit Service 672cf4
encryption are all the recipients set so far.  If any recipient is not
Packit Service 672cf4
usable the server should take appropriate measures to notify the user
Packit Service 672cf4
about the problem and may cancel the operation by returning an error
Packit Service 672cf4
code.  The used file descriptors are void after this command; the
Packit Service 672cf4
recipient list is only cleared if the server returns success.
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
Because GpgOL uses a streaming mode of operation the server is not
Packit Service 672cf4
allowed to auto select the protocol and must obey to the mandatory
Packit Service 672cf4
@var{protocol} parameter:
Packit Service 672cf4
Packit Service 672cf4
@table @code
Packit Service 672cf4
@item OpenPGP
Packit Service 672cf4
Use the OpenPGP protocol (RFC-2440).
Packit Service 672cf4
@item CMS
Packit Service 672cf4
Use the CMS (PKCS#7) protocol (RFC-3852).
Packit Service 672cf4
@end table
Packit Service 672cf4
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
To support automagically selection of the protocol depending on the
Packit Service 672cf4
selected keys, the server MAY implement the command:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command PREP_ENCRYPT [-@w{}-protocol=@var{name}] [-@w{}-expect-sign]
Packit Service 672cf4
Packit Service 672cf4
This commands considers all recipients set so far and decides whether it
Packit Service 672cf4
is able to take input and start the actual encryption.  This is kind of
Packit Service 672cf4
a dry-run @command{ENCRYPT} without requiring or using the input and
Packit Service 672cf4
output file descriptors.  The server shall cache the result of any user
Packit Service 672cf4
selection to avoid asking this again when the actual @command{ENCRYPT}
Packit Service 672cf4
command is send.  The @option{--protocol} option is optional; if it is
Packit Service 672cf4
not given, the server should allow the user to select the protocol to be
Packit Service 672cf4
used based on the recipients given or by any other means.
Packit Service 672cf4
Packit Service 672cf4
If @option{--expect-sign} is given the server should expect that the
Packit Service 672cf4
message will also be signed and use this hint to present a unified
Packit Service 672cf4
recipient and signer selection dialog if possible and desired.  A
Packit Service 672cf4
selected signer should then be cached for the expected SIGN command
Packit Service 672cf4
(which is expected in the same session but possible on another
Packit Service 672cf4
connection).
Packit Service 672cf4
Packit Service 672cf4
If this command is given again before a successful @command{ENCRYPT}
Packit Service 672cf4
command, the second one takes effect.
Packit Service 672cf4
Packit Service 672cf4
Before sending the OK response the server shall tell the client the
Packit Service 672cf4
protocol to be used (either the one given by the argument or the one
Packit Service 672cf4
selected by the user) by means of a status line:
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@deffn {Status line} PROTOCOL @var{name}
Packit Service 672cf4
Advise the client to use the protocol @var{name} for the
Packit Service 672cf4
@command{ENCRYPT} command.  The valid protocol names are listed under
Packit Service 672cf4
the description of the @command{ENCRYPT} command.  The server shall emit
Packit Service 672cf4
exactly one PROTOCOL status line.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
Here is an example of a complete encryption sequence; client lines are
Packit Service 672cf4
indicated by a @sc{c:}, server responses by @sc{c:}:
Packit Service 672cf4
Packit Service 672cf4
@smallexample
Packit Service 672cf4
@group
Packit Service 672cf4
  @clnt{RESET}
Packit Service 672cf4
  @srvr{OK}
Packit Service 672cf4
  @clnt{RECIPIENT foo@@example.net}
Packit Service 672cf4
  @srvr{OK}
Packit Service 672cf4
  @clnt{RECIPIENT bar@@example.com}
Packit Service 672cf4
  @srvr{OK}
Packit Service 672cf4
  @clnt{PREP_ENCRYPT}
Packit Service 672cf4
  @srvr{S PROTOCOL OpenPGP}
Packit Service 672cf4
  @srvr{OK}
Packit Service 672cf4
  @clnt{INPUT FD=17}
Packit Service 672cf4
  @srvr{OK}
Packit Service 672cf4
  @clnt{OUTPUT FD=18}
Packit Service 672cf4
  @srvr{OK}
Packit Service 672cf4
  @clnt{ENCRYPT}
Packit Service 672cf4
  @srvr{OK}
Packit Service 672cf4
@end group
Packit Service 672cf4
@end smallexample
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@node UI Server Sign
Packit Service 672cf4
@section UI Server: Sign a Message
Packit Service 672cf4
Packit Service 672cf4
The server needs to implement opaque signing as well as detached
Packit Service 672cf4
signing.  Due to the nature of OpenPGP messages it is always required to
Packit Service 672cf4
send the entire message to the server; sending just the hash is not
Packit Service 672cf4
possible.  The following two commands are required to set the input and
Packit Service 672cf4
output file descriptors:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command INPUT FD=@var{n}
Packit Service 672cf4
Set the file descriptor for the message to be signed to @var{n}.  The
Packit Service 672cf4
message send to the server is binary encoded.  For details on the file
Packit Service 672cf4
descriptor, see the description of @code{INPUT} in the @code{ENCRYPT}
Packit Service 672cf4
section.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@deffn Command OUTPUT FD=@var{n} [--binary]
Packit Service 672cf4
Set the file descriptor to be used for the output.  The output is
Packit Service 672cf4
either the complete signed message or in case of a detached signature
Packit Service 672cf4
just that detached signature.  If the option @code{--binary} is given
Packit Service 672cf4
the output shall be in binary format; if not given, the output for
Packit Service 672cf4
OpenPGP needs to be ASCII armored and for CMS Base-64 encoded.  For
Packit Service 672cf4
details on the file descriptor, see the @code{INPUT} command.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
To allow the server the selection of a non-default signing key the
Packit Service 672cf4
client may optionally use the @code{SENDER} command, see @ref{command
Packit Service 672cf4
SENDER}.
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
The signing operation is then initiated by:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command SIGN -@w{}-protocol=@var{name} [-@w{}-detached]
Packit Service 672cf4
Sign the data set with the @code{INPUT} command and write it to the sink
Packit Service 672cf4
set by OUTPUT.  @var{name} is the signing protocol used for the
Packit Service 672cf4
message. For a description of the allowed protocols see the
Packit Service 672cf4
@code{ENCRYPT} command.  With option @code{--detached} given, a detached
Packit Service 672cf4
signature is created; this is actually the usual way the command is
Packit Service 672cf4
used.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
The client expects the server to send at least this status information
Packit Service 672cf4
before the final OK response:
Packit Service 672cf4
Packit Service 672cf4
@deffn {Status line} MICALG @var{string}
Packit Service 672cf4
The @var{string} represents the hash algorithm used to create the
Packit Service 672cf4
signature. It is used with RFC-1847 style signature messages and defined by
Packit Service 672cf4
PGP/MIME (RFC-3156) and S/MIME (RFC-3851).  The GPGME library has a
Packit Service 672cf4
supporting function @code{gpgme_hash_algo_name} to return the algorithm
Packit Service 672cf4
name as a string.  This string needs to be lowercased and for OpenPGP
Packit Service 672cf4
prefixed with "@code{pgp-}".
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@node UI Server Decrypt
Packit Service 672cf4
@section UI Server: Decrypt a Message
Packit Service 672cf4
Packit Service 672cf4
Decryption may include the verification of OpenPGP messages.  This is
Packit Service 672cf4
due to the often used combined signing/encryption modus of OpenPGP.  The
Packit Service 672cf4
client may pass an option to the server to inhibit the signature
Packit Service 672cf4
verification.  The following two commands are required to set the input
Packit Service 672cf4
and output file descriptors:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command INPUT FD=@var{n}
Packit Service 672cf4
Set the file descriptor for the message to be decrypted to @var{n}.  The
Packit Service 672cf4
message send to the server is either binary encoded or --- in the case
Packit Service 672cf4
of OpenPGP --- ASCII armored.  For details on the file descriptor, see
Packit Service 672cf4
the description of @code{INPUT} in the @code{ENCRYPT} section.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@deffn Command OUTPUT FD=@var{n}
Packit Service 672cf4
Set the file descriptor to be used for the output. The output is binary
Packit Service 672cf4
encoded. For details on the file descriptor, see the description of
Packit Service 672cf4
@code{INPUT} in the @code{ENCRYPT} section.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
The decryption is started with the command:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command DECRYPT -@w{}-protocol=@var{name} [-@w{}-no-verify] [-@w{}-export-session-key]
Packit Service 672cf4
@var{name} is the encryption protocol used for the message. For a
Packit Service 672cf4
description of the allowed protocols see the @code{ENCRYPT} command.
Packit Service 672cf4
This argument is mandatory.  If the option @option{--no-verify} is
Packit Service 672cf4
given, the server should not try to verify a signature, in case the
Packit Service 672cf4
input data is an OpenPGP combined message. If the option
Packit Service 672cf4
@option{--export-session-key} is given and the underlying engine knows
Packit Service 672cf4
how to export the session key, it will appear on a status line
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@node UI Server Verify
Packit Service 672cf4
@section UI Server: Verify a Message
Packit Service 672cf4
Packit Service 672cf4
The server needs to support the verification of opaque signatures as
Packit Service 672cf4
well as detached signatures.  The kind of input sources controls what
Packit Service 672cf4
kind message is to be verified.
Packit Service 672cf4
Packit Service 672cf4
@deffn Command MESSAGE FD=@var{n}
Packit Service 672cf4
This command is used with detached signatures to set the file descriptor
Packit Service 672cf4
for the signed data to @var{n}. The data is binary encoded (used
Packit Service 672cf4
verbatim).  For details on the file descriptor, see the description of
Packit Service 672cf4
@code{INPUT} in the @code{ENCRYPT} section.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@deffn Command INPUT FD=@var{n}
Packit Service 672cf4
Set the file descriptor for the opaque message or the signature part of
Packit Service 672cf4
a detached signature to @var{n}.  The message send to the server is
Packit Service 672cf4
either binary encoded or -- in the case of OpenPGP -- ASCII armored.
Packit Service 672cf4
For details on the file descriptor, see the description of @code{INPUT}
Packit Service 672cf4
in the @code{ENCRYPT} section.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@deffn Command OUTPUT FD=@var{n}
Packit Service 672cf4
Set the file descriptor to be used for the output. The output is binary
Packit Service 672cf4
encoded and only used for opaque signatures.  For details on the file
Packit Service 672cf4
descriptor, see the description of @code{INPUT} in the @code{ENCRYPT}
Packit Service 672cf4
section.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
The verification is then started using:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command VERIFY -@w{}-protocol=@var{name} [-@w{}-silent]
Packit Service 672cf4
@var{name} is the signing protocol used for the message. For a
Packit Service 672cf4
description of the allowed protocols see the @code{ENCRYPT} command.
Packit Service 672cf4
This argument is mandatory.  Depending on the combination of
Packit Service 672cf4
@code{MESSAGE} @code{INPUT} and @code{OUTPUT} commands, the server needs
Packit Service 672cf4
to select the appropriate verification mode:
Packit Service 672cf4
Packit Service 672cf4
@table @asis
Packit Service 672cf4
@item MESSAGE and INPUT
Packit Service 672cf4
This indicates a detached signature.  Output data is not applicable.
Packit Service 672cf4
@item INPUT
Packit Service 672cf4
This indicates an opaque signature.  As no output command has been given,
Packit Service 672cf4
the server is only required to check the signature.
Packit Service 672cf4
@item INPUT and OUTPUT
Packit Service 672cf4
This indicates an opaque signature.  The server shall write the signed
Packit Service 672cf4
data to the file descriptor set by the output command.  This data shall
Packit Service 672cf4
even be written if the signatures can't be verified.
Packit Service 672cf4
@end table
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
With @option{--silent} the server shall not display any dialog; this is
Packit Service 672cf4
for example used by the client to get the content of opaque signed
Packit Service 672cf4
messages. The client expects the server to send at least this status
Packit Service 672cf4
information before the final OK response:
Packit Service 672cf4
Packit Service 672cf4
@deffn {Status line} SIGSTATUS @var{flag} @var{displaystring}
Packit Service 672cf4
Returns the status for the signature and a short string explaining the
Packit Service 672cf4
status.  Valid values for @var{flag} are:
Packit Service 672cf4
Packit Service 672cf4
@table @code
Packit Service 672cf4
@item none
Packit Service 672cf4
The message has a signature but it could not not be verified due to a
Packit Service 672cf4
missing key.
Packit Service 672cf4
@item green
Packit Service 672cf4
The signature is fully valid.
Packit Service 672cf4
@item yellow
Packit Service 672cf4
The signature is valid but additional information was shown regarding the
Packit Service 672cf4
validity of the key.
Packit Service 672cf4
@item red
Packit Service 672cf4
The signature is not valid.
Packit Service 672cf4
@end table
Packit Service 672cf4
Packit Service 672cf4
@var{displaystring} is a percent-and-plus-encoded string with a short
Packit Service 672cf4
human readable description of the status.  For example
Packit Service 672cf4
Packit Service 672cf4
@smallexample
Packit Service 672cf4
S SIGSTATUS green Good+signature+from+Keith+Moon+<keith@@example.net>
Packit Service 672cf4
@end smallexample
Packit Service 672cf4
Packit Service 672cf4
Note that this string needs to fit into an Assuan line and should be
Packit Service 672cf4
short enough to be displayed as short one-liner on the clients window.
Packit Service 672cf4
As usual the encoding of this string is UTF-8 and it should be send in
Packit Service 672cf4
its translated form.
Packit Service 672cf4
Packit Service 672cf4
The server shall send one status line for every signature found on the
Packit Service 672cf4
message.
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@node UI Server Set Input Files
Packit Service 672cf4
@section UI Server: Specifying the input files to operate on.
Packit Service 672cf4
Packit Service 672cf4
All file related UI server commands operate on a number of input files
Packit Service 672cf4
or directories, specified by one or more @code{FILE} commands:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command FILE [--clear] @var{name}
Packit Service 672cf4
Add the file or directory @var{name} to the list of pathnames to be
Packit Service 672cf4
processed by the server.  The parameter @var{name} must be an absolute
Packit Service 672cf4
path name (including the drive letter) and is percent espaced (in
Packit Service 672cf4
particular, the characters %, = and white space characters are always
Packit Service 672cf4
escaped).  If the option @code{--clear} is given, the list of files is
Packit Service 672cf4
cleared before adding @var{name}.
Packit Service 672cf4
Packit Service 672cf4
Historical note: The original spec did not define @code{--clear} but
Packit Service 672cf4
the keyword @code{--continued} after the file name to indicate that
Packit Service 672cf4
more files are to be expected.  However, this has never been used and
Packit Service 672cf4
thus removed from the specs.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@node UI Server Sign/Encrypt Files
Packit Service 672cf4
@section UI Server: Encrypting and signing files.
Packit Service 672cf4
Packit Service 672cf4
First, the input files need to be specified by one or more
Packit Service 672cf4
@code{FILE} commands.  Afterwards, the actual operation is requested:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command ENCRYPT_FILES --nohup
Packit Service 672cf4
@deffnx Command SIGN_FILES --nohup
Packit Service 672cf4
@deffnx Command ENCRYPT_SIGN_FILES --nohup
Packit Service 672cf4
Request that the files specified by @code{FILE} are encrypted and/or
Packit Service 672cf4
signed.  The command selects the default action.  The UI server may
Packit Service 672cf4
allow the user to change this default afterwards interactively, and
Packit Service 672cf4
even abort the operation or complete it only on some of the selected
Packit Service 672cf4
files and directories.
Packit Service 672cf4
Packit Service 672cf4
What it means to encrypt or sign a file or directory is specific to
Packit Service 672cf4
the preferences of the user, the functionality the UI server provides,
Packit Service 672cf4
and the selected protocol.  Typically, for each input file a new file
Packit Service 672cf4
is created under the original filename plus a protocol specific
Packit Service 672cf4
extension (like @code{.gpg} or @code{.sig}), which contain the
Packit Service 672cf4
encrypted/signed file or a detached signature.  For directories, the
Packit Service 672cf4
server may offer multiple options to the user (for example ignore or
Packit Service 672cf4
process recursively).
Packit Service 672cf4
Packit Service 672cf4
The @code{ENCRYPT_SIGN_FILES} command requests a combined sign and
Packit Service 672cf4
encrypt operation.  It may not be available for all protocols (for
Packit Service 672cf4
example, it is available for OpenPGP but not for CMS).
Packit Service 672cf4
Packit Service 672cf4
The option @code{--nohup} is mandatory.  It is currently unspecified
Packit Service 672cf4
what should happen if @code{--nohup} is not present.  Because
Packit Service 672cf4
@code{--nohup} is present, the server always returns @code{OK}
Packit Service 672cf4
promptly, and completes the operation asynchronously.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@node UI Server Verify/Decrypt Files
Packit Service 672cf4
@section UI Server: Decrypting and verifying files.
Packit Service 672cf4
Packit Service 672cf4
First, the input files need to be specified by one or more
Packit Service 672cf4
@code{FILE} commands.  Afterwards, the actual operation is requested:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command DECRYPT_FILES --nohup
Packit Service 672cf4
@deffnx Command VERIFY_FILES --nohup
Packit Service 672cf4
@deffnx Command DECRYPT_VERIFY_FILES --nohup
Packit Service 672cf4
Request that the files specified by @code{FILE} are decrypted and/or
Packit Service 672cf4
verified.  The command selects the default action.  The UI server may
Packit Service 672cf4
allow the user to change this default afterwards interactively, and
Packit Service 672cf4
even abort the operation or complete it only on some of the selected
Packit Service 672cf4
files and directories.
Packit Service 672cf4
Packit Service 672cf4
What it means to decrypt or verify a file or directory is specific to
Packit Service 672cf4
the preferences of the user, the functionality the UI server provides,
Packit Service 672cf4
and the selected protocol.  Typically, for decryption, a new file is
Packit Service 672cf4
created for each input file under the original filename minus a
Packit Service 672cf4
protocol specific extension (like @code{.gpg}) which contains the
Packit Service 672cf4
original plaintext.  For verification a status is displayed for each
Packit Service 672cf4
signed input file, indicating if it is signed, and if yes, if the
Packit Service 672cf4
signature is valid.  For files that are signed and encrypted, the
Packit Service 672cf4
@code{VERIFY} command transiently decrypts the file to verify the
Packit Service 672cf4
enclosed signature.  For directories, the server may offer multiple
Packit Service 672cf4
options to the user (for example ignore or process recursively).
Packit Service 672cf4
Packit Service 672cf4
The option @code{--nohup} is mandatory.  It is currently unspecified
Packit Service 672cf4
what should happen if @code{--nohup} is not present.  Because
Packit Service 672cf4
@code{--nohup} is present, the server always returns @code{OK}
Packit Service 672cf4
promptly, and completes the operation asynchronously.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@node UI Server Import/Export Keys
Packit Service 672cf4
@section UI Server: Managing certificates.
Packit Service 672cf4
Packit Service 672cf4
First, the input files need to be specified by one or more
Packit Service 672cf4
@code{FILE} commands.  Afterwards, the actual operation is requested:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command IMPORT_FILES --nohup
Packit Service 672cf4
Request that the certificates contained in the files specified by
Packit Service 672cf4
@code{FILE} are imported into the local certificate databases.
Packit Service 672cf4
Packit Service 672cf4
For directories, the server may offer multiple options to the user
Packit Service 672cf4
(for example ignore or process recursively).
Packit Service 672cf4
Packit Service 672cf4
The option @code{--nohup} is mandatory.  It is currently unspecified
Packit Service 672cf4
what should happen if @code{--nohup} is not present.  Because
Packit Service 672cf4
@code{--nohup} is present, the server always returns @code{OK}
Packit Service 672cf4
promptly, and completes the operation asynchronously.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
FIXME: It may be nice to support an @code{EXPORT} command as well,
Packit Service 672cf4
which is enabled by the context menu of the background of a directory.
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@node UI Server Checksum Files
Packit Service 672cf4
@section UI Server: Create and verify checksums for files.
Packit Service 672cf4
Packit Service 672cf4
First, the input files need to be specified by one or more
Packit Service 672cf4
@code{FILE} commands.  Afterwards, the actual operation is requested:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command CHECKSUM_CREATE_FILES --nohup
Packit Service 672cf4
Request that checksums are created for the files specified by
Packit Service 672cf4
@code{FILE}.  The choice of checksum algorithm and the destination
Packit Service 672cf4
storage and format for the created checksums depend on the preferences
Packit Service 672cf4
of the user and the functionality provided by the UI server.  For
Packit Service 672cf4
directories, the server may offer multiple options to the user (for
Packit Service 672cf4
example ignore or process recursively).
Packit Service 672cf4
Packit Service 672cf4
The option @code{--nohup} is mandatory.  It is currently unspecified
Packit Service 672cf4
what should happen if @code{--nohup} is not present.  Because
Packit Service 672cf4
@code{--nohup} is present, the server always returns @code{OK}
Packit Service 672cf4
promptly, and completes the operation asynchronously.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@deffn Command CHECKSUM_VERIFY_FILES --nohup
Packit Service 672cf4
Request that checksums are created for the files specified by
Packit Service 672cf4
@code{FILE} and verified against previously created and stored
Packit Service 672cf4
checksums.  The choice of checksum algorithm and the source storage
Packit Service 672cf4
and format for previously created checksums depend on the preferences
Packit Service 672cf4
of the user and the functionality provided by the UI server.  For
Packit Service 672cf4
directories, the server may offer multiple options to the user (for
Packit Service 672cf4
example ignore or process recursively).
Packit Service 672cf4
Packit Service 672cf4
If the source storage of previously created checksums is available to
Packit Service 672cf4
the user through the Windows shell, this command may also accept such
Packit Service 672cf4
checksum files as @code{FILE} arguments.  In this case, the UI server
Packit Service 672cf4
should instead verify the checksum of the referenced files as if they
Packit Service 672cf4
were given as INPUT files.
Packit Service 672cf4
Packit Service 672cf4
The option @code{--nohup} is mandatory.  It is currently unspecified
Packit Service 672cf4
what should happen if @code{--nohup} is not present.  Because
Packit Service 672cf4
@code{--nohup} is present, the server always returns @code{OK}
Packit Service 672cf4
promptly, and completes the operation asynchronously.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@c
Packit Service 672cf4
@c M I S C E L L A N E O U S  C O M M A N D S
Packit Service 672cf4
@c
Packit Service 672cf4
@node Miscellaneous UI Server Commands
Packit Service 672cf4
@section Miscellaneous UI Server Commands
Packit Service 672cf4
Packit Service 672cf4
The server needs to implement the following commands which are not
Packit Service 672cf4
related to a specific command:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command GETINFO @var{what}
Packit Service 672cf4
This is a multi purpose command, commonly used to return a variety of
Packit Service 672cf4
information.  The required subcommands as described by the @var{what}
Packit Service 672cf4
parameter are:
Packit Service 672cf4
Packit Service 672cf4
@table @code
Packit Service 672cf4
@item pid
Packit Service 672cf4
Return the process id of the server in decimal notation using an Assuan
Packit Service 672cf4
data line.
Packit Service 672cf4
@end table
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
To allow the server to pop up the windows in the correct relation to the
Packit Service 672cf4
client, the client is advised to tell the server by sending the option:
Packit Service 672cf4
Packit Service 672cf4
@deffn {Command option} window-id @var{number}
Packit Service 672cf4
The @var{number} represents the native window ID of the clients current
Packit Service 672cf4
window.  On Windows systems this is a windows handle (@code{HWND}) and
Packit Service 672cf4
on X11 systems it is the @code{X Window ID}.  The number needs to be
Packit Service 672cf4
given as a hexadecimal value so that it is easier to convey pointer
Packit Service 672cf4
values (e.g. @code{HWND}).
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
A client may want to fire up the certificate manager of the server.  To
Packit Service 672cf4
do this it uses the Assuan command:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command START_KEYMANAGER
Packit Service 672cf4
The server shall pop up the main window of the key manager (aka
Packit Service 672cf4
certificate manager).  The client expects that the key manager is brought
Packit Service 6c01f9
into the foregound and that this command immediatley returns (does not
Packit Service 672cf4
wait until the key manager has been fully brought up).
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
A client may want to fire up the configuration dialog of the server.  To
Packit Service 672cf4
do this it uses the Assuan command:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command START_CONFDIALOG
Packit Service 672cf4
The server shall pop up its configuration dialog.  The client expects
Packit Service 672cf4
that this dialog is brought into the foregound and that this command
Packit Service 6c01f9
immediatley returns (i.e. it does not wait until the dialog has been
Packit Service 672cf4
fully brought up).
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@anchor{command SENDER}
Packit Service 672cf4
@noindent
Packit Service 672cf4
When doing an operation on a mail, it is useful to let the server know
Packit Service 672cf4
the address of the sender:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command SENDER [-@w{}-info] [-@w{}-protocol=@var{name}] @var{email}
Packit Service 672cf4
@var{email} is the plain ASCII encoded address ("addr-spec" as per
Packit Service 672cf4
RFC-2822) enclosed in angle brackets.  The address set with this command
Packit Service 672cf4
is valid until a successful completion of the operation or until a
Packit Service 672cf4
@code{RESET} command.  A second command overrides the effect of the
Packit Service 672cf4
first one; if @var{email} is not given and @option{--info} is not used,
Packit Service 672cf4
the server shall use the default signing key.
Packit Service 672cf4
Packit Service 672cf4
If option @option{--info} is not given, the server shall also suggest a
Packit Service 672cf4
protocol to use for signing.  The client may use this suggested protocol
Packit Service 672cf4
on its own discretion.  The same status line as with PREP_ENCRYPT is
Packit Service 672cf4
used for this.
Packit Service 672cf4
Packit Service 672cf4
The option @option{--protocol} may be used to give the server a hint on
Packit Service 672cf4
which signing protocol should be preferred.
Packit Service 672cf4
@end deffn
Packit Service 672cf4
Packit Service 672cf4
@noindent
Packit Service 672cf4
To allow the UI-server to visually identify a running operation or to
Packit Service 672cf4
associate operations the server MAY support the command:
Packit Service 672cf4
Packit Service 672cf4
@deffn Command SESSION @var{number} [@var{string}]
Packit Service 672cf4
The @var{number} is an arbitrary value, a server may use to associate
Packit Service 672cf4
simultaneous running sessions.  It is a 32 bit unsigned integer with
Packit Service 672cf4
@code{0} as a special value indicating that no session association shall
Packit Service 672cf4
be done.
Packit Service 672cf4
Packit Service 672cf4
If @var{string} is given, the server may use this as the title of a
Packit Service 672cf4
window or, in the case of an email operation, to extract the sender's
Packit Service 672cf4
address. The string may contain spaces; thus no plus-escaping is used.
Packit Service 672cf4
Packit Service 672cf4
This command may be used at any time and overrides the effect of the
Packit Service 672cf4
last command.  A @code{RESET} undoes the effect of this command.
Packit Service 672cf4
Packit Service 672cf4
@end deffn