Correctly deal with empty files

This commit is contained in:
Alexander Neumann 2014-11-30 16:06:37 +01:00
parent 6d56d7d4c6
commit c0b3021494
3 changed files with 6 additions and 6 deletions

2
key.go
View file

@ -374,7 +374,7 @@ func (k *Key) Encrypt(ciphertext, plaintext []byte) (int, error) {
// IV || Ciphertext || HMAC.
func (k *Key) decrypt(ks *keys, ciphertext []byte) ([]byte, error) {
// check for plausible length
if len(ciphertext) <= ivSize+hmacSize {
if len(ciphertext) < ivSize+hmacSize {
panic("trying to decryipt invalid data: ciphertext too small")
}