一、Openssl常用命令:
# openssl ? # 查看openssl的命令及子命令 # man enc # 可以直接查看子命令帮助加密:
# openssl enc -des3 -e -salt -in /lee/sh/test.sh -out /lee/sh/test.sh.des3 -des3:指定加密算法,可以在openssl ?中查看支持的加密算法 -e:加密,缺省参数 -salt:加盐 -in:输入文件,也就是要加密的文件 -out:输出文件,也就是加密后的密文 enter des-ede3-cbc encryption password: # 输入加密密码 Verifying - enter des-ede3-cbc encryption password: #确认输入加密密码解密:
# openssl enc -des3 -d -salt -in /lee/sh/test.sh.des3 -out /lee/sh/test1.sh -d:解密 enter des-ede3-cbc decryption password:散列:
# md5sum /lee/sh/test.sh # 用MD5散列 590c2fdc61a76337dd2e1df91a217a27 /lee/sh/test.sh # sha1sum /lee/sh/test.sh # SHA1散列 40554fd040b5a54821280603a67e5c07818aff65 /lee/sh/test.sh # openssl dgst -sha1 /lee/sh/test.sh # 用openssl命令进行SHA1散列 SHA1(/lee/sh/test.sh)= 40554fd040b5a54821280603a67e5c07818aff65 # openssl dgst -md5 /lee/sh/test.sh # 用openssl命令进行MD5散列 MD5(/lee/sh/test.sh)= 590c2fdc61a76337dd2e1df91a217a27 # openssl dgst -? # 这样可以输出支持的命令 unknown option '-?' options are -c to output the digest with separating colons -r to output the digest in coreutils format -d to output debug info -hex output as hex dump -binary output in binary form -hmac arg set the HMAC key to arg -non-fips-allow allow use of non FIPS digest -sign file sign digest using private key in file -verify file verify a signature using public key in file -prverify file verify a signature using private key in file -keyform arg key file format (PEM or ENGINE) -out filename output to filename rather than stdout -signature file signature to verify -sigopt nm:v signature parameter -hmac key create hashed MAC with key -mac algorithm create MAC (not neccessarily HMAC) -macopt nm:v MAC algorithm parameters or key -engine e use engine e, possibly a hardware device. -md4 to use the md4 message digest algorithm -md5 to use the md5 message digest algorithm -ripemd160 to use the ripemd160 message digest algorithm -sha to use the sha message digest algorithm -sha1 to use the sha1 message digest algorithm -sha224 to use the sha224 message digest algorithm -sha256 to use the sha256 message digest algorithm -sha384 to use the sha384 message digest algorithm -sha512 to use the sha512 message digest algorithm -whirlpool to use the whirlpool message digest algorithm郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。