use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method setIssuer.
/**
* (Optional) A list of array of bytes containing DER-encoded X.509v3 certificates of acceptable
* issuers. If the signer’s certificate chains up to any of the specified issuers (either
* directly or indirectly), the certificate is considered acceptable for signing.
*
* @param issuers A list of byte array containing DER-encoded X.509v3 certificates
*/
public void setIssuer(List<byte[]> issuers) {
COSArray array = new COSArray();
for (byte[] issuer : issuers) {
array.add(new COSString(issuer));
}
this.dictionary.setItem(COSName.ISSUER, array);
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method getKeyUsage.
/**
* Returns list of key usages of certificate strings where each string is 9 characters long and each character is
* one of these values {0, 1, X} 0 for must not set, 1 for must set, X for don't care. each index in the string
* represents a key usage:
* <ol>
* <li>digitalSignature</li>
* <li>non-Repudiation</li>
* <li>keyEncipherment</li>
* <li>dataEncipherment</li>
* <li>keyAgreement</li>
* <li>keyCertSign</li>
* <li>cRLSign</li>
* <li>encipherOnly</li>
* <li>decipherOnly</li>
* </ol>
*
* @return list of key usages
*/
public List<String> getKeyUsage() {
COSBase base = this.dictionary.getDictionaryObject(COSName.KEY_USAGE);
if (base instanceof COSArray) {
COSArray array = (COSArray) base;
List<String> keyUsageExtensions = new LinkedList<String>();
for (COSBase item : array) {
if (item instanceof COSString) {
keyUsageExtensions.add(((COSString) item).getString());
}
}
return keyUsageExtensions;
}
return null;
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method addSubject.
/**
* (Optional) byte array containing DER-encoded X.509v3 certificate that is acceptable for
* signing. works like {@link #setSubject(List)} but one byte array
*
* @param subject byte array containing DER-encoded X.509v3 certificate
*/
public void addSubject(byte[] subject) {
COSBase base = this.dictionary.getDictionaryObject(COSName.SUBJECT);
COSArray array;
if (base instanceof COSArray) {
array = (COSArray) base;
} else {
array = new COSArray();
}
COSString string = new COSString(subject);
array.add(string);
this.dictionary.setItem(COSName.SUBJECT, array);
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method setSubjectDN.
/**
* (Optional; PDF 1.7) A list of maps, where each map contains key value pairs, that specify the
* Subject Distinguished Name (DN) that must be present within the certificate for it to be
* acceptable for signing. The certificate must at a minimum contain all the attributes
* specified in one of the maps entered.
*
* @param subjectDN list of maps that contains subject distinguished names
*/
public void setSubjectDN(List<Map<String, String>> subjectDN) {
List<COSDictionary> subjectDNDict = new LinkedList<COSDictionary>();
for (Map<String, String> subjectDNItem : subjectDN) {
COSDictionary dict = new COSDictionary();
for (Map.Entry<String, String> entry : subjectDNItem.entrySet()) {
dict.setItem(entry.getKey(), new COSString(entry.getValue()));
}
subjectDNDict.add(dict);
}
this.dictionary.setItem(COSName.SUBJECT_DN, COSArrayList.converterToCOSArray(subjectDNDict));
}
use of com.tom_roush.pdfbox.cos.COSString in project PdfBox-Android by TomRoush.
the class PDSeedValueCertificate method addOID.
/**
* works like {@link #setOID(List)} but for one object
*
* @param oid the object identifier.
*/
public void addOID(byte[] oid) {
COSBase base = this.dictionary.getDictionaryObject(COSName.OID);
COSArray array;
if (base instanceof COSArray) {
array = (COSArray) base;
} else {
array = new COSArray();
}
COSString string = new COSString(oid);
array.add(string);
this.dictionary.setItem(COSName.OID, array);
}
Aggregations