use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDEncryption method getOwnerKey.
/**
* This will get the O entry in the standard encryption dictionary.
*
* @return A 32 byte array or null if there is no owner key.
*
* @throws IOException If there is an error accessing the data.
*/
public byte[] getOwnerKey() throws IOException {
byte[] o = null;
COSString owner = (COSString) dictionary.getDictionaryObject(COSName.O);
if (owner != null) {
o = owner.getBytes();
}
return o;
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDEncryption method getUserEncryptionKey.
/**
* This will get the UE entry in the standard encryption dictionary.
*
* @return A 32 byte array or null if there is no user encryption key.
*
* @throws IOException If there is an error accessing the data.
*/
public byte[] getUserEncryptionKey() throws IOException {
byte[] ue = null;
COSString userEncryptionKey = (COSString) dictionary.getDictionaryObject(COSName.UE);
if (userEncryptionKey != null) {
ue = userEncryptionKey.getBytes();
}
return ue;
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDEncryption method setRecipients.
/**
* This will set the Recipients field of the dictionary. This field contains an array
* of string.
* @param recipients the array of bytes arrays to put in the Recipients field.
* @throws IOException If there is an error setting the data.
*/
public void setRecipients(byte[][] recipients) throws IOException {
COSArray array = new COSArray();
for (byte[] recipient : recipients) {
COSString recip = new COSString(recipient);
array.add(recip);
}
dictionary.setItem(COSName.RECIPIENTS, array);
array.setDirect(true);
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDEncryption method getUserKey.
/**
* This will get the U entry in the standard encryption dictionary.
*
* @return A 32 byte array or null if there is no user key.
*
* @throws IOException If there is an error accessing the data.
*/
public byte[] getUserKey() throws IOException {
byte[] u = null;
COSString user = (COSString) dictionary.getDictionaryObject(COSName.U);
if (user != null) {
u = user.getBytes();
}
return u;
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDEncryption method getPerms.
/**
* Get the Perms entry in the encryption dictionary.
*
* @return A 16 byte array or null if there is no Perms entry.
*
* @throws IOException If there is an error accessing the data.
*/
public byte[] getPerms() throws IOException {
byte[] perms = null;
COSString permsCosString = (COSString) dictionary.getDictionaryObject(COSName.PERMS);
if (permsCosString != null) {
perms = permsCosString.getBytes();
}
return perms;
}
Aggregations