Validate rand key length before 3des operations

Signed-off-by: Sean Du <do4suki@gmail.com>
This commit is contained in:
2026-04-28 11:44:56 +08:00
parent 666388a5ed
commit ae847f5e29
6 changed files with 41 additions and 11 deletions
+5 -1
View File
@@ -33,7 +33,11 @@ func initialize(ctx *gin.Context) {
if ss.CheckErr(err) {
return
}
encryptedData, err := openssl.Des3ECBEncrypt([]byte(data), ss.GetRandKey()[0:24], openssl.PKCS7_PADDING)
randKey, err := ss.Get3DESRandKey()
if ss.CheckErr(err) {
return
}
encryptedData, err := openssl.Des3ECBEncrypt([]byte(data), randKey, openssl.PKCS7_PADDING)
if ss.CheckErr(err) {
return
}