Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to decrypt 7-ZIP file with password (err: breader.ReadByte: no data!) #75

Closed
zollty opened this issue Apr 5, 2023 · 1 comment · Fixed by #80
Closed

Unable to decrypt 7-ZIP file with password (err: breader.ReadByte: no data!) #75

zollty opened this issue Apr 5, 2023 · 1 comment · Fixed by #80
Assignees
Labels
bug Something isn't working

Comments

@zollty
Copy link

zollty commented Apr 5, 2023

What version of the package or command are you using?

master (4e0de6e

What are you trying to do?

Decompress 7-ZIP file with password

What steps did you take?

func TestOpenReaderWithPassword(t *testing.T) {
	t.Parallel()

	tables := []struct {
		name, file, password string
	}{
		{
			name:     "xxxx header compression",
			file:     "7zcracker.7z",
			password: "876",
		},
	}
....

see: reader_test.go
the file url: download
the file is created by "7z2201-x64.exe" (from www.7-zip.org) with default options.

What did you expect to happen, and what actually happened instead?

Err: breader.ReadByte: no data !

Running tool: D:\__SYNC1\Softwares\Go\bin\go.exe test -timeout 30s -run ^TestOpenReaderWithPassword$ github.com/bodgit/sevenzip

--- FAIL: TestOpenReaderWithPassword (0.00s)
    --- FAIL: TestOpenReaderWithPassword/xxxx_header_compression (1.59s)
        d:\__SYNC2\go-path\src\zollty.com\test\sevenzip\reader_test.go:183: breader.ReadByte: no data
FAIL
FAIL	github.com/bodgit/sevenzip	3.581s
FAIL

After my testing:

All 7-zip encrypted files created by software 7-zip (official windows x64 version, default options) cannot be decrypted.

but files encrypted by another software Bandzip can be decrypted normally.

@bodgit
Copy link
Owner

bodgit commented Apr 13, 2023

I've just pushed a fix to master that works with the test case you provided. Can you test and confirm this fixes the problem for you? If so I'll tag a new release with this fix included.

@bodgit bodgit closed this as completed Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants