@node psktool Invocation
@subsubsection Invoking psktool
@pindex psktool

Program  that generates random keys for use with TLS-PSK. The
keys are stored in hexadecimal format in a key file.

@anchor{psktool usage}
@subsubheading psktool help/usage (@option{-?})
@cindex psktool help

The text printed is the same whether selected with the @code{help} option
(@option{--help}) or the @code{more-help} option (@option{--more-help}).  @code{more-help} will print
the usage text by passing it through a pager program.
@code{more-help} is disabled on platforms without a working
@code{fork(2)} function.  The @code{PAGER} environment variable is
used to select the program, defaulting to @file{more}.  Both will exit
with a status code of 0.

@exampleindent 0
@example
psktool - GnuTLS PSK tool
Usage:  psktool [ -<flag> [<val>] | --<name>[@{=| @}<val>] ]... 

None:

   -d, --debug=num            Enable debugging
				- it must be in the range:
				  0 to 9999
   -s, --keysize=num          Specify the key size in bytes (default is 32-bytes or 256-bits)
				- it must be in the range:
				  0 to 512
   -u, --username=str         Specify the username to use
   -p, --pskfile=str          Specify a pre-shared key file

Version, usage and configuration options:

   -v, --version[=arg]        output version information and exit
   -h, --help                 display extended usage information and exit
   -!, --more-help            extended usage information passed thru pager

Options are specified by doubled hyphens and their name or by a single
hyphen and the flag character.

Program  that generates random keys for use with TLS-PSK. The
keys are stored in hexadecimal format in a key file.

Please send bug reports to:  <bugs@@gnutls.org>

@end example
@exampleindent 4

@subsubheading debug option (-d).
@anchor{psktool debug}

This is the ``enable debugging'' option.
This option takes a ArgumentType.NUMBER argument.
Specifies the debug level.
@subsubheading pskfile option (-p).
@anchor{psktool pskfile}

This is the ``specify a pre-shared key file'' option.
This option takes a ArgumentType.STRING argument.
This option will specify the pre-shared key file to store the generated keys.
@subsubheading passwd option.
@anchor{psktool passwd}

This is an alias for the @code{pskfile} option,
@pxref{psktool pskfile, the pskfile option documentation}.

@subsubheading version option (-v).
@anchor{psktool version}

This is the ``output version information and exit'' option.
This option takes a ArgumentType.KEYWORD argument.
Output version of program and exit.  The default mode is `v', a simple
version.  The `c' mode will print copyright information and `n' will
print the full copyright notice.
@subsubheading help option (-h).
@anchor{psktool help}

This is the ``display extended usage information and exit'' option.
Display usage information and exit.
@subsubheading more-help option (-!).
@anchor{psktool more-help}

This is the ``extended usage information passed thru pager'' option.
Pass the extended usage information through a pager.
@anchor{psktool exit status}
@subsubheading psktool exit status

One of the following exit values will be returned:
@table @samp
@item 0 (EXIT_SUCCESS)
Successful program execution.
@item 1 (EXIT_FAILURE)
The operation failed or the command syntax was not valid.
@end table
@anchor{psktool See Also}
@subsubheading psktool See Also
    gnutls-cli-debug (1), gnutls-serv (1), srptool (1), certtool (1)
@anchor{psktool Examples}
@subsubheading psktool Examples
To add a user 'psk_identity' in @file{keys.psk} for use with GnuTLS run:
@example
$ ./psktool -u psk_identity -p keys.psk
Generating a random key for user 'psk_identity'
Key stored to keys.psk
$ cat keys.psk
psk_identity:88f3824b3e5659f52d00e959bacab954b6540344
$
@end example

This command will create @file{keys.psk} if it does not exist
and will add user 'psk_identity'.
