Chinaunix首页 | 论坛 | 博客
  • 博客访问: 347254
  • 博文数量: 222
  • 博客积分: 9349
  • 博客等级: 中将
  • 技术积分: 2135
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-07 13:45
文章分类

全部博文(222)

文章存档

2010年(222)

分类: LINUX

2010-08-08 11:51:53

# display currently version
openssl version
# openssl list-message-digest-commands
openssl dgst -sha1 file #(sha1,md5 etc.)
openssl md5 < file  <==>  md5sum file
openssl sha1 < file <==>  sha1sum file

# openssl list-cipher-commands
man openssl >> to see more details about enc ==> man enc <== u can see more!
# asn1parse(1), ca(1), config(5), crl(1), crl2pkcs7(1), dgst(1),
# dhparam(1), dsa(1), dsaparam(1), enc(1), gendsa(1), genrsa(1), nseq(1),
# openssl(1), passwd(1), pkcs12(1), pkcs7(1), pkcs8(1), rand(1), req(1),
# rsa(1), rsautl(1), s_client(1), s_server(1), s_time(1),
# smime(1),spkac(1), verify(1), version(1), x509(1), crypto(3),ssl(3)

# To encrypt a file named file.txt with a password, using triple DES in CBC
# mode,stored base64 encoded:
openssl enc -des3 -e -a -salt -in file.txt -out file.des3
# To decrypt the resulting file.des3 file:
openssl enc -des3 -d -a -salt -in file.des3 -out file.txt

#EXAMPLES:
#Just base64 encode a binary file:
openssl base64 -in file.bin -out file.b64
#Decode the same file:
openssl base64 -d -in file.b64 -out file.bin

#Encrypt a file using triple DES in CBC mode using a prompted password:
openssl des3 -salt -in file.txt -out file.des3
#Decrypt a file using a supplied password:
openssl des3 -d -salt -in file.des3 -out file.txt -k mypassword

#Encrypt a file then base64 encode it (so it can be sent via mail for  example) using Blowfish in CBC mode:
openssl bf -a -salt -in file.txt -out file.bf 
#Base64 decode a file then decrypt it:
openssl bf -d -salt -a -in file.bf -out file.txt

阅读(1054) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~