You are on page 1of 3

Report:

Working with OPENSSL Framework.


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:

Encrypted message.

4. Decrypting the message:

You might also like