view sencrypt.1.xml @ 12:14e58decdf87

Detect the OS and configure build flags and libraries automatically
author Guido Berhoerster <guido+sencrypt@berhoerster.name>
date Tue, 13 Sep 2016 18:37:25 +0200
parents 8e9dd5328b5a
children
line wrap: on
line source

<?xml version="1.0"?>
<!--

Copyright (C) 2016 Guido Berhoerster <guido+sencrypt@berhoerster.name>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

-->
<refentry xmlns="http://docbook.org/ns/docbook" xml:lang="en">
  <info>
    <author>
      <personname>
        <firstname>Guido</firstname>
        <surname>Berhoerster</surname>
      </personname>
      <email>guido+sencrypt@berhoerster.name</email>
      <personblurb/>
    </author>
    <date>3 September, 2016</date>
  </info>
  <refmeta>
    <refentrytitle>sencrypt</refentrytitle>
    <manvolnum>1</manvolnum>
    <refmiscinfo class="source"/>
    <refmiscinfo class="version"/>
    <refmiscinfo class="manual">User Commands</refmiscinfo>
  </refmeta>
  <refnamediv>
    <refname>sencrypt</refname>
    <refname>sdecrypt</refname>
    <refpurpose>encrypt and decrypt data</refpurpose>
  </refnamediv>
  <refsynopsisdiv>
    <cmdsynopsis>
      <command>sencrypt</command>
      <arg choice="req">
        <option>-l</option>
      </arg>
    </cmdsynopsis>
    <cmdsynopsis>
      <command>sencrypt</command>
      <arg choice="opt">
        <option>-v</option>
      </arg>
      <arg choice="req">
        <option>-a</option>
        <replaceable>algorithm</replaceable>
      </arg>
      <arg choice="opt">
        <option>-k</option>
        <replaceable>key_file</replaceable>
      </arg>
      <arg choice="opt">
        <option>-i</option>
        <replaceable>input_file</replaceable>
      </arg>
      <arg choice="opt">
        <option>-o</option>
        <replaceable>output_file</replaceable>
      </arg>
    </cmdsynopsis>
    <cmdsynopsis>
      <command>sdecrypt</command>
      <arg choice="req">
        <option>-l</option>
      </arg>
    </cmdsynopsis>
    <cmdsynopsis>
      <command>sdecrypt</command>
      <arg choice="opt">
        <option>-v</option>
      </arg>
      <arg choice="req">
        <option>-a</option>
        <replaceable>algorithm</replaceable>
      </arg>
      <arg choice="opt">
        <option>-k</option>
        <replaceable>key_file</replaceable>
      </arg>
      <arg choice="opt">
        <option>-i</option>
        <replaceable>input_file</replaceable>
      </arg>
      <arg choice="opt">
        <option>-o</option>
        <replaceable>output_file</replaceable>
      </arg>
    </cmdsynopsis>
  </refsynopsisdiv>
  <refsect1>
    <title>Description</title>
    <para>The <command>sencrypt</command> utility encrypts data and the
    <command>sdecrypt</command> utility decrypts data using the specified
    algorithm. A key file must be a regular file and have the exact size of the
    desired key length, its content will be used verbatim as the key. If no key
    file is specified <command>sencrypt</command> or
    <command>sdecrypt</command> will ask for a passphrase and use that together
    with a salt to derive a key using the PBKDF2 key derivation function. If no
    input file is specfified, the input will be read from stdin. If no output
    file is specfied, the output will be written to stdout. The input and
    output file may be identical, in which case the content of the input file
    is replaced with the output after successful encryption or decryption. The
    algorithm used for encrypting data is not saved and needs to be explicitly
    specified when decrypting data.</para>
    <para><command>sencrypt</command> and <command>sdecrypt</command> are
    portable and compatible reimplementations of the <command>encrypt</command>
    and <command>decrypt</command> utilities in Solaris/Illumos-based operating
    systems.</para>
  </refsect1>
  <refsect1>
    <title>Options</title>
    <para>The following options are supported:</para>
    <variablelist>
      <varlistentry>
        <term>
          <option>-l</option>
        </term>
        <listitem>
          <para>List the available algorithms and supported key lengths and
          exit.</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>
          <option>-a</option>
          <replaceable>algorithm</replaceable>
        </term>
        <listitem>
          <para>Use the specified algorithm. See
          <xref linkend="algorithms"/> for a list of supported
          algorithms.</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>
          <option>-k</option>
          <replaceable>key_file</replaceable>
        </term>
        <listitem>
          <para>Read key data from specified key file. Key size requirements
          depend on the selected algorithm.</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>
          <option>-i</option>
          <replaceable>input_file</replaceable>
        </term>
        <listitem>
          <para>Read the input from the specified file.</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>
          <option>-o</option>
          <replaceable>output_file</replaceable>
        </term>
        <listitem>
          <para>Write the output to the specified file.</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>
          <option>-v</option>
        </term>
        <listitem>
          <para>Ignored for compatibility with <command>encrypt</command> and
          <command>decrypt</command>.</para>
        </listitem>
      </varlistentry>
    </variablelist>
  </refsect1>
  <refsect1 xml:id="algorithms">
    <title>Algorithms</title>
    <para>The following algorithms and key lengths are supported:
      <simplelist type="vert" columns="2">
        <member>aes</member>
        <member>arcfour</member>
        <member>des</member>
        <member>3des</member>
      </simplelist></para>
      <para>The arcfour, des, and 3des algorithms are considered insecure and should
      not longer be used to encrypt new files. Using them will print a warning
      message.</para>
  </refsect1>
  <refsect1>
    <title>Examples</title>
    <example>
      <title>Encrypt a file with the AES algorithm</title>
      <para>The following example encrypts a file with the AES algorithm:</para>
      <screen>
$ sencrypt -a aes -i secret.txt -o secret.aes
      </screen>
    </example>
    <example>
      <title>Decrypt a file in-place</title>
      <para>The following example decrypts a file in-place:</para>
      <screen>
$ sdecrypt -a 3des -i data.bin -o data.bin
      </screen>
    </example>
    <example>
      <title>Encrypt a file using a key file</title>
      <para>The following example generates a key file with 512 bits of random
      data and uses it to encrypt a file:</para>
      <screen>
$ dd if=/dev/urandom of=key.bin bs=64 count=1
$ sencrypt -a arcfour -k key.bin -i secret.txt -o secret.rc4
      </screen>
    </example>
    <example>
      <title>Pipe data trough encrypt in order to make a remote encrypted
      backup</title>
      <para>The following example creates an archive in the tar format,
      encrypts it and sends it to a remote location via
      <abbrev>SSH</abbrev>:</para>
      <screen>
$ pax -w -x ustar /home | sencrypt -a aes -k backup-key.bin |\
    ssh backuphost 'cat > home.tar'
      </screen>
    </example>
  </refsect1>
  <refsect1>
    <title>Exit Status</title>
    <para>The following exit values are returned:</para>
    <variablelist>
      <varlistentry>
        <term>0</term>
        <listitem>
          <para>Command successfully executed.</para>
        </listitem>
      </varlistentry>
      <varlistentry>
        <term>&gt; 0</term>
        <listitem>
          <para>An error has occured.</para>
        </listitem>
      </varlistentry>
    </variablelist>
  </refsect1>
</refentry>