use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method setOID.
/**
* (Optional) A list of byte arrays that contain Object Identifiers (OIDs) of the certificate
* policies that must be present in the signing certificate. This field is only applicable if
* the value of Issuer is not empty.
*
* @param oidByteStrings list of byte arrays that contain OIDs
*/
public void setOID(List<byte[]> oidByteStrings) {
COSArray array = new COSArray();
for (byte[] oid : oidByteStrings) {
array.add(new COSString(oid));
}
this.dictionary.setItem(COSName.OID, array);
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method removeSubject.
/**
* removes a subject from the list
*
* @param subject byte array containing DER-encoded X.509v3 certificate
*/
public void removeSubject(byte[] subject) {
COSBase base = this.dictionary.getDictionaryObject(COSName.SUBJECT);
if (base instanceof COSArray) {
COSArray array = (COSArray) base;
array.remove(new COSString(subject));
}
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method setSubject.
/**
* (Optional) A list of byte arrays containing DER-encoded X.509v3 certificates that are
* acceptable for signing. if
* <b>Subject</b> is not null and {@link #isSubjectRequired()} is true then the subject
* constraint is enforced on the subjects in this array subjects.
*
* @param subjects list of byte arrays containing DER-encoded X.509v3 certificates that are
* acceptable for signing.
*/
public void setSubject(List<byte[]> subjects) {
COSArray array = new COSArray();
for (byte[] subject : subjects) {
array.add(new COSString(subject));
}
this.dictionary.setItem(COSName.SUBJECT, array);
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method addKeyUsage.
/**
* (Optional; PDF 1.7) specifies an acceptable key-usage extension that must be presennt in the
* signing certificate for works like {@link #setKeyUsage(List)} but takes only one string
*
* @param keyUsageExtension String that consist only of {0, 1, X}
*/
public void addKeyUsage(String keyUsageExtension) {
String allowedChars = "01X";
for (int c = 0; c < keyUsageExtension.length(); c++) {
if (allowedChars.indexOf(keyUsageExtension.charAt(c)) == -1) {
throw new IllegalArgumentException("characters can only be 0, 1, X");
}
}
COSBase base = this.dictionary.getDictionaryObject(COSName.KEY_USAGE);
COSArray array;
if (base instanceof COSArray) {
array = (COSArray) base;
} else {
array = new COSArray();
}
COSString string = new COSString(keyUsageExtension);
array.add(string);
this.dictionary.setItem(COSName.KEY_USAGE, array);
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method removeKeyUsage.
/**
* Removes a key usage extension
*
* @param keyUsageExtension ASCII string that consists of {0, 1, X}
*/
public void removeKeyUsage(String keyUsageExtension) {
COSBase base = this.dictionary.getDictionaryObject(COSName.KEY_USAGE);
if (base instanceof COSArray) {
COSArray array = (COSArray) base;
array.remove(new COSString(keyUsageExtension));
}
}
Aggregations