The document discusses using the OpenSSL framework for symmetric encryption. It describes OpenSSL as a cryptography toolkit that implements SSL and TLS and supports encryption algorithms. It then outlines the steps to: 1) generate a random symmetric key using OpenSSL's rand command, 2) encrypt a message file in the sender's folder using the enc command with the key, and 3) decrypt the encrypted file in the receiver's folder using the same enc command and key.
The document discusses using the OpenSSL framework for symmetric encryption. It describes OpenSSL as a cryptography toolkit that implements SSL and TLS and supports encryption algorithms. It then outlines the steps to: 1) generate a random symmetric key using OpenSSL's rand command, 2) encrypt a message file in the sender's folder using the enc command with the key, and 3) decrypt the encrypted file in the receiver's folder using the same enc command and key.
The document discusses using the OpenSSL framework for symmetric encryption. It describes OpenSSL as a cryptography toolkit that implements SSL and TLS and supports encryption algorithms. It then outlines the steps to: 1) generate a random symmetric key using OpenSSL's rand command, 2) encrypt a message file in the sender's folder using the enc command with the key, and 3) decrypt the encrypted file in the receiver's folder using the same enc command and key.
OpenSSL is a cryptography toolkit implementing the Secure Socket Layer and the Transport Layer Security network protocols as well as various cryptography algorithms and functions. It supports many different cryptographic operations such as symmetric key encryption, public/private key pair generation…, each of them has a variety of options. openssl enc -ciphername [-help] [-ciphers] [-in filename] [-out filename] [-pass arg] [- e] [-d] [-a] [-base64] [-A] [-k password] [-kfile filename] [-K key] [-iv IV] [-S salt] [-salt] [-nosalt] [-z] [-md digest] [-iter count] [-pbkdf2] [-p] [-P] [-bufsize number] [-nopad] [-debug] [-none] [-rand file...] [-writerand file] [-engine id]
A. Symmetric Encryption using OpenSSL library
1. Getting familiar with the OpenSSL tool: We start by reviewing its manual to extract the relevant information on how to perform symmetric encryption.
a. Private Key Generation: The command to generate random data is:
rand -out <Key output file> <Key size> b. Encryption: The command to encrypt a file is: enc -<cipher> -in <input file> –out <Encrypted file> –k <Key> c. Decryption: The command to decrypt an encrypted file is: enc -<cipher> -in <input file> -d –out <Encrypted file> –k <Key>
2. Setting up the environment:
Our objective is to simulate a communication using symmetric encryption. To do so, we create separate folders for each entity involved (sender and receiver), and we generate a message file containing data to be transmitted. We then simulate the transaction by encrypting the message file in the sender's folder and transferring it to the receiver's folder for decryption. To begin, we must generate a random key that can be shared between the two entities. Since we are using symmetric encryption, the same key is used for both encryption and decryption processes. a. Generating the key: To generate a key for encryption and decryption, we can use different. For example, the "genrsa" command is specifically designed for generating RSA key pairs, which is an asymmetric encryption algorithm. However, since we only require a single key for symmetric encryption, we can use the "rand" command to write a sequence of random bytes to a file, which will serve as our symmetric key. 3. Encrypting the message: