- Posts: 37
- Thank you received: 1
Microsoft Windows Phone 8.1 support ends (13 Jul 2017)
Microsoft has ended support for Windows Phone 8.1
Questions about Android development and PDF
Explanation of EncryptAs()
11 years 2 weeks ago #8456
by ashughes
Explanation of EncryptAs() was created by ashughes
Could someone explain how to use Document.EncryptAs() in more detail?
Here is the method signature:
And here is the parameter list from the Javadoc:
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
Here is the method signature:
Code:
public boolean EncryptAs( String dst, String upswd, String opswd, int perm, int method, byte[] id )
And here is the parameter list from the Javadoc:
Code:
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
10 years 6 months ago - 10 years 6 months ago #9336
by support
Replied by support on topic Explanation of EncryptAs()
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.
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.
Last edit: 10 years 6 months ago by support.
10 years 6 months ago #9339
by ashughes
Replied by ashughes on topic Explanation of EncryptAs()
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
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
10 years 6 months ago #9391
by Davide
Replied by Davide on topic Explanation of EncryptAs()
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.
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.
10 years 6 months ago #9440
by Davide
Replied by Davide on topic Explanation of EncryptAs()
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
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
10 years 6 months ago #9442
by ashughes
Replied by ashughes on topic Explanation of EncryptAs()
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
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
Time to create page: 0.456 seconds