GlobalData.java

  1. package org.jastacry;

  2. import net.sourceforge.cobertura.CoverageIgnore;

  3. /**
  4.  * Class for constant values.
  5.  *
  6.  * <p>SPDX-License-Identifier: MIT
  7.  *
  8.  * @author Kai Kretschmann
  9.  */
  10. public final class GlobalData
  11. {
  12.     /**
  13.      * Help line reply.
  14.      */
  15.     static final String HELP = "JaStaCry -h | (-v) (-t) [--encode|--decode] --infile input.txt "
  16.             + "--outfile output.bin --conffile layers.conf";

  17.     /**
  18.      * Base name for temporary files.
  19.      */
  20.     public static final String TMPBASE = "jastacry";

  21.     /**
  22.      * Extension for temporary files.
  23.      */
  24.     public static final String TMPEXT = ".tmp";

  25.     /**
  26.      * Extension for encrypted files.
  27.      */
  28.     public static final String ENCEXT = ".jac";

  29.     /**
  30.      * Parameter for encoding.
  31.      */
  32.     public static final String PARAM_ENCODE = "encode";

  33.     /**
  34.      * Parameter for decoding.
  35.      */
  36.     public static final String PARAM_DECODE = "decode";

  37.     /**
  38.      * Configuration value for layer "transparent" (lower case).
  39.      */
  40.     static final String LAYER_TRANSPARENT = "transparent";

  41.     /**
  42.      * Configuration value for layer "xor" (lower case).
  43.      */
  44.     static final String LAYER_XOR = "xor";

  45.     /**
  46.      * Configuration value for layer "rotate" (lower case).
  47.      */
  48.     static final String LAYER_ROTATE = "rotate";

  49.     /**
  50.      * Configuration value for layer "reverse" (lower case).
  51.      */
  52.     static final String LAYER_REVERSE = "reverse";

  53.     /**
  54.      * Configuration value for layer "random" (lower case).
  55.      */
  56.     static final String LAYER_RANDOM = "random";

  57.     /**
  58.      * Configuration value for layer "filemerge" (lower case).
  59.      */
  60.     static final String LAYER_FILEMERGE = "filemerge";

  61.     /**
  62.      * Configuration value for layer "md5des" (lower case).
  63.      */
  64.     static final String LAYER_MD5DES = "md5des";

  65.     /**
  66.      * Configuration value for layer "aescbc" (lower case).
  67.      */
  68.     static final String LAYER_AESCBC = "aescbc";

  69.     /**
  70.      * Configuration value for layer "aesecb" (lower case).
  71.      */
  72.     static final String LAYER_AESECB = "aesecb";

  73.     /**
  74.      * Configuration value for layer "aesctr" (lower case).
  75.      */
  76.     static final String LAYER_AESCTR = "aesctr";

  77.     /**
  78.      * enum range for Actions.
  79.      *
  80.      * @author Kai Kretschmann
  81.      *
  82.      */
  83.     public enum Action
  84.     {
  85.         /**
  86.          * Unknown action.
  87.          */
  88.         UNKOWN,

  89.         /**
  90.          * Encode action.
  91.          */
  92.         ENCODE,

  93.         /**
  94.          * Decode action.
  95.          */
  96.         DECODE;
  97.     }

  98.     /**
  99.      * enum range for return codes.
  100.      *
  101.      * @author Kai Kretschmann
  102.      *
  103.      */
  104.     public enum Returncode
  105.     {
  106.         /**
  107.          * Everything is OK.
  108.          */
  109.         RC_OK(0),

  110.         /**
  111.          * We had a warning.
  112.          */
  113.         RC_WARNING(1),

  114.         /**
  115.          * Showing help and quit.
  116.          */
  117.         RC_HELP(2),

  118.         /**
  119.          * Some major error happened.
  120.          */
  121.         RC_ERROR(3);

  122.         /**
  123.          * Private int value storage.
  124.          */
  125.         private int numVal;

  126.         /**
  127.          * Constructor of enum object.
  128.          *
  129.          * @param iNumVal gives initial value
  130.          */
  131.         Returncode(final int iNumVal)
  132.         {
  133.             this.numVal = iNumVal;
  134.         }

  135.         /**
  136.          * get numeric value of enum.
  137.          *
  138.          * @return integer value
  139.          */
  140.         public int getNumVal()
  141.         {
  142.             return numVal;
  143.         }
  144.     }

  145.     /**
  146.      * Placeholder for passwords.
  147.      */
  148.     static final String MACRO_PASSWORD = "#PASS" + "WORD#";

  149.     /**
  150.      * Hidden constructor.
  151.      */
  152.     @CoverageIgnore
  153.     private GlobalData()
  154.     {
  155.         // not called
  156.     }
  157. }