What is maximum number of characters in password
Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Paul - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange
-
macattak1
- User
- Posts: 2
- Joined: Mon Mar 14, 2011 6:21 pm
What is maximum number of characters in password
I would like to use as large a string as possible. But I am having a heck of a time trying to figure it out.
-
Stefan - PDF-XChange
- Site Admin
- Posts: 19930
- Joined: Mon Jan 12, 2009 8:07 am
Re: What is maximum number of characters in password
Hello macattak1,
You can use a password with any length you like, but reading the PDF specification - if you use a password shorter than 32 bytes when encrypting your document this password would be filled up to 32 bytes, and if it is longer - it will be truncated to 32 bytes.
So if you are using a single byte characters the "optimal" password would be 32 chars, and if you are using multibyte chars (e.g. Chinese, Japanese) the "optimal" password length would be less.
I am putting "optimal" in quotes on purpose, as any strong alphanumeric password with a length of e.g. 12 chars would be sufficient unless you are working with e.g. Top Secret documents but then I would presume the security would be on more than the default PDF level.
Best,
Stefan
You can use a password with any length you like, but reading the PDF specification - if you use a password shorter than 32 bytes when encrypting your document this password would be filled up to 32 bytes, and if it is longer - it will be truncated to 32 bytes.
Code: Select all
Algorithm 3.2 Computing an encryption key
1. Pad or truncate the password string to exactly 32 bytes. If the password string is
more than 32 bytes long, use only its first 32 bytes; if it is less than 32 bytes long,
pad it by appending the required number of additional bytes from the beginning
of the following padding string:
< 28 BF 4E 5E 4E 75 8A 41 64 00 4E 56 FF FA 01 08
2E 2E 00 B6 D0 68 3E 80 2F 0C A9 FE 64 53 69 7A >I am putting "optimal" in quotes on purpose, as any strong alphanumeric password with a length of e.g. 12 chars would be sufficient unless you are working with e.g. Top Secret documents but then I would presume the security would be on more than the default PDF level.
Best,
Stefan
-
macattak1
- User
- Posts: 2
- Joined: Mon Mar 14, 2011 6:21 pm
Re: What is maximum number of characters in password
Thanks Stefan.
So an English character is considered 1 byte? Am I understanding that correctly?
If so, why can I only get 24? Are special characters !@#$%^&*()_+ considered more than one byte for any of them?
Thanks!
Peace and Blessings
So an English character is considered 1 byte? Am I understanding that correctly?
If so, why can I only get 24? Are special characters !@#$%^&*()_+ considered more than one byte for any of them?
Thanks!
Peace and Blessings
-
Ivan - Tracker Software
- Site Admin
- Posts: 3603
- Joined: Thu Jul 08, 2004 10:36 pm
Re: What is maximum number of characters in password
Can you say where? Is your problem related to any of Tracker's product?If so, why can I only get 24?
PDF-XChange Co Ltd. (Project Director)
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.