public class EncryptionToolsRevision4 extends Object
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
authenticateUserPassword(String password,
byte[] o,
int p,
byte[] id,
int revision,
boolean metadataIsEncrypted,
int length,
byte[] u)
Authenticates user password and returns encryption key if password is
correct.
|
static byte[] |
computeEncryptionKey(String password,
byte[] o,
int p,
byte[] id,
int revision,
boolean metadataIsEncrypted,
int length)
Method computes encryption key for given data as specified in 7.6.3.3.
|
static byte[] |
computeOValue(String ownerPassword,
int revision,
int length,
String userPassword)
Method computes O value in standard encryption dict for standard security
handler as specified in 7.6.3.4.
|
static byte[] |
computeUValue(String password,
byte[] o,
int p,
byte[] id,
int revision,
boolean metadataIsEncrypted,
int length)
Method computes U value in standard encryption dict for standard security
handler as specified in 7.6.3.4.
|
static byte[] |
intToBytesLowOrderFirst(long p)
Represents given integer as byte array where low-order bytes go first.
|
public static byte[] computeEncryptionKey(String password, byte[] o, int p, byte[] id, int revision, boolean metadataIsEncrypted, int length) throws NoSuchAlgorithmException
password - is password string.o - is O value of encryption dict for standard
security handler.p - is P value of encryption dict for standard
security handler.id - is the value of the ID entry in the document’s
trailer dict.revision - is R value of encryption dict for standard
security handler.metadataIsEncrypted - is true if metadata in file is encrypted.length - is value of Length in encryption dict.NoSuchAlgorithmExceptionpublic static byte[] computeOValue(String ownerPassword, int revision, int length, String userPassword) throws NoSuchAlgorithmException
ownerPassword - is owner password.revision - is R value of encryption dict for standard security
handler.length - is value of Length in encryption dict.userPassword - is user password.NoSuchAlgorithmExceptionpublic static byte[] computeUValue(String password, byte[] o, int p, byte[] id, int revision, boolean metadataIsEncrypted, int length) throws NoSuchAlgorithmException
password - is user password.o - is O value of encryption dict for standard
security handler.p - is P value of encryption dict for standard
security handler.id - is the value of the ID entry in the document’s
trailer dict.revision - is R value of encryption dict for standard
security handler.metadataIsEncrypted - is true if metadata in file is encrypted.length - is value of Length in encryption dict.NoSuchAlgorithmExceptionpublic static byte[] authenticateUserPassword(String password, byte[] o, int p, byte[] id, int revision, boolean metadataIsEncrypted, int length, byte[] u) throws NoSuchAlgorithmException
password - is string to be checked.o - is O value of encryption dict for standard
security handler.p - is P value of encryption dict for standard
security handler.id - is the value of the ID entry in the document’s
trailer dict.revision - is R value of encryption dict for standard
security handler.metadataIsEncrypted - is true if metadata in file is encrypted.length - is value of Length in encryption dict.u - is U value of encryption dict for standard
security handler.NoSuchAlgorithmExceptionpublic static byte[] intToBytesLowOrderFirst(long p)
p - is integer.Copyright © 2015–2018 The veraPDF Consortium. All rights reserved.