SECURITY PRACTICES IN LIFF
Encryption / Decryption
//update every time when open LIFF
bodyEncryptString := string(req.Data)
decodedMsgWithHmac, err := base64.StdEncoding.DecodeString(bodyEncryptString)
//Handle error
hMacCli := decodedMsgWithHmac[:BlockSizeHmac]
decodedMsg := decodedMsgWithHmac[BlockSizeHmac:]
statusHMac := ValidMAC(decodedMsg, hMacCli, []byte(salt))
//Validate HMAC
iv := decodedMsg[:NONCESIZE]
msg := decodedMsg[NONCESIZE:]
//decrypt Body
bodyDecryptString, err := DecryptAES([]byte(key), msg, iv)