EldoS | Feel safer!

Software components for data protection, secure storage and transfer

User password in Adobe

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#11427
Posted: 10/22/2009 14:14:07
by Cezar Botez (Priority Standard support level)
Joined: 08/28/2009
Posts: 22

Hi,

In regard to a couple of programs in the Samples folder:

TinyEncryptor: select the PDF file, set the user password and save.
TinyProcessor: select the encrypted PDF file and open it. It opens fine.

Now, if I set the user password in Adobe Acrobat, I get an "Invalid password" error when trying to open it in TinyProcessor.

Details of the exception:

Code
SBPDFSecurity.EElPDFPasswordSecurityHandlerError was caught
  Message="Invalid password"
  Source="SecureBlackbox.PDF"
  ErrorCode=0
  StackTrace:
       at SBPDFSecurity.TElPDFPasswordSecurityHandler.GenerateEncryptionKey()
       at SBPDF.TElPDFSecurityHandler.GenerateStreamEncryptionKey(TElPDFObject Obj, Int32 Alg)
       at SBPDF.TElPDFSecurityHandler.BeginDecryptionRC4(TElPDFObject Obj)
       at SBPDF.TElPDFSecurityHandler.DecryptObject(TElPDFObject Obj)
       at SBPDF.TElPDFDocument.DecryptCallback(TElPDFObject Obj)
       at SBPDF.TElPDFDocument.EnumerateStringsAndStreams(TSBPDFCallbackFunc Callback, Boolean IncludeStreams, Int32 Start)
       at SBPDF.TElPDFDocument.Decrypt()
       at SBPDF.TElPDFDocument.LoadFromStream(Stream Stream, Int32 Count)
       at SBPDF.TElPDFDocument.Open(Stream Stream)
       at TinyProcessor.frmMain.btnOK_Click(Object sender, EventArgs e) in C:\Program Files\EldoS\SecureBlackbox.NET\Samples\C#\PDFBlackbox\Processor\Form1.cs:line 237
  InnerException:


Used Adobe Acrobat Standard 9.2.0, password compatibility Acobat 5.0, 128-bit RC4.

I get the same results regardless the password compatibility settings and encryption method.

Is there something I need to change in the code before opening the file? If necessary, I can attach a sample PDF file encrypted in Adobe.

Thank you,
Cezar
#11428
Posted: 10/22/2009 14:34:35
by Ken Ivanov (EldoS Corp.)

Thank you for contacting us.

Can you please post the encrypted document that exposes the issue here? You can use Helpdesk if you do not wish to post the document to the forum. Remember to ZIP the document before posting (the forum won't accept it otherwise).
#11430
Posted: 10/22/2009 16:22:18
by Cezar Botez (Priority Standard support level)
Joined: 08/28/2009
Posts: 22

Quote
Innokentiy Ivanov wrote:
Thank you for contacting us.

Can you please post the encrypted document that exposes the issue here? You can use Helpdesk if you do not wish to post the document to the forum. Remember to ZIP the document before posting (the forum won't accept it otherwise).


Thank you for your quick reply. Please find the file attached.

Cezar
#11431
Posted: 10/22/2009 16:27:17
by Cezar Botez (Priority Standard support level)
Joined: 08/28/2009
Posts: 22

Quote
Innokentiy Ivanov wrote:
Thank you for contacting us.

Can you please post the encrypted document that exposes the issue here? You can use Helpdesk if you do not wish to post the document to the forum. Remember to ZIP the document before posting (the forum won't accept it otherwise).


Thank you for your quick reply. Please find the file (this time) attached.

Cezar


[ Download ]
#11432
Posted: 10/22/2009 16:29:15
by Cezar Botez (Priority Standard support level)
Joined: 08/28/2009
Posts: 22

Quote
Cezar Botez wrote:
Quote
Innokentiy Ivanov wrote:
Thank you for contacting us.

Can you please post the encrypted document that exposes the issue here? You can use Helpdesk if you do not wish to post the document to the forum. Remember to ZIP the document before posting (the forum won't accept it otherwise).


Thank you for your quick reply. Please find the file (this time) attached.

Cezar


Sorry again. The password is: 123.

Thank you,
Cezar
#11433
Posted: 10/22/2009 16:39:04
by Ken Ivanov (EldoS Corp.)

Thank you. We were able to reproduce the issue, the developer is working on it now. Will get back to you once something is found.
#11439
Posted: 10/23/2009 12:33:44
by Ken Ivanov (EldoS Corp.)

The document you have provided stores some of its data in so-called object streams. The possibility of storing document data in object streams is a feature of newer versions of PDF format. Though relatively efficient with regard to the final document size, object streams are quite inconvenient objects when the document is being encrypted. The presence of such objects in the encrypted document does not allow the reading party to process the document at all without having valid decryption information. Please handle the TElPDFDocument.OnDecryptionInfoNeeded event and set the passwords inside the corresponding handler to make TElPDFDocument process the document fine.
#11457
Posted: 10/25/2009 14:53:38
by Santiago Castaño (Standard support level)
Joined: 04/16/2006
Posts: 155

Hi!,

This post was also interesting and useful for me, so i've implemented OnDecryptionInfoNeeded successfully (called in Document.Open()), but i found that we cannot call .Decrypt routine, for me it's important to be able to decrypt PDF files also.

There's an exception while calling .Decrypt in:
Code
  if not Encrypted then
    raise EElPDFDocumentError.Create(SDocumentNotEncrypted);


As Encrypted=False; but i've commented out these lines and although it seemed to have decrypted it i end with a new blank PDF file (file size is 58KB so 2x more or less) -used the posted by Cezar PDF file-.

But signing on top of that document goes perfectly with OnDecryptionInfoNeeded, so the only thing remaining is to be able to decrypt the document.

Is this possible?
#11458
Posted: 10/25/2009 15:26:15
by Santiago Castaño (Standard support level)
Joined: 04/16/2006
Posts: 155

Apologies, forget my previous post, I analyzed the code and realized that i don't have to call .Decrypt as those encrypted object are already decrypted after .Open(), I only have to call .Close(True).
#11468
Posted: 10/26/2009 13:32:37
by Cezar Botez (Priority Standard support level)
Joined: 08/28/2009
Posts: 22

Quote
Innokentiy Ivanov wrote:
Please handle the TElPDFDocument.OnDecryptionInfoNeeded event and set the passwords inside the corresponding handler to make TElPDFDocument process the document fine.


Innokentiy, thank you for your help.

It works. TElPDFDocument.OnDecryptionInfoNeeded comes very handy to open this kind of files.

Cezar
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.

Reply

Statistics

Topic viewed 2364 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!