RadaeePDF.com :: Topic: Explanation of EncryptAs() (1/2)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF
  • Page:
  • 1
  • 2

TOPIC: Explanation of EncryptAs()

Explanation of EncryptAs() 2 years 5 months ago #8456

  • ashughes
  • ashughes's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 32
  • Karma: 1
Could someone explain how to use Document.EncryptAs() in more detail?

Here is the method signature:
public boolean EncryptAs( String dst, String upswd, String opswd, int perm, int method, byte[] id )

And here is the parameter list from the Javadoc:
dst - path to save, same as path parameter of SaveAs.
upswd - user password, can be null.
opswd - owner password, can be null.
perm - permission to set, same as GetPermission() method.
       bit 1-2 reserved
       bit 3(0x4) print
       bit 4(0x8) modify
       bit 5(0x10) extract text or image
       others: see PDF reference
method - reserved, currently only AES with V=4 and R=4 mode can be working.
id - must be 32 bytes for file ID. it is divided to 2 array in native library, as each 16 bytes.

Here are my main questions:
1. What is the difference between upswd and opswd? Should they be the same? Which one is used when opening the PDF?
2. What should be passed into "permission" for a standard PDF? Can you give examples?
3. What should be passed into "method"? Can you give examples?
4. What should be passed into "id"? Can you give examples? What is it used for? How will it appear in the PDF?

Thanks,
Andrew
The administrator has disabled public write access.

Explanation of EncryptAs() 1 year 11 months ago #9336

  • support
  • support's Avatar
  • OFFLINE
  • Administrator
  • Posts: 474
  • Thank you received: 36
  • Karma: 6
user password: is the public password (shared with authorized users). It's sufficient to open the file with applied permission mask set.
owner password: is the password that allow opening the file without any restriction from the permission mask.
permission mask is defined as per below image: the table has been taken from pdf_reference_1-7.pdf, the official PDF definition from Adobe.
encryption method: always equal to 4. RadaeePDF actually support only AES encrypted output.
id is something like the encryption seed or salt is some other encryption scheme. That id is a reserved code that make password stronger.
Attachments:
Last Edit: 1 year 11 months ago by support.
The administrator has disabled public write access.

Explanation of EncryptAs() 1 year 11 months ago #9339

  • ashughes
  • ashughes's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 32
  • Karma: 1
Thanks for the explanations!

So if I understand correctly, if you use the same password both for "user" and "owner" then the permission mask does not matter. Opening the PDF with the owner password ignores any restrictions imposed by the permission mask. Is that correct?

Does it not matter what we pass in for "encryption method"? Should we just always pass in "4"?

Should the "id" just be randomly generated 32 byte array?

Can you give an example of a typical usage of the EncryptAs() method?

Thanks,
Andrew
The administrator has disabled public write access.

Explanation of EncryptAs() 1 year 11 months ago #9391

  • Davide
  • Davide's Avatar
  • OFFLINE
  • Moderator
  • Posts: 663
  • Thank you received: 43
  • Karma: 12
Hi,
sorry for the delay, we are working on it..
As soon as possible we will publish a knowledge base article about how to encrypt a pdf with a premium license and we will publish a new beta version with a fix regarding the encryption method.
The administrator has disabled public write access.

Explanation of EncryptAs() 1 year 11 months ago #9440

  • Davide
  • Davide's Avatar
  • OFFLINE
  • Moderator
  • Posts: 663
  • Thank you received: 43
  • Karma: 12
Hi,
here you can download the new beta version that fixes the issue : www.radaeepdf.com/download/download-prev...34-radaeepdf-351beta

Here you can find an example of Encryption: www.radaeepdf.com/support/knowledge-base...component&kbartid=29
The administrator has disabled public write access.

Explanation of EncryptAs() 1 year 11 months ago #9442

  • ashughes
  • ashughes's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 32
  • Karma: 1
Hi Davide,

Thanks for posting the knowledge base article. It might be helpful to include some of the explanations posted by support above that provide more detail about the parameters to EncryptAs().

What issue was fixed with the new beta version? I see the changelog says "FIX owner password issue for Document.EncryptAs()". Can you explain this any further?

Thanks,
Andrew
The administrator has disabled public write access.
  • Page:
  • 1
  • 2
Powered by Kunena Forum