当前位置:网站首页>OPENSSL基本实验以及OPENSSL详解
OPENSSL基本实验以及OPENSSL详解
2022-08-02 03:25:00 【CHIAJ176】
OPENSSL用法详解
对称加密和非对称加密详解
实验环境
一台Centos 7.2 已经安装openssl组件
实验原理
openssl是Linux内置的一款开源工具,实现了常见的密码算法与应用。通过openssl操作,完成各种密码算法的应用。
实验步骤
创建一个文件,用于被加密,文件内容为12345,文件名为test.txt
echo 12345 >test.txt
一、对称加密
1、使用rc4加解密
加密openssl enc -e -rc4 -in test.txt -out test_rc4.enc
解密openssl enc -d -rc4 -in test_rc4.enc -out test_rc4.dm
2、使用AES加解密
openssl enc -e -aes-128-cbc -a -salt -in test.txt -out test_aes128.enc
解密
openssl enc -d -aes-128-cbc -a -salt -in test_aes128.enc -out test_aes128.d
3、使用3DES加解密
加密openssl enc -e -des3 -a -salt -in test.txt -out test_des3.enc
解密openssl enc -d -des3 -a -salt -in test_des3.enc -out test_des3.d
二、非对称加密
1、RSA加解密码
生成RSA密钥对
openssl genrsa -out rsa.key 1024
导出公钥
openssl rsa -in rsa.key -pubout -out rsa_pub.key
使用公钥加密文件
openssl rsautl -encrypt -in test.txt -inkey rsa_pub.key -pubin -out test_rsa.enc
使用私解解密文件
openssl rsautl -decrypt -in test_rsa.enc -inkey rsa.key -out test_rsa.c
使用公钥解密报错
openssl rsautl -decrypt -in test_rsa.enc -inkey rsa_pub.key -out test_rsa.c
边栏推荐
- Function hoisting and variable hoisting
- 17. JS conditional statements and loops, and data type conversion
- What are the killer super powerful frameworks or libraries or applications for PHP?
- 动力:2 vulnhub预排
- [symfony/mailer] An elegant and easy-to-use mail library
- About the apache .htaccess file of tp
- When PHP initiates Alipay payment, the order information is garbled and solved
- PHP realizes the automatic reverse search prompt of the search box
- Alfa: 1 vulnhub walkthrough
- Baidu positioning js API
猜你喜欢
hackmyvm-hopper walkthrough
CTF入门笔记之ping
TypeScript error error TS2469, error TS2731 solution
(2) 顺序结构、对象的布尔值、选择结构、循环结构、列表、字典、元组、集合
13. JS output content and syntax
Thread Pool (Introduction and Use of Thread Pool)
CTF入门之md5
hackmyvm-bunny walkthrough
Phpstudy installs Thinkphp6 (problem + solution)
Offensive and defensive world - novice MISC area 1-12
随机推荐
2.PHP变量、输出、EOF、条件语句
hackmyvm-hopper walkthrough
CTF入门之md5
[symfony/mailer]一个优雅易用的发送邮件类库
[phpunit/php-timer] A timer for code execution time
Advanced Operations on Arrays
What will be new in PHP8.2?
The roll call system and array elements find maximum and minimum values for sorting of objects
(1) the print () function, escape character, binary and character encoding, variables, data type, the input () function, operator
[symfony/finder]最好用的文件操作库
[campo/random-user-agent] Randomly fake your User-Agent
战场:3(双子叶植物)vulnhub走读
Offensive and defensive world - novice MISC area 1-12
[sebastian/diff]一个比较两段文本的历史变化扩展库
[phpunit/php-timer]一个用于代码执行时间的计时器
Using PHPMailer send mail
IO stream, encoding table, character stream, character buffer stream
(4) Function, Bug, Class and Object, Encapsulation, Inheritance, Polymorphism, Copy
Turn trendsoft/capital amount of Chinese capital library
Stable and easy-to-use short connection generation platform, supporting API batch generation