使用openssl解密des

编程入门 行业动态 更新时间:2024-10-08 05:24:05

使用<a href=https://www.elefans.com/category/jswz/34/1769523.html style=openssl解密des"/>

使用openssl解密des

使用openssl解密des-ede3(go语言)

项目场景:

需解密数据库中通过des-ede3加密的字符串

解决方案:

通过查找资料找到如下工具:

附代码:

func decodeDesEDE3(original string, key []byte) string {iv := []byte(nil)cipher, err := GetCipherByNid(NID_des_ede3)if err != nil {fmt.Println("Could not get cipher: ", err)}origianle_base64, err := base64.StdEncoding.DecodeString(original)dCtx, err := NewDecryptionCipherCtx(cipher, nil, key, iv)if err != nil {fmt.Println("Could not create decryption context: ", err)}// 1、plainbytes, err := dCtx.DecryptUpdate(origianle_base64)if err != nil {fmt.Println("DecryptUpdate(ciphertext) failure: ", err)}plainOutput := string(plainbytes)// 2、plainbytes, err = dCtx.DecryptFinal()if err != nil {fmt.Println("DecryptFinal() failure: ", err)}plainOutput += string(plainbytes)return plainOutput
}

更多推荐

使用openssl解密des

本文发布于:2024-02-28 12:11:08,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1769399.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:openssl   des

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!