# OpenSSL 101 (1)
Servus! This is DerRoteMilan. I have been thinking about the kind of threads you guys might enjoy and what came to mind was: All GUI options for encryption kinda suck. So I thought let's make a quick

var unreadAlerts = '1';
Welcome back, purely_cabbage. You last visited: Today, 06:36 AM Log Out
You have one unread private message from dkota titled Welcome to the Forum!
New Reply

Threaded Mode OpenSSL 101

DerRoteMilan
Active Member
Posts:
31
Threads:
5
Joined:
Jun 2023
Reputation:
19
Credits: 0.67€ [Donate]
#1
06-08-2023, 06:56 AM
Servus! This is DerRoteMilan.
I have been thinking about the kind of threads you guys might enjoy and what came to mind
was: All GUI options for encryption kinda suck.
So I thought let's make a quick cheat sheet thread about how to use the CLI of OpenSSL to do some
common tasks. No bulk, no bad looking Qt-Interface, no spyware added, just plain OpenSSL.
RSA:
To generate a private rsa key with 8198 bytes in size you can use the following command:
Code:
`$ openssl genrsa -out private_key.pem 8198`
To create the public key, that you can share everywhere, from the generated private key, you can use:
Code:
`openssl rsa -in private_key.pem -out public-key.pem -outform PEM -pubout`
To encrypt a file using someones public key you can use:
Code:
`$ openssl rsautl -encrypt -inkey public-key.pem -pubin -in file.txt -out file.txt.rsa`
To decrypt something that was encrypted for you, meaning with your public key, use:
Code:
`$ openssl rsautl -decrypt -inkey key.pem -in file.txt.rsa -out file.txt`
Hashing:
hash values are often used online to ensure a file you downloaded was not modified by someone else than the author
or also to make sure it has not been corrupted during network transfer.
Here are some of the most common commands or algorithms used for that:
Code:
`$ md5sum <file>
$ sha1sum <file>
$ sha256sum <file>
$ sha512sum <file>`
Symmetric Encryption:
To encrypt a file using a password AES is commonly used. You can use the following command for that:
Code:
`$ openssl aes-256-cbc -e -a -in file.txt -out file.aes`
:
Note here:
- -a will output base64 encoded
- The user will be prompted for a password, it is not specified as a command line argument
To decrypt the file using the same password again, use:
Code:
`$ openssl aes-256-cbc -d -a -in file.aes -out file.txt : decrypt a file using aes`
Thanks for reading!
Hope this thread has been helpful to some of you.
I have 2 other more in depth threads in the making about RATs and about binary exploitation.
Let me know what kind of topic you would like me to write about!
Also let me know about the style of the Thread.
Do you like it short and snappy or would you like more prose text to go along with it.
Feel free to have a chat with me also: derrotemilan@xmpp.is
PM Rate
Report

« Next Oldest | Next Newest »

New Reply

Quick Reply
Message Type your reply to this message here. Signature Disable Smilies | You have selected one or more posts to quote. Quote these posts now or deselect them.

- Subscribe to this thread

Users browsing this thread: purely_cabbage
var thread_deleted = "0"; if(thread_deleted == "1") { $("#quick_reply_form, .new_reply_button, .thread_tools, .inline_rating").hide(); $("#moderator_options_selector option.option_mirage").attr("disabled","disabled"); }