Apply padding -before- crypting
This commit is contained in:
parent
c4d7759b00
commit
297df740ad
1 changed files with 1 additions and 2 deletions
|
@ -114,9 +114,8 @@ func EncryptAndSign(v Message, key *rsa.PrivateKey, pub *rsa.PublicKey, signatur
|
||||||
|
|
||||||
encBody := make([]byte, len(body))
|
encBody := make([]byte, len(body))
|
||||||
enc := cipher2.NewCBCEncrypter(cipher, iv)
|
enc := cipher2.NewCBCEncrypter(cipher, iv)
|
||||||
|
body = append(body, Pad(body)...)
|
||||||
enc.CryptBlocks(encBody, body)
|
enc.CryptBlocks(encBody, body)
|
||||||
|
|
||||||
copy(encBody[len(encBody):], Pad(encBody))
|
|
||||||
writer.Write([]byte(hex.EncodeToString(encBody)))
|
writer.Write([]byte(hex.EncodeToString(encBody)))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue