How Linux uses the OpenSSL command line

  
                

OpenSSL is a command-line tool. Linux can use OpenSSL for some command-line related work. How do Linux use the OpenSSL command line? The following small series will give you a detailed introduction to the use of the OpenSSL command line.

1. base64 encoding /decoding

Speaking at the command line how to send e-mail attachments, many people think of uuencode. You can also use base64 encoding. The following is the use of openssl base64 encoding/decoding:

$ openssl base64 " filename.bin " filename.txt

$ openssl base64 -d " filename.txt " filename.bin

2. Verify file consistency

There are many ways to verify file consistency under UNIX, such as sum, cksum, md5sum, sha1sum, etc. Sum and cksum are suitable for simple verification, and the generated check code is easy to repeat. Md5sum has a security vulnerability. The current recommendation is sha1sum. However, sha1sum is somewhat different in different platforms. Considering cross-platformity, it is recommended to use openssl.

$ openssl sha1 filename

SHA1(filename)= e83a42b9bc8431a6645099be50b6341a35d3dceb

$ openssl md5 filename

MD5(filename)= 26e9855f8ad6a5906fea121283c729c4

3. File Encryption/Decryption

OpenSSL supports many encryption algorithms, but some algorithms are only for backward compatibility and are not recommended now, such as DES and RC4-40. The recommended encryption algorithms are bf (Blowfish) and -aes-128-cbc (128-bit key AES encryption algorithm running in CBC mode), and the encryption strength is guaranteed.

Encryption example:

$ openssl enc -aes-128-cbc " filename " filename.aes-128-cbc

enter aes-128-cbc encryption password:< Br>

Verifying - enter aes-128-cbc encryption password:

Decryption example:

$ openssl enc -d -aes-128-cbc -in filename.aes-128- Cbc ” filename

enter aes-128-cbc decryption password:
Previous12Next page Total 2 pages

Copyright © Windows knowledge All Rights Reserved