Introduction to OpenSSL/LibreSSL
Index
Introduction
This document aims to demonstrate the use of cryptographic mechanisms based on the OpenSSL/LibreSSL library. This library has the ability to work with cryptographic mechanisms such as symmetric cryptography, asymmetric cryptography, generation of message authentication codes as well as work with digital certificates and more.
To run these labs the following requirements are needed:
OpenSSL/LibreSSL.
The goal of these labs is to demonstrate the use of the OpenSSL library to provide a range of cryptographic functionality.
The examples presented here only demonstrate just a small sample of the full capabilities of OpenSSL.
Setup
There is nothing very relevant to do in terms of setup. You just need to install the OpenSSL library - if you use the Kali Linux distribution (or any other Linux distribution, such as Ubuntu, Debian or Parrot OS), it may already be installed by default.
On Windows, OpenSSL can be installed using for example the Cygwin software package. On MacOS, OpenSSL is installed by default, but if you need to use a newer version of it, you can use the Brew tool (https://brew.sh).
For Windows there are also other options that you can use. So, the main alternatives for installing OpenSSL on Windows 10/11, are as follows (from the simplest to the most complicated):
Use Chocolatey to install OpenSSL on Windows 10 with Powershell, or directly install the OpenSSL binary from the web site;
Use Windows Subsystem for Linux (WSL), which allows you to run Linux applications on Windows 10/11 - in practice it is like installing Linux on top of Windows 10/11;
Use a Linux distribution, inside a virtualization tool like VMware or VirtualBox, on top of Windows 10/11;
Any other, which may involve the use of containers such as Docker.
Regarding option 1, it is described in the following links:
Regarding option 2, it is explained in the following links:
Regarding option 3, it consists of:
Download a Linux distribution, such as Ubuntu
Download and install either VMware Workstation Player or VirtualBox on Windows 10/11. This site even has already prepared Ubuntu images to be installed in both virtualization environments;
Install the Linux distribution in the selected virtualization environment.
This page contains also important and relevant information on how to install OpenSSL on Windows. It provides a detailed step-by-step process on how to do it.
If you choose, you may also not install OpenSSL natively and use a web-based version that can be found here.
Basic commands
Here we will just list some of the basic commands for working with OpenSSL.
Check the OpenSSL version
OpenSSL interactive console access
Oldest versions of OpenSSL supported an interactive console mode, when the user invoked the openssl
command. Newer versions don't support it anymore.
Generic structure of OpenSSL application and commands
OpenSSL CLI application has the following structure of commands:
Where the command
is a set of commands supported by the OpenSSL CLI application, and options
is a set of options supported by a given command.
In order to know which options are supported by a given command, simply do:
Usually, each OpenSSL command supports general options
, input options
and output options
. Depending on the type of command, other specific options may be available.
Check the options for a particular command
Most of the times, it is also better to read the documentation on the OpenSSL website, since it is must more verbose than the information provided by the CLI.
Another important source of information about OpenSSL is the OpenSSL Cookbook, an online free book that covers diverse information about OpenSSL.
Last updated