苍南网站制作,手机怎么制作图文广告,西安个人做企业网站,竞价网站移动端使用 OpenSSL 工具进行密码明文的加密与解密
Written By: Xinyao Tian
简介
本文档描述了使用 OpenSSL 工具在 Bash 脚本中对密码进行加密和解密的简单方式。
BASE64 的加密与解密脚本
使用 Base64 算法进行密码的加密
脚本名称为 encryptPasswd.sh, 脚本内容如下:
#!/b…使用 OpenSSL 工具进行密码明文的加密与解密
Written By: Xinyao Tian
简介
本文档描述了使用 OpenSSL 工具在 Bash 脚本中对密码进行加密和解密的简单方式。
BASE64 的加密与解密脚本
使用 Base64 算法进行密码的加密
脚本名称为 encryptPasswd.sh, 脚本内容如下:
#!/bin/bash
# Script developed by Xinyao Tian on 2023/08/10echo INFO: Encrypting plain text password through $0passwd_plaintext$1passwd_encryptedecho $passwd_plaintext | openssl enc -base64echo INFO: Encrypted password is:echo $passwd_encrypted使用 Base64 算法进行密码的解密
脚本名称为 decryptPasswd.sh, 脚本内容如下:
#!/bin/bash
# Script developed by Xinyao Tian on 2023/08/10echo INFO: Decrypting encryped password through $0passwd_encrypted$1passwd_plaintextecho $passwd_encrypted | openssl enc -base64 -d echo INFO: Decrypted password is:echo $passwd_plaintext使用方法
检视目录中的脚本:
[flinkrtp0-tkldmp-rc01 ~]$ ls -l
total 8
-rwxr--r-- 1 flinkrt flinkrt 217 Aug 10 14:21 decryptPasswd.sh
-rwxr--r-- 1 flinkrt flinkrt 212 Aug 10 14:19 encryptPasswd.sh加密使用方法如下:
[flinkrtp0-tkldmp-rc01 ~]$ ./encryptPasswd.sh 123456
INFO: Encrypting plain text password through ./encryptPasswd.sh
INFO: Encrypted password:
MTIzNDU2Cg解密使用方法如下:
[flinkrtp0-tkldmp-rc01 ~]$ ./decryptPasswd.sh MTIzNDU2Cg
INFO: Decrypting encryped password through ./decryptPasswd.sh
INFO: Decrypted password is:
123456BASE64-withPassphrase 的加密与解密脚本
使用 BASE64-withPassphrase 算法进行密码的加密
脚本名称为 encryptPasswdWithKey.sh, 脚本内容如下:
#!/bin/bash# ------ #
# Script developed by Xinyao Tian on 2023/08/10
# Quick developed for Network Protection Operation 2023
# ------ #echo INFO: Encrypting plain text password through $0passwd_plaintext$1passphrase$2integrated_passwd$passphrase$passwd_plaintextpasswd_encryptedecho $integrated_passwd | openssl enc -base64echo INFO: Encrypted password is:echo $passwd_encrypted使用 Base64 算法进行密码的解密
脚本名称为 decryptPasswdWithKey.sh, 脚本内容如下:
#!/bin/bash# ------ #
# Script developed by Xinyao Tian on 2023/08/10
# Quick developed for Network Protection Operation 2023
# ------ #echo INFO: Decrypting encryped password through $0passwd_encrypted$1integrated_passwdecho $passwd_encrypted | openssl enc -base64 -d passphrase$2lengthOfPassphraseecho ${#passphrase}passwd_plaintextecho ${integrated_passwd: lengthOfPassphrase}echo INFO: Decrypted password is:echo $passwd_plaintext使用方法
检视目录中的脚本:
[flinkrtp0-tkldmp-rc01 ~]$ ls -l | grep WithKey
-rwxr--r-- 1 flinkrt flinkrt 341 Aug 10 14:56 decryptPasswdWithKey.sh
-rwxr--r-- 1 flinkrt flinkrt 281 Aug 10 14:52 encryptPasswdWithKey.sh加密使用方法如下:
[flinkrtp0-tkldmp-rc01 ~]$ ./encryptPasswdWithKey.sh 123456 ~HbATOlWRYD%Ja0WcOpQ9,mcK~YMLuP
INFO: Encrypting plain text password through ./encryptPasswdWithKey.sh
INFO: Encrypted password is:
fkhiQVRPbFdSWUQlSmEwV2NPcFE5LG1jSytWU1MdVAxMjM0NTYK解密使用方法如下:
[flinkrtp0-tkldmp-rc01 ~]$ ./decryptPasswdWithKey.sh fkhiQVRPbFdSWUQlSmEwV2NPcFE5LG1jSytWU1MdVAxMjM0NTYK ~HbATOlWRYD%Ja0WcOpQ9,mcK~YMLuP
INFO: Decrypting encryped password through ./decryptPasswdWithKey.sh
INFO: Decrypted password is:
123456BASE64-withFixedPassphrase 的加密与解密脚本
使用 BASE64-withFixedPassphrase 算法进行密码的加密
脚本名称为 encryptPasswdWithFixedKey.sh, 脚本内容如下:
#!/bin/bash# ------ #
# Script developed by Xinyao Tian on 2023/08/10
# Quick developed for Network Protection Operation 2023
# ------ #echo INFO: Encrypting plain text password through $0passwd_plaintext$1passphraseGMPHwOqsIoCsqaEAYIoSRWEfcfQ2kA52tFXDbtri0I8oW2cLARintegrated_passwd$passphrase$passwd_plaintextpasswd_encryptedecho $integrated_passwd | openssl enc -base64echo INFO: Encrypted password is:echo $passwd_encrypted使用 Base64 算法进行密码的解密
脚本名称为 decryptPasswdWithFixedKey.sh, 脚本内容如下:
#!/bin/bash# ------ #
# Script developed by Xinyao Tian on 2023/08/10
# Quick developed for Network Protection Operation 2023
# ------ #echo INFO: Decrypting encryped password through $0passwd_encrypted$1integrated_passwdecho $passwd_encrypted | openssl enc -base64 -d passphraseGMPHwOqsIoCsqaEAYIoSRWEfcfQ2kA52tFXDbtri0I8oW2cLARlengthOfPassphraseecho ${#passphrase}passwd_plaintextecho ${integrated_passwd: lengthOfPassphrase}echo INFO: Decrypted password is:echo $passwd_plaintext使用方法
检视目录中的脚本:
[flinkrtp0-tkldmp-rc01 ~]$ ls -l | grep WithKey
-rwxr--r-- 1 flinkrt flinkrt 341 Aug 10 14:56 decryptPasswdWithKey.sh
-rwxr--r-- 1 flinkrt flinkrt 281 Aug 10 14:52 encryptPasswdWithKey.sh加密使用方法如下:
[flinkrtp0-tkldmp-rc01 ~]$ ./encryptPasswdWithKey.sh 123456 ~HbATOlWRYD%Ja0WcOpQ9,mcK~YMLuP
INFO: Encrypting plain text password through ./encryptPasswdWithKey.sh
INFO: Encrypted password is:
fkhiQVRPbFdSWUQlSmEwV2NPcFE5LG1jSytWU1MdVAxMjM0NTYK解密使用方法如下:
[flinkrtp0-tkldmp-rc01 ~]$ ./decryptPasswdWithKey.sh fkhiQVRPbFdSWUQlSmEwV2NPcFE5LG1jSytWU1MdVAxMjM0NTYK ~HbATOlWRYD%Ja0WcOpQ9,mcK~YMLuP
INFO: Decrypting encryped password through ./decryptPasswdWithKey.sh
INFO: Decrypted password is:
123456AES256CBC-withFixedPassphrase 的加密与解密脚本
使用 AES256CBC-withFixedPassphrase 算法进行密码的加密
脚本名称为 encryptAES256.sh, 脚本内容如下:
#!/bin/bash# ------ #
# Script developed by Xinyao Tian on 2023/08/10
# Quick developed for Network Protection Operation 2023
# ------ #echo INFO: Encrypting plain text password through $0passwd_plaintext$1passwd_encryptedecho -n $passwd_plaintext | openssl enc -e -aes-256-cbc -a -salt -k SEvjsEbM7SHmI9Owecho INFO: Encrypted password is:echo $passwd_encrypted使用 Base64 算法进行密码的解密
脚本名称为 decryptAES256.sh, 脚本内容如下:
#!/bin/bash# ------ #
# Script developed by Xinyao Tian on 2023/08/10
# Quick developed for Network Protection Operation 2023
# ------ #echo INFO: Decrypting encryped password through $0passwd_encrypted$1passwd_plaintextecho $passwd_encrypted | openssl aes-256-cbc -a -d -salt -k SEvjsEbM7SHmI9Ow echo INFO: Decrypted password is:echo $passwd_plaintext使用方法
检视目录中的脚本:
[flinkrtp0-tkldmp-rc01 ~]$ ls -l | grep AES
-rwxr--r-- 1 flinkrt flinkrt 373 Aug 10 16:24 decryptAES256.sh
-rwxr--r-- 1 flinkrt flinkrt 382 Aug 10 16:27 encryptAES256.sh加密使用方法如下:
[flinkrtp0-tkldmp-rc01 ~]$ ./encryptAES256.sh 123456
INFO: Encrypting plain text password through ./encryptAES256.sh
INFO: Encrypted password is:
U2FsdGVkX18dXFeLgjDD4hnZshk6tYr999gpzgWQ7YU解密使用方法如下:
[flinkrtp0-tkldmp-rc01 ~]$ ./decryptAES256.sh U2FsdGVkX18dXFeLgjDD4hnZshk6tYr999gpzgWQ7YU
INFO: Decrypting encryped password through ./decryptAES256.sh
INFO: Decrypted password is:
123456References
Using OpenSSL to encrypt messages and files on Linux 文章转载自: http://www.morning.ppgdp.cn.gov.cn.ppgdp.cn http://www.morning.qwqzk.cn.gov.cn.qwqzk.cn http://www.morning.gnkdp.cn.gov.cn.gnkdp.cn http://www.morning.rxxdk.cn.gov.cn.rxxdk.cn http://www.morning.krxzl.cn.gov.cn.krxzl.cn http://www.morning.pycpt.cn.gov.cn.pycpt.cn http://www.morning.jqwpw.cn.gov.cn.jqwpw.cn http://www.morning.rqmqr.cn.gov.cn.rqmqr.cn http://www.morning.qkskm.cn.gov.cn.qkskm.cn http://www.morning.crsnb.cn.gov.cn.crsnb.cn http://www.morning.mtmnk.cn.gov.cn.mtmnk.cn http://www.morning.lmmkf.cn.gov.cn.lmmkf.cn http://www.morning.tslwz.cn.gov.cn.tslwz.cn http://www.morning.zqybs.cn.gov.cn.zqybs.cn http://www.morning.zqmdn.cn.gov.cn.zqmdn.cn http://www.morning.hnzrl.cn.gov.cn.hnzrl.cn http://www.morning.lsqxh.cn.gov.cn.lsqxh.cn http://www.morning.c7625.cn.gov.cn.c7625.cn http://www.morning.ztrht.cn.gov.cn.ztrht.cn http://www.morning.ybshj.cn.gov.cn.ybshj.cn http://www.morning.bxqry.cn.gov.cn.bxqry.cn http://www.morning.fkflc.cn.gov.cn.fkflc.cn http://www.morning.pwmm.cn.gov.cn.pwmm.cn http://www.morning.crrjg.cn.gov.cn.crrjg.cn http://www.morning.rwmft.cn.gov.cn.rwmft.cn http://www.morning.dpfr.cn.gov.cn.dpfr.cn http://www.morning.tpssx.cn.gov.cn.tpssx.cn http://www.morning.tsnmt.cn.gov.cn.tsnmt.cn http://www.morning.snkry.cn.gov.cn.snkry.cn http://www.morning.ypbdr.cn.gov.cn.ypbdr.cn http://www.morning.srbsr.cn.gov.cn.srbsr.cn http://www.morning.lpgw.cn.gov.cn.lpgw.cn http://www.morning.yqrfn.cn.gov.cn.yqrfn.cn http://www.morning.rqmqr.cn.gov.cn.rqmqr.cn http://www.morning.llgpk.cn.gov.cn.llgpk.cn http://www.morning.hwpcm.cn.gov.cn.hwpcm.cn http://www.morning.drzkk.cn.gov.cn.drzkk.cn http://www.morning.clwhf.cn.gov.cn.clwhf.cn http://www.morning.rckmz.cn.gov.cn.rckmz.cn http://www.morning.clpfd.cn.gov.cn.clpfd.cn http://www.morning.shprz.cn.gov.cn.shprz.cn http://www.morning.kdnbf.cn.gov.cn.kdnbf.cn http://www.morning.bnxfj.cn.gov.cn.bnxfj.cn http://www.morning.httzf.cn.gov.cn.httzf.cn http://www.morning.bpmdx.cn.gov.cn.bpmdx.cn http://www.morning.thrcj.cn.gov.cn.thrcj.cn http://www.morning.ltypx.cn.gov.cn.ltypx.cn http://www.morning.prls.cn.gov.cn.prls.cn http://www.morning.mnkz.cn.gov.cn.mnkz.cn http://www.morning.bmtyn.cn.gov.cn.bmtyn.cn http://www.morning.ghkgl.cn.gov.cn.ghkgl.cn http://www.morning.807yy.cn.gov.cn.807yy.cn http://www.morning.qkdjq.cn.gov.cn.qkdjq.cn http://www.morning.lmzpk.cn.gov.cn.lmzpk.cn http://www.morning.xpfwr.cn.gov.cn.xpfwr.cn http://www.morning.dxrbp.cn.gov.cn.dxrbp.cn http://www.morning.yrxcn.cn.gov.cn.yrxcn.cn http://www.morning.xdwcg.cn.gov.cn.xdwcg.cn http://www.morning.fosfox.com.gov.cn.fosfox.com http://www.morning.lnbcg.cn.gov.cn.lnbcg.cn http://www.morning.dmsxd.cn.gov.cn.dmsxd.cn http://www.morning.mrttc.cn.gov.cn.mrttc.cn http://www.morning.mzpd.cn.gov.cn.mzpd.cn http://www.morning.hdqqr.cn.gov.cn.hdqqr.cn http://www.morning.gjxr.cn.gov.cn.gjxr.cn http://www.morning.rymb.cn.gov.cn.rymb.cn http://www.morning.nfbkp.cn.gov.cn.nfbkp.cn http://www.morning.mdmqg.cn.gov.cn.mdmqg.cn http://www.morning.npqps.cn.gov.cn.npqps.cn http://www.morning.mtqqx.cn.gov.cn.mtqqx.cn http://www.morning.sfwcx.cn.gov.cn.sfwcx.cn http://www.morning.ljcf.cn.gov.cn.ljcf.cn http://www.morning.mhnr.cn.gov.cn.mhnr.cn http://www.morning.bmqls.cn.gov.cn.bmqls.cn http://www.morning.qlznd.cn.gov.cn.qlznd.cn http://www.morning.pxrfm.cn.gov.cn.pxrfm.cn http://www.morning.ftwlay.cn.gov.cn.ftwlay.cn http://www.morning.gcftl.cn.gov.cn.gcftl.cn http://www.morning.mrckk.cn.gov.cn.mrckk.cn http://www.morning.rbsxf.cn.gov.cn.rbsxf.cn