Skip to content

"Padding is incorrect" error via Docker web UI for some books, but not via kobodl CLI #172

@sam-znt

Description

@sam-znt

tl;dr This error appears to be somehow caused by the Kobo auth method used in the web UI vs CLI.

It can be worked around - see Workaround below.

When downloading via the web UI, on some books (but not all) I receive this error in Docker console:

[kobodl] |   File "/opt/kobodl/src/kobodl/koboDrmRemover.py", line 38, in RemoveDrm
[kobodl] |     contents = self.__DecryptContents(contents, contentKeyBase64)
[kobodl] |   File "/opt/kobodl/src/kobodl/koboDrmRemover.py", line 29, in __DecryptContents
[kobodl] |     return Padding.unpad(decryptedContents, AES.block_size, "pkcs7")
[kobodl] |   File "/opt/kobodl/local/venv/lib/python3.9/site-packages/Crypto/Util/Padding.py", line 92, in unpad
[kobodl] |     raise ValueError("Padding is incorrect.")
[kobodl] | ValueError: Padding is incorrect.

An example which causes the issue for me is this book which has the ID (for me?) of 26cce413-697c-4e7d-bb1c-5441a35e4e93

If I open the container shell and try to download via CLI using the same config file as used by the web UI, I also receive that same error:

kobodl --config /path/to/config.json book get 26cce413-697c-4e7d-bb1c-5441a35e4e93

# ValueError: Padding is incorrect.

Workaround

However, if I don't use the same config, and instead restart auth from inside the Docker shell, I do not receive the error, and the book downloads successfully:

kobodl user add
kobodl book get 26cce413-697c-4e7d-bb1c-5441a35e4e93

# Success

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions