Current File : //usr/man/man1/gpg-connect-agent.1
'\" te
.\" Created from Texinfo source by yat2m 1.0
.TH GPG-CONNECT-AGENT 1 2015-08-20 "GnuPG 2.0.27" "GNU Privacy Guard"
.SH NAME
.B gpg-connect-agent
\- Communicate with a running agent
.SH SYNOPSIS
.B  gpg-connect-agent
.RI [ options ] [commands]

.SH DESCRIPTION
The \fBgpg-connect-agent\fR is a utility to communicate with a
running \fBgpg-agent\fR.  It is useful to check out the commands
gpg-agent provides using the Assuan interface.  It might also be useful
for scripting simple applications.  Input is expected at stdin and out
put gets printed to stdout.

It is very similar to running \fBgpg-agent\fR in server mode; but
here we connect to a running instance.




The following options may be used:

.TP
.B  -v
.TP
.B  --verbose
Output additional information while running.

.TP
.B  -q
.TP
.B  --quiet
Try to be as quiet as possible.

.TP
.B  --homedir \fIdir\fR
Set the name of the home directory to \fIdir\fR. If this option is not
used, the home directory defaults to \(oq\fI~/.gnupg\fR\(cq.  It is only
recognized when given on the command line.  It also overrides any home
directory stated through the environment variable \(oq\fIGNUPGHOME\fR\(cq or
(on W32 systems) by means of the Registry entry
\fIHKCU\\Software\\GNU\\GnuPG:HomeDir\fR.


.TP
.B  --agent-program \fIfile\fR
Specify the agent program to be started if none is running.


.TP
.B  -S
.TP
.B  --raw-socket \fIname\fR
Connect to socket \fIname\fR assuming this is an Assuan style server.
Do not run any special initializations or environment checks.  This may
be used to directly connect to any Assuan style socket server.

.TP
.B  -E
.TP
.B  --exec
Take the rest of the command line as a program and it's arguments and
execute it as an assuan server. Here is how you would run \fBgpgsm\fR:
.RS 2
.nf
 gpg-connect-agent --exec gpgsm --server
.fi
.RE
Note that you may not use options on the command line in this case.

.TP
.B  --no-ext-connect
When using \fB-S\fR or \fB--exec\fR, \fBgpg-connect-agent\fR
connects to the assuan server in extended mode to allow descriptor
passing.  This option makes it use the old mode.

.TP
.B  --run \fIfile\fR
Run the commands from \fIfile\fR at startup and then continue with the
regular input method.  Note, that commands given on the command line are
executed after this file.

.TP
.B  -s
.TP
.B  --subst
Run the command \fB/subst\fR at startup.

.TP
.B  --hex
Print data lines in a hex format and the ASCII representation of
non-control characters.

.TP
.B  --decode
Decode data lines.  That is to remove percent escapes but make sure that
a new line always starts with a D and a space.


.SH CONTROL COMMANDS

While reading Assuan commands, gpg-agent also allows a few special
commands to control its operation.  These control commands all start
with a slash (\fB/\fR).


.TP
.B  /echo \fIargs\fR
Just print \fIargs\fR.

.TP
.B  /let \fIname\fR \fIvalue\fR
Set the variable \fIname\fR to \fIvalue\fR.  Variables are only
substituted on the input if the \fB/subst\fR has been used.
Variables are referenced by prefixing the name with a dollar sign and
optionally include the name in curly braces.  The rules for a valid name
are identically to those of the standard bourne shell.  This is not yet
enforced but may be in the future.  When used with curly braces no
leading or trailing white space is allowed.

If a variable is not found, it is searched in the environment and if
found copied to the table of variables.

Variable functions are available: The name of the function must be
followed by at least one space and the at least one argument.  The
following functions are available:

.RS
.TP
.B  get
Return a value described by the argument.  Available arguments are:

.RS
.TP
.B  cwd
The current working directory.
.TP
.B  homedir
The gnupg homedir.
.TP
.B  sysconfdir
GnuPG's system configuration directory.
.TP
.B  bindir
GnuPG's binary directory.
.TP
.B  libdir
GnuPG's library directory.
.TP
.B  libexecdir
GnuPG's library directory for executable files.
.TP
.B  datadir
GnuPG's data directory.
.TP
.B  serverpid
The PID of the current server. Command \fB/serverpid\fR must
have been given to return a useful value.
.RE

.TP
.B  unescape \fIargs\fR
Remove C-style escapes from \fIargs\fR.  Note that \fB\\0\fR and
\fB\\x00\fR terminate the returned string implicitly.  The string to be
converted are the entire arguments right behind the delimiting space of
the function name.

.TP
.B  unpercent \fIargs\fR
.TP
.B  unpercent+ \fIargs\fR
Remove percent style escaping from \fIargs\fR.  Note that \fB%00\fR
terminates the string implicitly.  The string to be converted are the
entire arguments right behind the delimiting space of the function
name. \fBunpercent+\fR also maps plus signs to a spaces.

.TP
.B  percent \fIargs\fR
.TP
.B  percent+ \fIargs\fR
Escape the \fIargs\fR using percent style escaping.  Tabs, formfeeds,
linefeeds, carriage returns and colons are escaped. \fBpercent+\fR also
maps spaces to plus signs.

.TP
.B  errcode \fIarg\fR
.TP
.B  errsource \fIarg\fR
.TP
.B  errstring \fIarg\fR
Assume \fIarg\fR is an integer and evaluate it using \fBstrtol\fR.  Return
the gpg-error error code, error source or a formatted string with the
error code and error source.


.TP
.B  +
.TP
.B  -
.TP
.B  *
.TP
.B  /
.TP
.B  %
Evaluate all arguments as long integers using \fBstrtol\fR and apply
this operator.  A division by zero yields an empty string.

.TP
.B  !
.TP
.B  |
.TP
.B  &
Evaluate all arguments as long integers using \fBstrtol\fR and apply
the logical oeprators NOT, OR or AND.  The NOT operator works on the
last argument only.


.RE


.TP
.B  /definq \fIname\fR \fIvar\fR
Use content of the variable \fIvar\fR for inquiries with \fIname\fR.
\fIname\fR may be an asterisk (\fB*\fR) to match any inquiry.


.TP
.B  /definqfile \fIname\fR \fIfile\fR
Use content of \fIfile\fR for inquiries with \fIname\fR.
\fIname\fR may be an asterisk (\fB*\fR) to match any inquiry.

.TP
.B  /definqprog \fIname\fR \fIprog\fR
Run \fIprog\fR for inquiries matching \fIname\fR and pass the
entire line to it as command line arguments.

.TP
.B  /datafile \fIname\fR
Write all data lines from the server to the file \fIname\fR.  The file
is opened for writing and created if it does not exists.  An existing
file is first truncated to 0.  The data written to the file fully
decoded.  Using a single dash for \fIname\fR writes to stdout.  The
file is kept open until a new file is set using this command or this
command is used without an argument.

.TP
.B  /showdef
Print all definitions

.TP
.B  /cleardef
Delete all definitions

.TP
.B  /sendfd \fIfile\fR \fImode\fR
Open \fIfile\fR in \fImode\fR (which needs to be a valid \fBfopen\fR
mode string) and send the file descriptor to the server.  This is
usually followed by a command like \fBINPUT FD\fR to set the
input source for other commands.

.TP
.B  /recvfd
Not yet implemented.

.TP
.B  /open \fIvar\fR \fIfile\fR [\fImode\fR]
Open \fIfile\fR and assign the file descriptor to \fIvar\fR.  Warning:
This command is experimental and might change in future versions.

.TP
.B  /close \fIfd\fR
Close the file descriptor \fIfd\fR.  Warning: This command is
experimental and might change in future versions.

.TP
.B  /showopen
Show a list of open files.

.TP
.B  /serverpid
Send the Assuan command \fBGETINFO pid\fR to the server and store
the returned PID for internal purposes.

.TP
.B  /sleep
Sleep for a second.

.TP
.B  /hex
.TP
.B  /nohex
Same as the command line option \fB--hex\fR.

.TP
.B  /decode
.TP
.B  /nodecode
Same as the command line option \fB--decode\fR.

.TP
.B  /subst
.TP
.B  /nosubst
Enable and disable variable substitution.  It defaults to disabled
unless the command line option \fB--subst\fR has been used.
If /subst as been enabled once, leading whitespace is removed from
input lines which makes scripts easier to read.

.TP
.B  /while \fIcondition\fR
.TP
.B  /end
These commands provide a way for executing loops.  All lines between
the \fBwhile\fR and the corresponding \fBend\fR are executed as long
as the evaluation of \fIcondition\fR yields a non-zero value or is the
string \fBtrue\fR or \fByes\fR.  The evaluation is done by passing
\fIcondition\fR to the \fBstrtol\fR function.  Example:

.RS 2
.nf
  /subst
  /let i 3
  /while $i
    /echo loop couter is $i
    /let i ${- $i 1}
  /end
.fi
.RE

.TP
.B  /if \fIcondition\fR
.TP
.B  /end
These commands provide a way for conditional execution.  All lines between
the \fBif\fR and the corresponding \fBend\fR are executed only if
the evaluation of \fIcondition\fR yields a non-zero value or is the
string \fBtrue\fR or \fByes\fR.  The evaluation is done by passing
\fIcondition\fR to the \fBstrtol\fR function.

.TP
.B  /run \fIfile\fR
Run commands from \fIfile\fR.

.TP
.B  /bye
Terminate the connection and the program

.TP
.B  /help
Print a list of available control commands.




.\" Oracle has added the ARC stability level to this manual page
.SH ATTRIBUTES
See
.BR attributes (5)
for descriptions of the following attributes:
.sp
.TS
box;
cbp-1 | cbp-1
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE 
=
Availability	crypto/gnupg
=
Stability	Uncommitted
.TE 
.PP
.SH SEE ALSO
\fBgpg-agent\fR(1),
\fBscdaemon\fR(1)

The full documentation for this tool is maintained as a Texinfo manual.
If GnuPG and the info program are properly installed at your site, the
command

.RS 2
.nf
info gnupg
.fi
.RE

should give you access to the complete manual including a menu structure
and an index.





.SH NOTES

.\" Oracle has added source availability information to this manual page
This software was built from source available at https://java.net/projects/solaris-userland.  The original community source was downloaded from  ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-2.0.27.tar.bz2

Further information about this software can be found on the open source community website at http://www.gnupg.org/.