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

Authentication does not work as intended #82

Open
LukasPieger1 opened this issue Mar 22, 2024 · 0 comments
Open

Authentication does not work as intended #82

LukasPieger1 opened this issue Mar 22, 2024 · 0 comments

Comments

@LukasPieger1
Copy link

Hello,
I am very new to this crate and rust in general, so sorry in advance if this is a stupid question 😄

I want to extract links from an encrypted pdf, but cannot seam to figure out how the authenticate-method works. Here is my test function:

    #[test]
    fn extract_lots_of_links_from_encrypted_pdf() {
        let mut doc = Document::from_bytes(BIG_PDF_ENCRYPTED, "").unwrap();
        println!("{}", doc.needs_password().unwrap());          // true
        println!("{}", doc.authenticate("asdfasdf").unwrap()); // true
        println!("{}", doc.needs_password().unwrap());          // true
        let links = extract_links_from_doc(doc).unwrap();
        assert_eq!(38, links.len())
    }

In my understanding the authenticate method should decrypt my file and return true or false depending on if it was successful. The true value here indicates, that decryption was successful, but the doc itself seems unaltered, and extraction of the links shows, that is indeed the case.

Using a wrong password also correctly makes the authenticate method return false.

I'm really stuck here, and would be very grateful, if someone knows what the issue with my code is. I'd be happy to provide any additional information :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant