Windows 如何进行base64编码,base64解码
生产环境需要进行定期的更换秘钥,生成的新秘钥需要进行如下测试
1、旧秘钥 可以 正常加解密
2、旧秘钥 可以 解密旧密文
3、新秘钥 可以 正常加解密
4、新秘钥 可以 解密旧密文
5、旧秘钥 不可 解密新密文
新秘钥是经过 base64编码 的,所以需要进行 base64解码,然后拿到本地测试。
在llinux上有base64命令,也有很多在线编解码网站( 在线编码与解码),那么win下能不能用命令行实现呢?
certutil命令:https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/certutil
win是不区分大小写的,CertUtil 还是 certutil 无所谓。 一定不要用于linux,因为linux也有一个certutil命令,功能是不同的
base64编码
certutil -f -encode needEncode.txt afterEncode.txt # -f参数强制覆盖输出文件,避免出错
base64解码
certutil -f -decode needDecode.txt afterDecode.txt
参考
[Ref] Windows下base64编解码命令