tar程序沒有安裝,如果是你自己安裝的tar工具,那麼請務必將其添加到環境變數中,以便使用,如果是使用系統的命令安裝:如:ubuntu上使用apt-get命令、centos、redhat上使用yum命令等等,那麼就不需要添加環境變數,因為系統默認的安裝路徑在環境變數中·
zip -e aa.zip aa.log
zip -er aa.zip tmp
unzip aa.zip
unzip -P passwork filename.zip ##passwork是要解壓的密碼,這個不會有提示輸入密碼的操作
unzip aa.zip
unzip -P passwork filename.zip ##passwork是要解壓的密碼,這個不會有提示輸入密碼的操作
tar-czvf /path/to/aa.tar.gz /path/to/aa.log
tar -xzvf /path/to/aa.tar.gz /path/to/
tar -czvf-file tmp | openssl des3 -salt -k 123456 -out aa.tar.gz
openssldes3 -d -k 123456 -salt -in aa.tar.gz | tar xzf -
openssl enc -aes-128-cbc
-in install.log -out enc.log
(註:這里install.log是你想要加密的文件,enc.log是加密後的文件,回車後系統會提示你輸入密碼。)
openssl enc -d -aes-128-cbc -in enc.log -out install.log
(註:enc.log是剛才加密的文件,install.log是解密後的文件,-d選項實現解密功能。)
openssl enc -aes-128-cbc -in install.log -out enc.log -a
openssl enc -des-ede3-cbc -in install.log -out enc.log -pass pass:111111
1、openssl genrsa -out client.key 2048 #生成私鑰
2、openssl rsa -in client.key -pubout -out pub.key #從密鑰文件中提取公鑰
3、openssl rsautl -encrypt -inkey pub.key -pubin -in data.zip -out back.zip。 #利用公鑰進行加密;
4、openssl rsautl -decrypt -inkey rsa.key -in back.zip -out data.zip. #利用私鑰對文件進行解密;
可能會報錯:
RSA operation error:
3020:error:0406D06E:rsa routines:RSA_padding_add_PKCS1_type_2:data too largefor key size:.\crypto\rsa\rsa_pk1.c:151:
利用smile進行操作:
加密:
openssl smime -encrypt -aes256 -in in.zip -binary -outform DEM -out in_encrypted.zip publickey.pem
解密:
openssl smime -decrypt -in in_encrypted.zip -binary-inform DEM -inkey privatekey.pem -out in.zip
⑶ linux tar 加密為什麼要用openssl
將文件夾package打成tar包 package.tar.gz 並加密
密碼是 password
tar czf – package | openssl des3 -salt -kpassword -out package.tar.gz
加密的tar包只能在Linux上解密,無法在Windows上使用。
解密tar包並且解壓縮
openssl des3 -d -k password -salt -in package.tar.gz | tar xzf -
其中 -k password 可以不使用,這樣執行完命令後會提示你輸入,加上 -k參數可運用在程序中,這樣可自動設置密碼。
⑷ tar文件如何解密(不會的不要搶不然給差評)
假定在當前目錄下有一個文件夾/stuff:
1、使用tar壓縮加密:
$ tar -zcvf - stuff|openssl des3 -salt -k secretpassword | dd of=stuff.des3
將得到一個 stuff.des3文件,用你的密碼替換secretpassword,切勿搞忘了
2、使用tar對加密文件解壓
$ dd if=stuff.des3 |openssl des3 -d -k secretpassword|tar zxf -
特別注意, 命令最後有一"-",它將釋放所有的文件。
⑸ 編譯時缺少openssl/md5.h該怎麼處理
最近需要安裝openssl,需要使用openssl/md5.h這個頭文件,可是使用Ubuntu的apt-get install openssl安裝,沒有這個文件,連urs/include/openssl都沒,經過一天的查找資料都沒解決,最後想到了使用源碼安裝openssl,最終解決了。
參考 http://www.linuxidc.com/Linux/2011-10/45738.htm
OpenSSL 是一款開源的 SSL 軟體包,採用 SSL 的公開密鑰技術,用於實現傳輸層的通信加密功能。OpenSSL 支持 Linux、Windows、BSD、Mac 等平台,功能強大,包含豐富的密碼演算法庫,SSL 協議庫和應用程序。
一、SSL 基本常識 1.1、什麼是 SSL?
安全套接層(Secure Sockets Layer,SSL), 最初由 netscape 公司設計,建立在傳輸層的安全通信協議,採用公開密鑰體系的證書認證方式來確保客戶端和 SSL 伺服器之間的通信安全。
1.2、SSL 認證流程
SSL 客戶端在 TCP 連接建立之後,發出一個消息(包含了客戶端所支持的演算法列表)給伺服器端,然後伺服器端返回一個數據包(確定了這次通信所需演算法)和 SSL 伺服器端的證書(包含了公鑰)給客戶端。客戶端隨後會用收到的公鑰將消息加密再傳送,該加密消息只能用 SSL 伺服器端私鑰解密,即便中途被截取也無法獲知內容。
二、編譯安裝 OpenSSL 2.1、准備工作
系統版本:Ubuntu-10.10-Server-I386
更新源:apt-get update
升級軟體:apt-get upgrade
更新系統:apt-get dist-upgrade
2.2、查看OpenSSL版本
部分 Linux 系統已默認安裝了 OpenSSL 0.9.8,特別是 VPS 一般都安裝了。
openssl version -a
2.3、安裝基礎編譯環境
apt-get install build-essential
2.3、編譯安裝 Zlib 庫(這一步我沒有成功,但是也成功安裝了openssl)
wget http://zlib.net/zlib-1.2.5.tar.gz
tar -zxf zlib-1.2.5.tar.gz
cd zlib-1.2.5/
./configure --prefix=/usr/local
make && make install
2.4、卸載舊版本 OpenSSL
apt-get purge openssl
rm -rf /etc/ssl #刪除配置文件
2.5、編譯與安裝 OpenSSL
prefix 是安裝目錄,openssldir 是配置文件目錄,另外建議安裝兩次,shared 作用是生成動態連接庫。
wget ftp://ftp.openssl.org/source/openssl-1.0.0c.tar.gz
tar -zxf openssl-1.0.0c.tar.gz
cd openssl-1.0.0c/
./config --prefix=/usr/local --openssldir=/usr/local/ssl
make && make install
./config shared --prefix=/usr/local --openssldir=/usr/local/ssl
make clean
make && make
進一步的配置可參考《OpenSSL-0.9.8g 安裝與配置指南》http://www.linuxidc.com/Linux/2011-10/45737.htm
⑹ Ubuntu16.04 系統 openssl升級到1.1.0d後,調用openssl 命令報錯
1、將下載的壓縮包放在根目錄,
2、在文件夾下解壓縮,命令:tar -xzf openssl-openssl-1.0.0e.tar.gz,得到openssl-openssl-1.0.0e文件夾
3、進入解壓的目錄:cd openssl-1.0.0e
4、設定Openssl 安裝,( --prefix )參數為欲安裝之目錄,也就是安裝後的檔案會出現在該目錄下:
執行命令: ./config --prefix=/usr/local/openssl
5、執行命令./config -t
6.執行make,編譯Openssl
這里出現的錯誤
⑺ 怎麼查看openssl 是否支持tls sni
Nginx支持多域名SSL證書是需要OpenSSL庫支持的,CentOS5.X的OpenSSL庫本身不支持這種特性,需要重新下載編譯,步驟如下
wget https://www.openssl.org/source/old/0.9.x/openssl-0.9.8zh.tar.gz
tar zxvf ./openssl-0.9.8zh.tar.gz
cd ./openssl-0.9.8zh
./config enable-tlsext
make
make install
Nginx也要重新編譯,添加OpenSSL源碼的目錄
./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_stub_status_mole --with-http_ssl_mole --with-openssl=../openssl-0.9.8zh/