Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
BUG: Truncation of CBC padding was wrong
Browse files Browse the repository at this point in the history
Resulting in wrong decryption for large secrets. Whoops.
  • Loading branch information
alexzorin committed Jul 14, 2019
1 parent 5e6fdc9 commit 6786069
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crypto.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ func decryptToken(encryptedSeedB64, salt, passphrase string) (string, error) {

out := make([]byte, len(encryptedSeed))
cbc.CryptBlocks(out, encryptedSeed)
out = out[:16]

out = out[:len(out)-cbc.BlockSize()]

return hex.EncodeToString(out), nil
}
Expand Down

0 comments on commit 6786069

Please sign in to comment.