Apply padding -before- crypting

This commit is contained in:
eater 2019-08-11 15:44:38 +02:00
parent c4d7759b00
commit 297df740ad
Signed by: eater
GPG key ID: 656785D50BE51C0A

View file

@ -114,9 +114,8 @@ func EncryptAndSign(v Message, key *rsa.PrivateKey, pub *rsa.PublicKey, signatur
encBody := make([]byte, len(body))
enc := cipher2.NewCBCEncrypter(cipher, iv)
body = append(body, Pad(body)...)
enc.CryptBlocks(encBody, body)
copy(encBody[len(encBody):], Pad(encBody))
writer.Write([]byte(hex.EncodeToString(encBody)))
return nil