Hello again,
some follow-up:
When loading an unencrypted pdf, I can encrypt and sign it in one go. This
works, Password and Permissions are present and the pdf has a valid
signature.
Since I'm in control of the encryption as well for my use case, that's a
solution for me. But it's no solution for the general case of signing an
encrypted pdf.
As a side note, I noticed that I cannot use load-for-update in this case,
because the resulting pdf has an unknown password protection. Neither my
specified user nor owner password work for decryption. That's odd and
mighht be a bug, don't know ...
Regards,
F.E.
2017-08-01 15:00 GMT+02:00 F. E. <exler7...@gmail.com>:
> Hello dear podofo users,
>
>
> I want to sign an already encrypted pdf using podofo, but I don't get it
> to work:
>
> 1.) My existing solution for signing a pdf document utilizes loading the
> pdf in update mode with subsequent WriteUpdate. This does not work, when
> I'm trying to load the encrypted pdf document, I get
> 'ePdfError_CannotEncryptedForUpdate' as error.
>
> 2.) Ok, so I changed my signing implementation to not use normal Write(),
> so I don't have to use update mode for loading. When I'm now loading the
> encrypted pdf document, it works and I'm able to place my signature. BUT,
> when I'm opening the file in a pdf viewer, it doesn't ask me for any
> password! I can see that my configured permissions are still there, so this
> part of the security settings is still there, but the password (user/owner)
> got lost.
>
> 3.) Ok, so I thought, maybe I've got to set the security options again
> after loading the pdf. Did that, but when performing the write operation
> for signing, I got a cryptic runtime error (read access violation):
>
> The error is thrown in 'base\PdfParserObj.cpp', Line 346:
> PdfInputStream* pInput = m_pEncrypt->CreateEncryptionInputStream( &reader
> );
>
> The error states: "this->m_pEncrypt-> was 0xFFFFFFFFFFFFFFDF"
>
> I don't quite understand, how this can even happen. In the line above, the
> ->Operator is used on
> m_pEncrypt as well, and there's no problem with it. I can't step into the
> function, the error comes right away. But m_pEncrypt is still valid, says
> the debugger.
>
> Maybe I just can't set security options again?
>
>
> And now I'm out of ideas. Does anyone have a hint for me?
>
> Best regards,
> F.E.
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Podofo-users mailing list
Podofo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/podofo-users