home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 9 Archive / 09-Archive.zip / hpack79o.zip / hpackext.doc < prev    next >
Text File  |  1993-09-01  |  41KB  |  813 lines

  1.  
  2.                          -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  3.   Ver:0.79a0             HPACK - Extended Documentation             1 May 1993
  4.                          -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  5.  
  6.    The following represents the extended documentation for the HPACK archiver.
  7.  It  contains  information not generally needed in the day-to-day use of HPACK
  8.  and is intended mainly for the more experienced user,  covering  among  other
  9.  things  HPACK  return  codes,  more  details on the encryption system used in
  10.  HPACK, and details on the availability of HPACK for other systems.
  11.  
  12. HPACK Configuration and Script Files:
  13.  
  14.  Whenever  HPACK  encounters  a  filename  beginning  with an '@' character it
  15.  treats the rest of the filename as a  script  file  which  contains  commands
  16.  which  control the operation of HPACK.  In addition when HPACK is run it will
  17.  initially look for a default script file called HPACK.CFG in the  directories
  18.  pointed  to  by  the HPACKPATH environment variable.  This configuration file
  19.  can be used to set certain basic options for HPACK to be used whenever it  is
  20.  run,  although  these settings can be overridden with command-line options if
  21.  desired.
  22.  
  23.  HPACK configuration/script files have the following basic layout:
  24.  
  25.    - Leading spaces/tabs (whitespace) are ignored.
  26.  
  27.    - Any characters following a '#' character are treated as  comments  and
  28.      ignored
  29.  
  30.    - Any  remaining characters are treated by HPACK as commands.  These are
  31.      handled in a non-case-sensitive manner and can, in  the  case  of  the
  32.      more complex ADD and EXTRACT commands, be spread over several lines.
  33.  
  34.    - Lines  may  be  terminated  by  either linefeeds, carriage returns, or
  35.      carriage return/linefeed pairs, HPACK isn't particular.
  36.  
  37.  Script files can contain two types of commands, those  which  modify  HPACK's
  38.  basic operation, and those which control the archiving/unarchiving process.
  39.  
  40.  HPACK Variables
  41.  
  42.  HPACK  variables are ones which modify its basic mode of operation.  Commands
  43.  to manipulate variables have the form:
  44.  
  45.      SET <variable> [= <setting>]
  46.  
  47.  HPACK uses three types of variables:
  48.  
  49.    - Boolean variables which can be set to TRUE or FALSE (if no setting  is
  50.      given  a  default  value  of  TRUE  is assumed).  Examples of commands
  51.      involving boolean variables are:
  52.  
  53.      SET crypt = true
  54.      SET Force-Move
  55.      SET store-only = false
  56.  
  57.    - Numeric variables.  An  example  of  a  command  involving  a  numeric
  58.      variable is:
  59.  
  60.      SET Crypt.ivCount = 100
  61.  
  62.    - String  variables.   The  settings  for  these  can  be  surrounded by
  63.      quotation marks  or  simply  given  verbatim.   Examples  of  commands
  64.      involving string variables are:
  65.  
  66.      SET SignerID = "Hoffa, James"
  67.      SET basePath = /usr/bin/local
  68.  
  69.  Some  variables are divided into a base class and a subclass.  The base class
  70.  is the basic class which represents a generalized form of that variable type.
  71.  For example the USERID variable is a base class of various  types  associated
  72.  with userID's needed for public-key operations.
  73.  
  74.  The  subclass  is  derived  from  the  base  class  and  represents  specific
  75.  instantiations of the basic variable class.  For example the USERID.MAIN  and
  76.  USERID.SECONDARY  variables  are  subclasses  of  the  USERID  base class and
  77.  represent the  main  and  secondary  userID's  to  be  used  when  encrypting
  78.  archives.  Subclasses are denoted by a period '.' when attached to their base
  79.  class.
  80.  
  81.  The following boolean variables are  recognised  by  HPACK.   All  correspond
  82.  directly to standard command-line options:
  83.  
  84.      CRYPT                  Encrypt entire archive, -c
  85.      CRYPT-ALL              Encrypt entire archive, -ca
  86.         CRYPT.SECONDARY     Encrypt archive with secondary password, -cs
  87.         CRYPT-ALL.SECONDARY Encrypt archive with secondary password, -cas
  88.      CRYPT-INDIVIDUAL       Encrypt individual files in archive, -ci
  89.      FORCE-MOVE             Force file move into/out of an archive, -f
  90.      INTERACTIVE-MODE       Interactive move (prompt for all actions), -i
  91.      MULTIPART-ARCHIVE      Create a multipart archive, -m
  92.      OVERWRITE-EXISTING     Overwrite existing archive, -k
  93.      PUBCRYPT               Public-key encrypt entire archive, -cp
  94.      PUBCRYPT-ALL           Public-key encrypt entire archive, -cpa
  95.         PUBCRYPT.SECONDARY  Public-key encrypt archive with secondary public
  96.                             key, -cps
  97.         PUBCRYPT-ALL.SECONDARY Public-key encrypt archive with secondary
  98.                             public key, -cps
  99.      PUBCRYPT-INDIVIDUAL    Public-key encrypt individual files in archive,
  100.                             -cpi
  101.      RECURSE-DIRECTORIES    Recurse through subdirectories
  102.      SIGN                   Secure entire archive, -l
  103.      SIGN-ALL               Secure entire archive, -l
  104.      SIGN-INDIVIDUAL        Secure invidual files in archive, -li
  105.      STEALTH-MODE           Run in stealth mode, -s
  106.      STORE-ATTRIBUTES       Store file attributes, -a.
  107.      STORE-ONLY             Store files without attempting any compression -0.
  108.      TOUCH-FILES            Touch files on extraction, -t
  109.      UNIT-COMPRESSION-MODE  Unified compression mode, -u
  110.      VIEW-DIRECTORIES-ONLY  Display information only on matching directories,
  111.                             -vd
  112.      VIEW-FILES-ONLY        Display information only on matching files, -vf
  113.  
  114.  The following string variables are recognised by HPACK:
  115.  
  116.      BASEPATH               Specify the base pathname for files.
  117.      SIGNERID               Specify the userID for the public key to use
  118.                             when securing an archive
  119.      USERID                 Specify the userID for the public key to encrypt
  120.                             an archive with
  121.         USERID.MAIN         Specify the main userID for the public key to
  122.                             encrypt an archive with
  123.         USERID.SECONDARY    Specify the secondary userID for the public key
  124.                             to encrypt an archive with
  125.  
  126.  A sample HPACK configuration file which sets various default settings is:
  127.  
  128.      ########################################################################
  129.      #                                                                      #
  130.      #                      HPACK Configuration File                        #
  131.      #                                                                      #
  132.      ########################################################################
  133.  
  134.      # Set userID for securing archives
  135.  
  136.      SET signerID = "Henry Akely"
  137.  
  138.      # Default options: Always overwrite existing archives, secure archive,
  139.      # don't create multipart archive
  140.  
  141.      SET Overwrite-Source
  142.      SET Sign = true
  143.      SET MultiPart = false          # Default setting is false anyway
  144.  
  145.  HPACK Script Commands
  146.  
  147.  The  second  type of command which can be found in HPACK configuration/script
  148.  files are  ones  which  control  the  archiving/unarchiving  process.   These
  149.  commands  are  usually found only in script files - while adding a command of
  150.  this type to a configuration file where it  will  always  be  executed  isn't
  151.  terribly  useful,  it  could be used for example to always include a standard
  152.  header file in any archive created on the system.
  153.  
  154.  Currently the only script commands supported by HPACK are the ADD and EXTRACT
  155.  commands.  For simplicity the ADD command  will  be  used  in  the  following
  156.  discussion  since  its  operation  is mostly identical to that of the EXTRACT
  157.  command - the main difference is that the ADD command only takes effect  when
  158.  HPACK is adding data to an archive, and the EXTRACT command only takes effect
  159.  when  HPACK  is  extracting  data  from  an archive.  The basic form of these
  160.  commands is:
  161.  
  162.      ADD { <file-list> }
  163.      EXTRACT { <file-list> }
  164.  
  165.  The file list block can be preceded by a modifier list of the form:
  166.  
  167.      WITH attribute
  168.      [AND attribute]
  169.      ...
  170.  
  171.  The  attributes,  like  HPACK  variables,  are  of three basic types: Boolean
  172.  attributes, numeric attributes, and string attributes.   These  are  provided
  173.  solely  for  forward  compatibility  with  the HPACK Level 2 format and their
  174.  settings  will  be  ignored  by  the  current  version  of  HPACK.    Further
  175.  information  on  using these attributes will be provided in the Level 2 HPACK
  176.  documentation.
  177.  
  178.  The file list is simply a list of files to add.  More than one  name  can  be
  179.  given  per  line  if  the  names are seperated by commas.  As is the case for
  180.  string variables, the filenames can  be  surrounded  by  quotation  marks  or
  181.  simply given verbatim.
  182.  
  183.  An  HPACK  script  file which creates an encryted archive with authentication
  184.  information and which extracts the files from the archive with smart filename
  185.  translation could look as follows:
  186.  
  187.      ########################################################################
  188.      #                                                                      #
  189.      #                       Sample HPACK Script File                       #
  190.      #                                                                      #
  191.      ########################################################################
  192.  
  193.      # The userID to use when adding authentication information
  194.  
  195.      SET SignerID = Nathan Pickman   # Overrides option given in config.file
  196.  
  197.      # The options for adding the files: Sign and encrypt the entire archive,
  198.      # and add a miscellaneous set of files to it.
  199.  
  200.      SET Crypt-All
  201.      SET Sign-All
  202.      ADD WITH charset = iso8859-1
  203.          AND language = finnish
  204.          AND texttype = lf
  205.          AND error-correction
  206.          {
  207.          *.txt, "Data Report of 05/02/93"
  208.          FILE.DOC
  209.          .cshrc
  210.          }
  211.      ADD { readme.1st }
  212.  
  213.      # The options for extracting the files: Perform smart translation of file-
  214.      # names to eliminate naming conflicts.
  215.  
  216.      SET Overwrite.Smart = True
  217.      EXTRACT { * }
  218.  
  219.  Note that the script files themselves are not subject to being overridden  by
  220.  the  base  path  specified  with the [-b]ase path option (see "HPACK Options"
  221.  above).  However filenames given within the script file will be overridden by
  222.  the base path.
  223.  
  224.  Example: To add files to the archive ARCHIVE.HPK entirely under  the  control
  225.  of the script file SCRIPT:
  226.  
  227.      HPACK A ARCHIVE @SCRIPT
  228.  
  229.  
  230. HPACK SQL Commands
  231.  
  232.  As  the  number of attributes and options available for a piece of data in an
  233.  archive grows, manipulating the data based on these attributes  becomes  more
  234.  and  more  complex.   The  simple  collection-of-files  model used in current
  235.  archivers becomes inadequate, and an archive needs to be  viewed  as  a  much
  236.  more complex information database model.
  237.  
  238.  In order to manage the information in an archive, HPACK uses Structured Query
  239.  Language  (SQL)  to specify which information is to be accessed and how it is
  240.  to be displayed.  SQL is an established set of statements that can be used to
  241.  manage information which is stored in a database.  Using these statements, it
  242.  is possible to add, delete, or update information in a database,  or  request
  243.  information  from  the  database.   Since HPACK already includes features for
  244.  modifying archives, the only SQL  statement  which  is  used  is  the  SELECT
  245.  statement, which allows a database to be queried for special information.
  246.  
  247.  A SELECT statement has the following syntax:
  248.  
  249.      SELECT [DISTINCT] name [,name ...]
  250.      FROM archive
  251.      [WHERE expression]
  252.      [GROUP BY name [,name ...]
  253.      [HAVING criteria]
  254.      [ORDER BY name [DESC] [,name [DESC] ...]
  255.  
  256.  The SELECT statement specifies the names of specific properties of a piece of
  257.  data  such as size, date, time, name, and so on.  An asterisk '*' will select
  258.  all properties.  The DISTINCT keyword eliminates  duplicate  entries  in  the
  259.  resulting  information.   Since  the only logical use for this is to suppress
  260.  duplicate filenames, and since all filenames are unique  anyway,  HPACK  will
  261.  accept, but ignore, the DISTINCT keyword.
  262.  
  263.  The  FROM statement specifies the name of the archive to read the information
  264.  from.  Since this has already been specified, HPACK will accept, but  ignore,
  265.  the FROM statement.
  266.  
  267.  To  select  all  properties  of each piece of data in an archive, the command
  268.  would be:
  269.  
  270.      SELECT *
  271.      FROM archive
  272.  
  273.  which in fact corresponds to the SQL command:
  274.  
  275.      SELECT system, length, size, ratio, date, time, name
  276.      FROM archive
  277.  
  278.  and will produce the following output:
  279.  
  280.      System Length   Size   Ratio   Date     Time    Name
  281.      ------ ------- ------- ----- -------- --------  --------------
  282.      Amiga     1601     705  57%  26/04/91 21:30:11  Makefile
  283.      Amiga    17532    4910  72%  23/02/93 18:54:33  What.iff
  284.      Amiga     1097     495  55%  21/06/92 17:45:08  Installer
  285.      Amiga     2728    1039  62%  12/07/92 11:11:34  ReadMeFirst
  286.      Amiga     5263    1792  66%  14/03/91 17:59:37  Overview
  287.      Amiga     1576     705  56%  16/12/92 16:45:42  IFF Basics
  288.      Amiga     1836     798  57%  21/03/91 23:20:41  IFF Intro
  289.      Amiga     6600    2284  66%  23/03/93 23:23:34  AISB Manifesto
  290.      Amiga    38285    6733  83%  20/01/93 10:48:09  Templates
  291.             ------- ------- -----                    --------------
  292.               76518   19462  75%                     9 files
  293.  
  294.  To select specific properties, the names of the desired properties  would  be
  295.  used  in  place  of  the asterisk.  Possible properties are date, time, size,
  296.  length, name, ratio, and system.  To display the date, time, size,  and  name
  297.  of each file in the archive, the command would be:
  298.  
  299.      SELECT date, time, size, name
  300.      FROM archive
  301.  
  302.  with the following output:
  303.  
  304.        Date     Time    Size    Name
  305.      -------- -------- -------  --------------
  306.      26/04/91 21:30:11     705  Makefile
  307.      23/02/93 18:54:33    4910  What.iff
  308.      21/06/92 17:45:08     495  Installer
  309.      12/07/92 11:11:34    1039  ReadMeFirst
  310.      14/03/91 17:59:37    1792  Overview
  311.      16/12/92 16:45:42     705  IFF Basics
  312.      21/03/91 23:20:41     798  IFF Intro
  313.      23/03/93 23:23:34    2284  AISB Manifesto
  314.      20/01/93 10:48:09    6733  Templates
  315.                        -------  --------------
  316.                          19462  9 files
  317.  
  318.  The  ORDER BY statement specifies the order in which the output data is to be
  319.  displayed.  This statement must be the last one in the entire SELECT command,
  320.  and will order the output in ascending order based on the  specified  fields.
  321.  More  than one field can be specified, with the one which is most significant
  322.  for the ordering being given first.  To  display  the  output  in  descending
  323.  instead  of  ascending  order,  the field name should be followed by the DESC
  324.  keyword.
  325.  
  326.  To display the previous listing and order the output  by  name,  the  command
  327.  would be:
  328.  
  329.      SELECT date, time, size, name
  330.      FROM archive
  331.      ORDER BY name
  332.  
  333.  with the following output:
  334.  
  335.        Date     Time    Size    Name
  336.      -------- -------- -------  --------------
  337.      23/03/93 23:23:34    2284  AISB Manifesto
  338.      16/12/92 16:45:42     705  IFF Basics
  339.      21/03/91 23:20:41     798  IFF Intro
  340.      21/06/92 17:45:08     495  Installer
  341.      26/04/91 21:30:11     705  Makefile
  342.      14/03/91 17:59:37    1792  Overview
  343.      12/07/92 11:11:34    1039  ReadMeFirst
  344.      20/01/93 10:48:09    6733  Templates
  345.      23/02/93 18:54:33    4910  What.iff
  346.                        -------  --------------
  347.                          19462  9 files
  348.  
  349.  To display the listing in descending order by size, with a secondary ordering
  350.  criterion of date and time, the command would be:
  351.  
  352.      SELECT date, time, size, name
  353.      FROM archive
  354.      ORDER BY size DESC, date, time
  355.  
  356.  with the output:
  357.  
  358.        Date     Time    Size    Name
  359.      -------- -------- -------  --------------
  360.      20/01/93 10:48:09    6733  Templates
  361.      23/02/93 18:54:33    4910  What.iff
  362.      23/03/93 23:23:34    2284  AISB Manifesto
  363.      14/03/91 17:59:37    1792  Overview
  364.      12/07/92 11:11:34    1039  ReadMeFirst
  365.      21/03/91 23:20:41     798  IFF Intro
  366.      26/04/91 21:30:11     705  Makefile
  367.      16/12/92 16:45:42     705  IFF Basics
  368.      21/06/92 17:45:08     495  Installer
  369.                        -------  --------------
  370.                          19462  9 files
  371.  
  372.  The WHERE, GROUP BY, and HAVING statements are relevant mainly in the Level 2
  373.  HPACK format and are not used in the current version.
  374.  
  375.  Currently  SQL  commands  can  only  be  given  on the command-line using the
  376.  +select option, although in the Level 2 version their  use  in  script  files
  377.  will be allowed.
  378.  
  379.  
  380. More on Archive Comments:
  381.  
  382.  To  make  plain  text  archive  comments  portable  across multiple operating
  383.  systems it is recommended that they not be hardcoded for  some  fixed  screen
  384.  size  (such  as 80 x 24) but instead use HPACK's built-in formatting commands
  385.  as part of the text.   HPACK  will  then  format  the  text  of  the  comment
  386.  according to these commands when displaying it.
  387.  
  388.  In  order  to support this, HPACK supports, in addition to the standard plain
  389.  ASCII text format, a text format called richtext,  defined  in  Internet  RFC
  390.  1341  "Multipurpose  Internet  Mail  Extensions",  June  1992.   The richtext
  391.  format is compatible with SGML (Standard Generalized  Markup  Language),  the
  392.  ISO  document  formatting  standard.  Using an appropriate DTD (Document Type
  393.  Definition), an SGML parser can parse a richtext document.
  394.  
  395.  The syntax of richtext is very simple, and at the top level consists  of  the
  396.  standard ASCII character set, with special embedded formatting commands being
  397.  denoted by the angle bracket characters "<" and ">".  Formatting commands are
  398.  simple  keywords which ascribe certain properties to any following text.  The
  399.  forward slash "/" negates these properties.  So for  example  "<bold>"  would
  400.  set  all following text in a boldface font, and "</bold>" would return to the
  401.  normal font.
  402.  
  403.  Three special-case formatting commands are defined:
  404.  
  405.     <lt> represents a literal "<" character.
  406.     <nl> represents a line break
  407.     <np> represents a page break
  408.  
  409.  Currently  defined  richtext  formatting  commands  (not  all  of  which  are
  410.  implemented by HPACK) are:
  411.  
  412.     Command:        Action on subsequent text
  413.     --------        -------------------------
  414.     <bold>          Text is set in a boldface font
  415.     <italic>        Text is set in an italic font
  416.     <fixed>         Text is set in a fixed-width font
  417.     <smaller>       Text is set in a smaller font
  418.     <bigger>        Text is set in a larger font
  419.     <underline>     Text is underlined
  420.     <center>        Text is centered
  421.     <flushLeft>     Text is left-justified
  422.     <flushRight>    Text is right-justified
  423.     <indent>        Text is indented at the left margin
  424.     <indentRight>   Text is indented at the right margin
  425.     <outdent>       Text is outdented at the left margin
  426.     <outdentRight>  Text is outdented at the right margin
  427.     <samePage>      Text is grouped, if possible, on the same page
  428.     <subscript>     Text is interpreted as a subscript
  429.     <superscript>   Text is interpreted as a superscript
  430.     <heading>       Text is printed as a page heading
  431.     <footing>       Text is printed as a page footing
  432.     <iso-8859-x>    Text is interpreted as being in the appropriate ISO 8859-x
  433.                     character set.
  434.     <us-ascii>      Text is interpreted as being in the US-ASCII character set
  435.     <excerpt>       Text  is  interpreted  as  a  textual excerpt from another
  436.                     source.    Typically   this   will   be   displayed  using
  437.                     indentation and an alternate font.
  438.     <paragraph>     Text is interpreted as a single paragraph with appropriate
  439.                     paragraph breaks
  440.     <signature>     Text is interpreted as a "signature".  Sometimes this will
  441.                     be displayed in a smaller font or set apart from the  main
  442.                     text of the message
  443.     <comment>       Text is interpreted as a comment
  444.  
  445.  Each formatting command remains  in  effect  until  undone  by  the  matching
  446.  negative  formatting  command.  For example bold italic text can be specified
  447.  as:
  448.  
  449.     <bold><italic>text</italic></bold>
  450.  
  451.  or:
  452.  
  453.     <italic><bold>text</bold></italic>
  454.  
  455.  Richtext also distinguishes between "hard" and "soft" line breaks.  A  normal
  456.  line  break  in  the richtext data is interpreted as a "soft" line break, one
  457.  which is included only to make editing the richtext source easier  but  which
  458.  is  not  displayed  when  the  richtext  is output.  To include a "hard" line
  459.  break (one which is displayed when the richtext is  viewed),  the  "<nl>"  or
  460.  "<paragraph>" commands should be used instead.
  461.  
  462.  An example richtext archive comment is:
  463.  
  464.     <bold>HPACK</bold> - a portable archive format for the 1990's.<nl><nl>
  465.     <indent>Unlike previous archivers which have used <italic>ad hoc</italic>
  466.     formats with no attempt at portability and internationalization,
  467.     <bold>HPACK</bold> attempts to be compatible with numerous
  468.     <fixed>ISO</fixed>, <fixed>Internet</fixed>, and <fixed>ECMA</fixed>
  469.     standards.
  470.  
  471.  When displayed after formatting has been performed, the text looks as follows
  472.  (and you'll need the proper version of the documentation to see this):
  473.  
  474.  *HPACK* - a portable archive format for the 1990's.
  475.  
  476.     Unlike previous archivers which have used ad hoc formats with no attempt at
  477.     portability and internationalization, *HPACK* attempts to be compatible
  478.     with numerous _ISO_, _Internet_, and _ECMA_ standards.
  479.  
  480.  Note  that  many  of  the  text  types will not be available on some systems.
  481.  HPACK will do the best with what's available.
  482.  
  483.  
  484. HPACK Return Codes:
  485.  
  486.  If an error occurs during archive processing, HPACK will return one  of  four
  487.  sets of return values.  These are:
  488.  
  489.    0         No error
  490.    001-099   Severe error
  491.    100-199   Error
  492.    201-255   Warning
  493.  
  494.  The error types can thus be quickly grouped into one  of  three  classes  and
  495.  handled appropriately.  The actual values of these error return values are:
  496.  
  497.      Type:             Value:      Description:
  498.      -----             ------      ------------
  499.  
  500.    EXIT_OK               0         No error
  501.  
  502.    EXIT_INT_ERR          1         Internal error
  503.    EXIT_NO_MEM           2         Out of memory
  504.    EXIT_NO_DISK          3         Out of disk space
  505.    EXIT_NO_ARCH          4         Can't open archive file
  506.    EXIT_NO_TEMP          5         Can't open temporary file
  507.    EXIT_NO_PATH          6         Can't find path
  508.    EXIT_NO_BASE          7         Can't access base directory
  509.    EXIT_NO_MKDIR         8         Can't create directory
  510.    EXIT_BREAK            9         User interrupt
  511.    EXIT_FILE_ERR        10         Unknown file error
  512.    EXIT_DIR_CORRUPT     11         Archive directory corrupted
  513.  
  514.    EXIT_LONG_PATH      100         Path too long
  515.    EXIT_NO_OVERRIDE    101         Can't override base path
  516.    EXIT_NEST           102         Directories nested too deeply
  517.    EXIT_SCRIPT_ERR     103         Error(s) in script file
  518.    EXIT_NOT_ARCH       104         Not an HPACK archive
  519.    EXIT_BAD_KEYFILE    105         Bad keyfile
  520.    EXIT_NOTHING        106         Nothing to do
  521.    EXIT_COMMAND        107         Unknown command
  522.    EXIT_OPTION         108         Unknown option
  523.  
  524.    EXIT_PASS           200         Differing or incorrect password(s)
  525.    EXIT_CHANGE         201         Bad attempt to change archive (eg attempt
  526.                                     to change a block-encrypted archive)
  527.    EXIT_NOLONG         202         Long arg.format not supported
  528.    EXIT_BADWILD        203         Bad wildcard format or inappropriate use of
  529.                                     wildcards
  530.    EXIT_SECURITY       204         General security/encryption error
  531.    EXIT_NOCRYPT        205         Cannot process encrypted archive
  532.  
  533.  Under  VMS  return  values are handled in a somewhat different manner.  HPACK
  534.  will return the error code as above in the facility number field, as well  as
  535.  a  status  of  success,  warning, error, or severe error corresponding to the
  536.  above categories of error.
  537.  
  538.  For  more  details on the error types, see the section "HPACK Error Messages"
  539.  in the main HPACK documentation HPACK.DOC.
  540.  
  541.  
  542. General Archive Information:
  543.  
  544.  HPACK uses a central directory structure contained at the end of the archive,
  545.  with the option of including directory information headers with each archived
  546.  file  for improved error recovery.  All data stored in HPACK archives is left
  547.  unchanged - there is no need for any truncation of filenames, translation  of
  548.  file attributes, or omission of OS-dependant information from a file in order
  549.  to  archive  it.   All  information  about  a  file (such as attributes, file
  550.  datestamps,  attached  comments,  icons,   graphics   information,   security
  551.  information,  user-defined  file  attributes,  and so on), is stored with the
  552.  file and is translated on extraction if necessary.  HPACK includes  a  fairly
  553.  complete   set  of  internal  filesystem  management  routines  which  handle
  554.  operations such as creating directories, adding and  deleting  files  to/from
  555.  directories,  and  so  on.   Filenames  and directory names of any length and
  556.  containing  any  characters  are  supported,   as   are   special   operating
  557.  system-dependant  files  such  as  links, volume labels/ID's, and so on.  All
  558.  versions of HPACK will handle all the extra information which can be added to
  559.  a file, but due to differences between various operating systems some of  the
  560.  information  may  not  be used on some systems (for example MSDOS, a somewhat
  561.  complex bootstrap loader used on many 80x86 systems, will ignore most of  the
  562.  extra information it finds in an archive).
  563.  
  564.  
  565. HPACK Data Authentication/Encryption:
  566.  
  567.  HPACK  allows  files  to  be  encrypted  using  a variety of either public or
  568.  conventional-key cryptosystems.   At  the  moment  only  the  RSA  public-key
  569.  cryptosystem  is  used  for data authentication, and the MDC conventional-key
  570.  and RSA public-key cryptosystems are used for file or archive encryption. The
  571.  RSA key format used in HPACK is compatible with  version  2.0  or  higher  of
  572.  Philip Zimmermann's excellent PGP encryption package.
  573.  
  574.  In  public-key  encryption,  each  user  choses  a pair of keys, a public key
  575.  (which as the name suggests is made available publicly), and  a  private  key
  576.  which only the user knows.  This allows a complete stranger to use the public
  577.  key  to encrypt a message to the user which only the user can decrypt, unlike
  578.  conventional-key encryption which requires that the encryption key  be  first
  579.  somehow communicated to the user.
  580.  
  581.  HPACK  uses  the  RSA  Data  Security  Inc.   MD5 message digest algorithm to
  582.  generate a unique 'fingerprint'  of  the  data  to  be  authenticated.   This
  583.  fingerprint consists of a cryptographically strong 128-bit one-way hash value
  584.  which  it is computationally infeasible to invert.  This is a bit like a CRC,
  585.  but unlike a CRC it is *very* difficult for an attacker to bypass:  Not  only
  586.  is  the  MD5  function  specifically designed for this purpose (which the CRC
  587.  function is not), but it is also generally agreed that a  message  digest  of
  588.  this sort should be a minimum of 128 bits long: A 32-bit CRC will take around
  589.  65,000  attempts  to  defeat  using  a so-called 'birthday attack', a 128-bit
  590.  message digest will take in the order of 20,000,000,000,000,000,000  attempts
  591.  to  break  (in  fact CRC's are even easier to defeat than that - it is a very
  592.  simple matter to generate a message with an arbitrary CRC value, making CRC's
  593.  worthless for detecting deliberate manipulation of data).   MD5  has  so  far
  594.  resisted  attack,  although  a  greatly-reduced  form  of  MD5  was broken at
  595.  Eurocrypt  '92  in  2^13  attempts  with  a  chosen  plaintext  attack  using
  596.  differential  cryptanalysis,  and  another   version,   run   under   special
  597.  circumstances  which cannot occur in practice, was broken at Eurocrypt '93 in
  598.  2^16 attempts using differential cryptanalysis.
  599.  
  600.  This  message  digest  is  then  signed  using  the RSA public-key encryption
  601.  algorithm, with the option of using  a  commercial-grade  (512  bits  or  155
  602.  digits)  or  military-grade (1024 bits or 310 digits) key (HPACK will in fact
  603.  use keys of any length up to 2048 bits or 620 digits, the  two  values  given
  604.  above are simply the default key lengths used by PGP 2.0).  The exact size of
  605.  the  key  to  use depends on how long the secret must be kept secure, and how
  606.  large an amount of resources your opponent is prepared to commit to  breaking
  607.  (factoring)  the  key.   In  "Public-Key  Cryptography,  State of the Art and
  608.  Future Directions", a report from a workshop involving  the  world's  leading
  609.  experts in the field, the authors state:
  610.  
  611.  "For most applications a modulus size of 1024 bits for RSA should  achieve  a
  612.   sufficient  level of security for 'tactical' secrets for the next ten years.
  613.   This is for long term secrecy purposes, for short term authenticity purposes
  614.   512 bits might suffice in this century".
  615.  
  616.  RSA Data Security's frequently-asked-question list contains the statement:
  617.  
  618.  "Rivest  estimates  that a 512-bit modulus, currently the most common modulus
  619.   length,  can  be  factored  with  an  $8.2 million effort today, less in the
  620.   future.   Those with extremely valuable data (or large potential damage from
  621.   digital forgery) should use a modulus of, say 700 or 800 bits in length.   A
  622.   certifying authority should use a modulus of 1000 bits or more, because  the
  623.   validity  of  many  other  key  pairs depends on the security of one central
  624.   key."
  625.  
  626.  The $8.2 million figure is actually somewhat optimistic, in reality it should
  627.  be somewhat more difficult than that.  For an example from real life, in 1977
  628.  RSA Data Security published a  129-digit  (or  430-bit)  number  which  is  a
  629.  product of two primes, and offered a $100 prize to the first person to factor
  630.  it.  In spite of fifteen years of work on it, noone has done so (at least not
  631.  publicly), although  an attempt using approximately 10,000 workstations and a
  632.  16,384 processor MasPar machine are currently under way and should produce  a
  633.  result within a few months.
  634.  
  635.  The following table gives another estimate of the amount of money  needed  to
  636.  break an RSA key of a given length over the next 20 years:
  637.  
  638.        Budget    Year |   1993   |    2003   |   2013
  639.       ================+==========+===========+===========
  640.           $25,000     | 400 bits |  450 bits |  550 bits
  641.       ----------------+----------+-----------+-----------
  642.         $25,000,000   | 600 bits |  700 bits |  850 bits
  643.       ----------------+----------+-----------+-----------
  644.       $25,000,000,000 | 900 bits | 1050 bits | 1200 bits
  645.       ----------------+----------+-----------+-----------
  646.  
  647.  As the power of computer hardware  and  software  increases,  the  investment
  648.  necessary  to  break a key of a given length becomes less and less, such that
  649.  the shortest keys (512  bits)  which  currently  offer  borderline  security,
  650.  become  quite  insecure  after  around a decade.  Even 1000-bit keys would be
  651.  risky if faced with a big-budget opponent willing to spend the  money.   2000
  652.  to  3000-bit RSA keys seem prudent to protect any data that you are seriously
  653.  concerned might be attacked by a big-budget (or very patient) opponent.
  654.  
  655.  Finally, the US government allows export of RSA encryption code provided  the
  656.  key  size  is  limited  to less than 512 bits.  You are left to draw your own
  657.  conclusions from this fact.
  658.  
  659.  The encryption routine used by HPACK employs the MDC algorithm run in  cipher
  660.  feedback  mode,  a  128-bit  block cipher derived from the MD5 message digest
  661.  algorithm with a key size of up to 2048 bits (though HPACK limits this to  80
  662.  ASCII  characters  or  around  560  bits  of effective key information). This
  663.  algorithm  has  been  designed  to  make  encryption  relatively   fast   and
  664.  brute-force  attacks  slow and painful.  Once the initial password management
  665.  is done, en/decryption proceeds at  a  fairly  rapid  pace,  however  if  the
  666.  password  is  changed  constantly (as it would be for a brute-force attack) a
  667.  lot of time is spent in password management after each change.   MDC  has  so
  668.  far  not  been seriouly attacked, and it is highly unlikely that generalizing 
  669.  the MD5 attack to MDC is possible.
  670.  
  671.  In  comparison, the US Data Encryption Standard (DES) can be broken much more
  672.  quickly using a simple brute-force attack involving trying all possible  keys
  673.  until the correct one is found.  DES keysearch machines can be bought off the
  674.  shelf  for  approximately  $500,000  but aren't usually sold by that name.  A
  675.  commercial circuit emulation machine (eg. Quickturn) containing a  number  of
  676.  FPGAs,  (say 500 to 1000 3090's) can be programmed to be a DES search engine.
  677.  With 500 chips, running at 10Mhz, this device can perform 5 billion  tests  a
  678.  second.   The  time  to  derive  one  key  is thus is a maximum of 14 million
  679.  seconds or 23 weeks, with an average time of 12 weeks.  Anyone who needs  the
  680.  answer faster than that can simply buy a bigger machine - a  paper  presented
  681.  at  Crypto '93  provides complete constructional details for a machine which,
  682.  for a once-only investment of $100 million, will break DES in  2  minutes.  A
  683.  scaled-down  $1 million  machine  for those with smaller budgets takes around
  684.  3.5 hours  to  perform  the  same task, or 1 1/2 days for the bargain-basment
  685.  $100,000 version.
  686.  
  687.  Due to the layout of an HPACK archive all encrypted data  blocks  begin  with
  688.  raw  compressed  data,  greatly  reducing  the  chances  of a so-called known
  689.  plaintext attack (in which the attacker knows, or  can  guess,  some  of  the
  690.  unencrypted  data).   HPACK  overwrites any sensitive data in memory once the
  691.  encryption/decryption/authentication  process  has  completed,  and  contains
  692.  extensive  error trapping and handling to ensure that even if a serious error
  693.  were to occur, the program stack and data areas would be wiped on exit.
  694.  
  695.  The code for the encryption and authentication  routines  used  in  HPACK  is
  696.  freely  available  in  source  form  (see  the next section, "Verification of
  697.  HPACK's Encryption/Authentication").  In this way it is possible  to  compile
  698.  the  code  and  independantly  verify  that HPACK is indeed using the correct
  699.  algorithms and encryption/authentication techniques, and thus  eliminate  any
  700.  fears of trapdoors hidden in the code/encrypted data.
  701.  
  702.  
  703. Verification of HPACK's Encryption/Authentication:
  704.  
  705.  The  encryption  and authentication code used by HPACK can be freely examined
  706.  by anyone wishing to reassure themselves of its security.   The  MD5  message
  707.  digest algorithm is described in the following source:
  708.  
  709.    Internet  RFC 1321, "The MD5 Message-Digest Algorithm", Internet Activities
  710.      Board, 1992.  Obtainable from ftp.nisc.sri.com in the rfc directory.
  711.  
  712.  The mode of operation of the MDC cipher is described in the following federal
  713.  and international standards:
  714.  
  715.    National Bureau of Standards FIPS publication 81: "DES Modes of Operation",
  716.      December 1980.
  717.  
  718.    ISO/IEC 10116:1991 "Information technology - Modes  of  operations  for  an
  719.      n-bit block cipher algorithm", 1991.
  720.  
  721.    ISO 10126-2:1991 "Banking - Procedures for message encipherment (wholesale)
  722.      - Part 2", 1991
  723.  
  724.  The RSA algorithm is described in many texts, among them:
  725.  
  726.    Brassard,  G.  "Modern  Cryptology",  Lecture  Notes  in  Computer  Science
  727.      vol.325, 1988.
  728.  
  729.    Rivest,  R.,  Shamir,  A.,  and Adleman, L. "A method for obtaining digital
  730.      signatures and public-key cryptosystems", CACM vol.21, no.2, Feb.1978
  731.  
  732.    RSA Data Security Inc. "PKCS  #1:  RSA  Encryption  Standard",  June  1991,
  733.      Version 1.4.
  734.  
  735.  It is also a part of the following standards:
  736.  
  737.    AS 2805.6.5.3 "Electronic Funds Transfer - Key Management", 1990.
  738.  
  739.    ISO  9796:1988  "Information  technology,  security  techniques  -  Digital
  740.      signature scheme giving message recovery", 1988
  741.  
  742.    RSA Data Security Inc. "PKCS  #1:  RSA  Encryption  Standard",  June  1991,
  743.      Version 1.4.
  744.  
  745.  In all cases the above algorithms can be derived from the relevant standards,
  746.  and all code used in  HPACK  checked  against  official  implementations  for
  747.  accuracy.
  748.  
  749.  
  750. An Analysis of HPACK Encryption Security:
  751.  
  752.  Much  has  been  made recently of the dangerously insecure encryption methods
  753.  used by some archivers fnord.  HPACK goes to great lengths to  try  and  make
  754.  breaking  of  its encryption system as difficult as possible.  An analysis of
  755.  possible weak points in the encryption is given below:
  756.  
  757.  Encryption of individual files:
  758.    Slow  and  reasonably safe.  Since a different 64-bit initialization vector
  759.    is used to rekey the MDC algorithm for each file, performing a  brute-force
  760.    attack  on  a  collection of files would involve rekeying the algorithm for
  761.    each file being attacked.  Very difficult to attack unless the plaintext is
  762.    known.
  763.  
  764.  Encryption of the entire archive:
  765.    Faster  than  encrypting  individual  files,  and  more secure for the data
  766.    portion of the archive since only the start of the first file is  available
  767.    to  be  attacked.   However  the  encryption  of  the directory information
  768.    provides partially-known plaintext in the form of  the  directory  headers.
  769.    The  information content is probably enough to allow at least a preliminary
  770.    form of automatic checking.
  771.  
  772.  Encryption of the entire archive with a secondary password:
  773.    About the same speed as encrypting the entire archive, and the most  secure
  774.    of  the  encryption  schemes.   Even if the encryption for the directory is
  775.    broken, the main data is still protected by a second  password,  and  again
  776.    only the start of the first file is available to be attacked.
  777.  
  778.  There  are two possible methods of attack, either a known-plaintext attack on
  779.  the archive data, or a partially-known-plaintext attack on the directory data.
  780.  If  the  uncompressed,  unencrypted  contents of the archive are known, HPACK
  781.  can be used to compress them without encryption and provide  plaintext  which
  782.  can  be  used  in  a  brute-force  or dictionary-based attack.  Similary, the
  783.  archive directory contains a relatively fixed format which can be  parsed  as
  784.  part of a brute-force attack to narrow down the search range considerably.
  785.  
  786.  Using  public-key  encryption  offers  more security against dictionary-based
  787.  cracking programs since the hybrid method employed by HPACK  uses  a  128-bit
  788.  binary  MDC key encrypted with an RSA public key.  Breaking this system would
  789.  entail a brute-force search on the entire 128-bit key space, a total of 1.7 x
  790.  10^38 keys assuming a match is found after half the keys have been scanned.
  791.  
  792.  
  793. Availability of HPACK for Other Systems:
  794.  
  795.  HPACK  is  currently available in Amiga, Archimedes, Atari ST/TT, MSDOS, OS/2
  796.  (16 and 32 bit), Unix,  and  Windows  versions,  with  other  ports  becoming
  797.  available as access to the relevant hardware and software permits.  If anyone
  798.  wants  a version for their particular system, they are welcome to try to port
  799.  it across.  The code consists of around 500K of mostly ANSI C code with  some
  800.  low-level  system  I/O  thrown in, and a knowledge of assembly language being
  801.  useful on low-end systems to speed up a  few  of  the  core  compression  and
  802.  encryption  routines.   Anyone  interested  in porting HPACK to any system is
  803.  urged to contact the author...
  804.  
  805.  All  code  contained  in  HPACK,  with  the  exception of the RSA encryption/
  806.  decryption routines and the MD5 message  digest  routines,  is  entirely  the
  807.  result  of original research and is not patented, nor do I have any intention
  808.  of ever patenting it.  The only code in HPACK which falls under any  sort  of
  809.  restrictions  is  the  RSA code.  MD5 has been placed in the public domain by
  810.  its  authors.   Since  HPACK originates from outside the US and since I don't
  811.  believe in crippleware, there is no "restricted" or "crippled" version - full
  812.  encryption and authentication capabilities are available to everyone.
  813.