当前位置:网站首页>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

边栏推荐
- Orasi: 1 vulnhub walkthrough
- [trendsoft/capital]金额转中文大写库
- 一次代码审计的笔记(CVE-2018-12613 phpmyadmin文件包含漏洞)
- [campo/random-user-agent] Randomly fake your User-Agent
- 16. JS events, string and operator
- Introduction to PHP (self-study notes)
- ES6 array extension methods map, filter, reduce, fill and array traversal for…in for…of arr.forEach
- Eric靶机渗透测试通关全教程
- hackmyvm-hopper预排
- 16.JS事件, 字符串和运算符
猜你喜欢

(1) introduction to Thinkphp6, installation view, template rendering, variable assignment

动力:2 vulnhub预排

hackmyvm: controller walkthrough

hackmyvm-random walkthrough

PHP Foundation March Press Announcement Released

Offensive and defensive world - novice MISC area 1-12

一个网络安全小白鼠的学习之路——nmap的基本使用

(1)Thinkphp6入门、安装视图、模板渲染、变量赋值

TCP communications program

Solve the problem of Zlibrary stuck/can't find the domain name/reached the limit, the latest address of Zlibrary
随机推荐
3. PHP data types, constants, strings and operators
Introduction to PHP (self-study notes)
17. JS conditional statements and loops, and data type conversion
(1) print()函数、转义字符、二进制与字符编码 、变量、数据类型、input()函数、运算符
敏感信息泄露
[campo/random-user-agent] Randomly fake your User-Agent
DVWA靶机安装教程
Several interesting ways to open PHP: from basic to perverted
hackmyvm: may walkthrough
CSRF(跨站请求伪造)
PHP realizes the automatic reverse search prompt of the search box
(3)Thinkphp6数据库
[symfony/finder] The best file manipulation library
[phpunit/php-timer]一个用于代码执行时间的计时器
Eric靶机渗透测试通关全教程
Solve the problem of uni - app packaged H5 website to download image
ES6 array extension methods map, filter, reduce, fill and array traversal for…in for…of arr.forEach
Pycharm打包项目为exe文件
hackmyvm-bunny预排
一个网络安全小白鼠的学习之路——nmap的基本使用