EAEScrypt User Commands EAEScrypt NAME EAESCrypt - Extended AES v2.00 (June, 2013) Encrypts and decrypts files using the Extended Advanced Encryption (EAES) algorithm. SYNOPSIS eaescrypt COMMAND OPTIONS... The available commands are: eaescrypt encrypt INPUT-ENTRY [--output-file OUTPUT-FILE] \ [--key KEY | --key-file KEY-FILE | --key-uuid KEY-UUID \ | --key-passphrase] \ [--keygen [--truly-random]] [--key-size KEY-SIZE] \ [--zlib-compress [--zlib-level LEVEL]] \ [--overwrite] [-verbose] [--pause] eaescrypt decrypt ENCRYPTED-FILE [--key KEY | --key-file KEY-FILE \ | --key-uuid KEY-UUID | --key-passphrase] \ [--overwrite] [--verbose] [--pause] eaescrypt keymgr [--keygen [--truly-random] [--key-size KEY-SIZE]] \ [--export-key KEY-FILE [--key-uuid KEY-UUID] [--overwrite]] \ [--export-file-key FILE [--overwrite]] \ [--import-key KEY-FILE] \ [--erase-key --key-uuid KEY-UUID] \ [--remove-key KEY-FILE ] \ [--key-count] [--key-index] \ [--restore-database] \ [--verbose] [--pause] eaescrypt info INPUT-FILE... [--pause] To output the help page about EAEScrypt, use: eaescrypt --help To output the help page about a specific command, use: eaescrypt COMMAND --help LEGAL NOTICE Due to legal restrictions in the use of cryptographic algorithms imposed by the Wassenaar Arrangement, you are not eligible to use EAESCrypt if you live in one of the following countries: - Argentina - Australia - Austria - Belgium - Bulgaria - Canada - Croatia - Czech Republic - Denmark - Estonia - Finland - France - Germany - Greece - Hungary - Ireland - Italy - Japan - Latvia - Lithuania - Luxembourg - Malta - Mexico - Netherlands - New Zealand - Norway - Poland - Portugal - Republic of Korea - Romania - Russian Federation - Slovakia - Slovenia - South Africa - Spain - Sweden - Switzerland - Turkey - Ukraine - United Kingdom - United States Refer to the local laws of your country about the restrictions in the use of cryptographic algorithms. The authors of EAESCrypt disclaim any liability for any way out of the use of this software, including but not limited to loss of data, use or profits, business interruption, leakage of sensitive information, use for any illicit or illegal purposes, or even the usage not in accordance with the law. DESCRIPTION EAEScrypt is a utility that is designed to protect sensitive data using secure encryption. It uses the Advanced Encryption Standard (AES) as published by the Federal Information Processing Standards Publications (FIPS PUBS) and issued by the National Institute of Standards and Technology (NIST). The typical usage to encrypt is: eaescrypt encrypt ENTRY_NAME Where ENTRY_NAME is either the name of the file or the name of the folder to be encrypted. If ENTRY_NAME is a folder, then EAEScrypt encrypts all the folder structure, as well as every file in it. It generates an output archive file with the same name as the input, followed by the suffix ".eaes". To decrypt an encrypted archive file, use the command: eaescrypt decrypt ENCRYPTED_FILE_NAME Where ENCRYPTED_FILE_NAME is the name of the encrypted archive file (usually with the suffix ".eaes"). EAEScrypt restores the original folder structure with all its corresponding files. KEYS In order to encrypt or decrypt files and folders, EAEScrypt uses symmetric keys. A key is a sequence of characters that is known only to who will encrypt or decrypt files. It is symmetric because the same key used to encrypt the files should be used to decrypt it. Without this key it is virtually impossible to recover the original files from the encrypted archive. The key is the one that provides information security. If no key have been specified at the moment to encrypt a file or folder, the system uses the default key stored in the Keys Database. In this case, if there's no key registered in the Keys Database, EAEScrypt generates a new random key to encrypt the files. If you want to specify a key to encrypt, there are four different ways to do it: - by providing the key from the command line; - by getting the key from a file; - by providing an identifier os a key from the Keys Database; - by providing a passphrase. To provide a key from the command line, use the --key option: eaescrypt encrypt ENTRY_NAME --key "Type here your secret key" eaescrypt decrypt ENCRYPTED_FILE_NAME --key "Type here your secret key" To get a key from a file, use the --key-file option: eaescrypt encrypt ENTRY_NAME --key-file KEY_FILE_NAME eaescrypt decrypt ENCRYPTED_FILE_NAME --key-file KEY_FILE_NAME KEY_FILE_NAME can be any valid file. EAEScrypt will get the first bytes of the file and use them as the key. To use a specific key from the keys database, use the --key-uuid option: eaescrypt encrypt ENTRY_NAME --key-uuid KEY_UUID eaescrypt decrypt ENCRYPTED_FILE_NAME --key-uuid KEY_UUID To provide a passphrase, use the --key-passphrase option: eaescrypt encrypt ENTRY_NAME --key-passphrase When encrypting, EAESCrypt will prompt the user to provide a passphrase. The user must provide the passphrase twice and this passphrase will be used to generate an encryption key. This option is not available for decrypting because EAESCrypt will automaticaly know that the file was encrypted with a passphrase and will prompt the user to provide it for decrypting. THE KEYS DATABASE EAEScrypt has a module to manage a Keys Database. It can store keys and use them to encrypt or decrypt files. The environment variable KEYPATH contains the path in which the database files are stored. This variable can be either a per user environment variable or a global variable. The adopted security policy shall guide on how the Keys Database will be managed. Every key stored in the Keys Database receives a unique identifier (UUID). When an entry is encrypted using a key from the database, the output file receives this identifier. That's how EAEScrypt knows what key must be used to decrypt the file. The default key to be used to encrypt entries is allways the last key either created or stored in the database. You can also specify other key by its identifier, using the command line option --key-uuid. The Keys Database exists in the scope of your own machine (or even of your user only, depending on the scope of the environment variable KEYPATH). But sometimes you must save a key in an external media, or send it to someone else to decrypt the files you have encrypted. To do so, you must export the key from your database into a file and deliver it to the recipient. The recipient can either use this key to decrypt your files using the command line option --key-file or can import it to its own Key Database using the command line option --import-key. You must manage key files with extreme care. They contain sensitive information that should not be lost, neither fall into the hands of others. GENERATING RANDOM KEYS The use of random keys provides a degree of safety that is proportional to the size of the key. Random keys are difficult to guess, and brutal force is the only known method to break it. However random numbers are rare in computer systems. Software systems actually generate pseudo-random sequences of numbers. The same way a random key provides security, a pseudo-random key provides pseudo-security. Even if your key is quite large (eg, 2048 bits), an attacker can reproduce it generating the same sequence with the same seed. The attacker needs only to guess that seed, which is usually a 32-bit number. Your huge key is in fact only a 32-bit key. Still, not all of these bits are truly random. Depending on how you get that seed, the number used can follow some sort of pattern that will make some of these bits practically constant. The attacker must guess just a set of 16 to 24 bits. The automatic key generation of EAEScrypt uses pseudo-random sequences of bytes, but it uses as seed a sequence of values that have a certain degree of randomness. The sources used for the generation of the seed are: - The current date and time, in millisecond precision; - The process ID obtained from the operating system; - The memory position occupied by the process; - The system time ticks counter for the process. For a 32 bit system, this combination provides a degree of randomness of about 88 bits. Another way to produce a random key is from a sequence of keystrokes typed by the user. This sequence is used as a seed for generating a 1792-bit key. EAEScrypt has the option --truly-random to do this. Each character typed by the user is converted to a value from 0 to 15. The values of the characters are scrambled in a pseudo-random way. This means that each character represents a user-supplied random sequence of 4 bits. If the user enters, for instance, 50 characters, so the seed will be a random sequence of 200 bits. The degree of randomness will depend solely on how random were the user keystrokes. Even if the user follows a certain pattern of typing, the 4-bit conversion for each key increases the degree of randomness of the seed. The randomness is in the sense that it is virtually impossible for an attacker to reproduce the same sequence typed by the user and scramble them on the same way. The maximum size of the random seed shall be the size of the generated key itself. It's the maximum randomization rate that you can obtain. Seeds larger than this don't improve security. Note that the sequence of typed characters is the seed for the key, not the key itself. This means that if you generate another key by repeating exactly the same sequence of typed characters, EAESCrypt will generate a new key different from the previous. FORMAT OF THE ENCRYPTED DATA EAEScrypt writes the encrypted data into an RC4 Formatted File with ARK Data Format for Archiving. This file format holds many metadata information about the encryption: - The name and version of the application that was used for encryption; - The date and time the file was created; - The identification of the key used to encrypt the file (UUID); - Its own identification (UUID) - every generated file receives a unique identifier; - The archive data MIME-Type. The following information are also stored for each archived file: - The original path and name of the encrypted file; - The size of the original file; - The date and time of the original file. These information are encrypted together with the file data, which means that they're not available if you don't have the correct decryption key. EAEScrypt encrypts files using an extended version of the Advanced Encryption Standard (AES), with the operating mode Cipher-Block Chaining (CBC). The first 16 bytes of the data are the initialization vector. The following bytes are the encrypted data grouped into blocks of 16 bytes. The total amount of bytes of the encrypted data is multiple of 16. EAESCrypt inserts a random ammount of trailing blocks at the end of the archive file. The actual amount of bytes of each decrypted file must be obtained from the corresponding identifier from the file. EAESCrypt ensures the integrity of the decrypted files using SHA-256 checksum for each file. The SHA-256 checksum are also encrypted together with each file, ensuring its security. THE CONCEPT OF EXTENDED ALGORITHM The extended version of AES (EAES) allows to control the algorithm parameters beyond the officially defined values. These parameters are: Nb = Block size; Nk = Key size; Nr = Number of rounds. According to the specification of the Federal Information Processing Standard for AES (FIPS-197), there is a limited set of valid values for these parameters. Values outside this range are not compatible with FIPS-197 specification and should be considered "unofficial". AEScript uses the following values for these parameters: Nb = 4 (128-bit blocks); Nk can vary from 4 (128-bit key) to 64 (2048-bit key); The value of Nr depends on the size of the key, varying from 10 to 16. To generate files compatible with the FIPS-197, you must use 128-bit key (Nk = 4), 192-bit key (Nk = 6) or 256-bit key (Nk = 8). EAEScrypt can use any key size from 128-bit to 2048-bit. Although larger keys make the algorithm more secure, they also make it slower. COMPATIBILITY WITH OLDER VERSIONS The version 2.00 of EAESCrypt is NOT compatible with older versions. This is because the encryption algorithm has undergone some changes to improve performance, without compromising its security. The resulting encryption is still the same for keys up to 1792 bits, which ensures the compatibility with FIPS-197 for 128, 192 and 256-bit keys. But the version 2.00 only recognizes files encrypted with the type "ENCRYPTED ARK", which means that it cannot decrypt files generated by previous versions, even with low sized keys. To decrypt files with older versions, you must use EAESCrypt version 1.20, wich recognizes the types "ENCRYPTED" and "ENCRYPTED EMB". You are encouraged to decrypt all your files encrypted with older versions and re-encrypt them with the new version of EAESCrypt. ENCRYPTS ENTRIES The command line "encrypt" encrypts the input entry with the options provided. The entry can be either a file or a folder. If the entry is a folder, then encrypts all its subfolder structure and files into a single output encrypted file. The options for encrypt are: eaescrypt encrypt INPUT-ENTRY [--output-file OUTPUT-FILE] \ [--key KEY | --key-file KEY-FILE | --key-uuid KEY-UUID \ | --key-passphrase] \ [--keygen [--truly-random]] [--key-size KEY-SIZE] \ [--zlib-compress [--zlib-level LEVEL]] \ [--overwrite] [-verbose] [--pause] Some options can be provided in either the complete or the short way. The options are described below: --output-file, -o The output file to where the resulting data is written. This option must be followed by the output file name. If omitted, the name of the output file will be equal to the entry, followed by the suffix ".eaes". --key, -k --key-file, -kf --key-uuid, -ku --key-passphrase, --key-password, -kp Defines what will be the key used to encrypt the input file. The option --key must be followed by the key in plaintext. The option --key-file must be followed by the name of a file. The contents of this file will be used as the key. The option --key-uuid must be followed by the UUID of the key recorded in the Keys Database. The option --key-passphrase will make the EAESCrypt ask the user to provide a passphrase. It will use this passphrase as a seed to generate a key for the encryption. If none of these arguments is provided, then it will be used the last key recorded in the Keys Database. If the database is empty, or if the last key has been deleted, then a new random key is generated. --keygen, -kg Generates a new pseudo-random key, stores it in the Keys Database as the default key and uses it to encrypt the file. The key size is 1792 bits, unless another value has been provided by the --key-size. --truly-random, -tr This option must be used with --keygen. If provided, generates a key that uses as seed a random sequence of keystrokes typed by the user. To do this, the user must type a sequence of any characters that should include lowercase letters, uppercase letters, numbers and symbols in a scrambled order. The value of this sequence does not matter and should be as random as possible. The generated key is quite close to a truly random sequence. --key-size, -ks This option, used in conjunction with --keygen defines the key size to be created (in bits). This size should be at least 128 and at most 2048. If not provided, the default value 1792 is assumed. --zlib-compress, -z Compress the files before encrypting, using the ZLIB Compressed Data Format. With this option the resulting file can be generated with a smaller size. --zlib-level, -zl This options must be used in conjunction with --zlib-compress. It must be followed by a number from 0 to 9 that represents the compression level used by the ZLIB compression algorithm. A value 0 means that no compression will be performed, and a value of 9 means the highest level of compression. If ommited, the default value 6 is assumed. --overwrite, -ow If there is already a file with the same name as the output file, then overwrites it. The default is to not overwrite the output file and return an error. --verbose, -v Shows the progress of the encryption on the standard output (stdout). --pause, -p In the event of an error, waits for the user to press to continue. DECRYPTS FILES The command line "decrypt" decrypts the file ENCRYPTED-FILE into the original entries that have been encrypted. If the original entry is a folder, restores all its subfolder structure and files. The options for decrypt are: eaescrypt decrypt ENCRYPTED-FILE [--key KEY | --key-file KEY-FILE \ | --key-uuid KEY-UUID] [--overwrite] [--verbose] [--pause] Some options can be provided in either the complete or the short way. The options are described below: --key, -k --key-file, -kf --key-uuid, -ku Defines what will be the key used to decrypt the input file. The option --key must be followed by the key in plaintext. The option --key-file must be followed by the name of a file. The contents of this file will be used as the key. The option --key-uuid must be followed by the UUID of the key recorded in the Keys Database. If none of these arguments is provided and the input file has been encrypted with passphrase, the user will be asked to provide the correct passphrase. If not, then it will be used the key from the Keys Database with the same UUID of the one used to encrypt the file. If this key is not found in the database then an error is returned. --overwrite, -ow If there is already an entry with the same name as the output entry (either a file or a folder), then overwrites it. If the entry is a folder, then it will overwrite every file in the folder structure that has the same path and name. The default is to not overwrite the output entry and return an error. --verbose, -v Shows the progress of the decryption on the standard output (stdout). --pause, -p In the event of an error, waits for the user to press to continue. KEYS DATABASE MANAGEMENT The command line "keymgr" manages the keys stored in the Keys Database. The environment variable KEYPATH determines where the files of the Keys Database will be recorded. The options for keymgr are: eaescrypt keymgr [--keygen [--truly-random] [--key-size KEY-SIZE]] \ [--export-key KEY-FILE [--key-uuid KEY-UUID] [--overwrite]] \ [--export-file-key FILE [--overwrite]] \ [--import-key KEY-FILE] \ [--erase-key --key-uuid KEY-UUID] \ [--remove-key KEY-FILE ] \ [--key-count] [--key-index] \ [--restore-database] \ [--verbose] [--pause] Some options can be provided in either the complete or the short way. The options are described below: --keygen, -kg Generates a new pseudo-random key and stores it in the Keys Database. This key becomes the default key used to encrypt data files. The key size is 1792 bits, unless another value has been provided by the --key-size. --truly-random, -tr This option must be used with --keygen. If provided, generates a key that uses as seed a random sequence of keystrokes typed by the user. To do this, the user must type a sequence of any characters that should include lowercase letters, uppercase letters, numbers and symbols in a scrambled order. The value of this sequence does not matter and should be as random as possible. The generated key is quite close to a truly random sequence. --key-size, -ks This option, used in conjunction with --keygen defines the key size to be created (in bits). This size should be at least 128 and at most 2048. If not provided, the default value 1792 is assumed. --export-key Exports a key from the Keys Database into the given file. If a key identifier is given by the parameter --key-uuid, exports this key. Otherwise, exports the default key. The output file is saved in the RC4 Format. --key-uuid, -ku Sets the UUID of the key to be exported or erased. --overwrite, -ow If there is already a file with the same name as the key file, then overwrites it. The default is to not overwrite the key file and return an error. --export-file-key Exports from the Keys Database the key that was used to encrypt the given file. --import-key Imports the contents of a file into the Keys Database. If the file is in RC4 Format, it uses the key identifier of the file. Otherwise, it generates a new identifier. --erase-key Erases the contents of the key from the Keys Database with the identifier given by the parameter --key-uuid. HANDLE THIS OPTION WITH CARE! If a key is lost, you can no longer decrypt files that was encrypted with it. --remove-key Removes the key identified in the KEY-FILE from the Keys Database. This is a safer way to remove a key from the Keys Database, because the key still remains in the KEY-FILE file and can be later imported through the command --import-key. It's a good security practice to always remove the keys from the Keys Database after using them and securely store them in files on removable media. --key-count, -kc Displays at the standard output (stdout) the total number of keys stored in the Keys Database. --key-index, -ki This option must be followed by a number representing the index key stored in the Keys Database. This number must range from 0 to the total number of keys stored minus 1. It displays at the standard output (stdout) the identifier of the key stored at the given position. --restore-database This option should be used if the Keys Database is corrupted. It attempts to retrieve the control data searching the keys stored in it. --verbose, -v Shows the progress on the standard output (stdout). --pause, -p In the event of an error, waits for the user to press to continue. FILE INFORMATION The command line "info" retrieves the metadata information about encrypted files or key files. In fact, it can retrieve the information about any file in the RC4 Format. The options for info are: eaescrypt info INPUT-FILE... [--pause] Some options can be provided in either the complete or the short way. The options are described below: --pause, -p Waits for the user to press after printing the file info. RESERVED IDENTIFIERS It was assigned to EAESCryt the following Universally Unique IDentifier: {ecd917bc-658d-491c-4f72-44cbf13e47ca} EAESCrypt recognises that an encrypted archive file has used a passphrase if its KEY-ID is the following: {48858123-6d2c-4858-6e0d-ba82b0c70b55} ENVIRONMENT VARIABLES KEYPATH Defines where the files of the Keys Database will be stored. AUTHOR Written by D. Endler. COPYRIGHT Extended AES 2.00 Copyright (c) 2013 Dalen Knowledge Systems under the terms of the GNU Lesser General Public License Key Manager v1.3 Copyright (c) 2013 Dalen Knowledge Systems under the terms of the GNU Lesser General Public License sha224-256 Copyright (c) 2011 IETF Trust and the persons identified as authors of the code. All rights reserved. sha384-512 Copyright (c) 2011 IETF Trust and the persons identified as authors of the code. All rights reserved. miniz v9.1.14 Copyright (c) 2012 Rich Geldreich under the terms of the Unlicense. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . The authors of EAESCrypt disclaim any liability for any way out of the use of this software, including but not limited to loss of data, use or profits, business interruption, leakage of sensitive information, use for any illicit or illegal purposes, or even the usage not in accordance with the law. SEE ALSO Refer to the RC4 File Format Specification for more details about the format of the output files from EAEScrypt. Refer to the FIPS-197 specification from NIST for more information about the Advanced Encryption Standard algorithm. Refer to NIST Special Publication 800-38A for recommendations for Block Cipher Modes of operation, specifically the Cipher Block Chaining mode. Refer to the Wassenaar Arrangement at for more information about restrictions for the use of EAESCrypt.