mirror of https://github.com/yeka/zip.git
Switch newDecryptionReader return to io.Reader
This commit is contained in:
parent
119f51e65c
commit
42f3489e0b
|
@ -14,7 +14,6 @@ import (
|
|||
"errors"
|
||||
"hash"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
)
|
||||
|
@ -247,7 +246,7 @@ func generateKeys(password, salt []byte, keySize int) (encKey, authKey, pwv []by
|
|||
return
|
||||
}
|
||||
|
||||
func newDecryptionReader(r *io.SectionReader, f *File) (io.ReadCloser, error) {
|
||||
func newDecryptionReader(r *io.SectionReader, f *File) (io.Reader, error) {
|
||||
keyLen := aesKeyLen(f.aesStrength)
|
||||
saltLen := keyLen / 2 // salt is half of key len
|
||||
if saltLen == 0 {
|
||||
|
@ -280,7 +279,7 @@ func newDecryptionReader(r *io.SectionReader, f *File) (io.ReadCloser, error) {
|
|||
ar := newAuthReader(authKey, data, authcode, false)
|
||||
// return decryption reader
|
||||
dr := decryptStream(decKey, ar)
|
||||
return ioutil.NopCloser(dr), nil
|
||||
return dr, nil
|
||||
}
|
||||
|
||||
func decryptStream(key []byte, ciphertext io.Reader) io.Reader {
|
||||
|
|
Loading…
Reference in New Issue