Top Description Fields Constructors Methods
org.apache.pdfbox.pdmodel.interactive.digitalsignature

public Class PDSeedValueCertificate

extends Object
implements COSObjectable
Class Inheritance
All Implemented Interfaces
org.apache.pdfbox.pdmodel.common.COSObjectable
Imports
java.util.HashMap, .LinkedList, .List, .Map, org.apache.pdfbox.cos.COSArray, .COSBase, .COSDictionary, .COSName, .COSString, org.apache.pdfbox.pdmodel.common.COSObjectable

This class represents a certificate seed value dictionary that is in the seed value which puts constraints on certificates when signing documents.
Author
Hossam Hazem

Field Summary

Modifier and TypeField and Description
private final COSDictionary
public static final int
FLAG_ISSUER

A Ff flag.

public static final int
FLAG_KEY_USAGE

A Ff flag.

public static final int
FLAG_OID

A Ff flag.

public static final int
FLAG_SUBJECT

A Ff flag.

public static final int
FLAG_SUBJECT_DN

A Ff flag.

public static final int
FLAG_URL

A Ff flag.

Constructor Summary

AccessConstructor and Description
public
PDSeedValueCertificate()

Default constructor.

public
PDSeedValueCertificate(COSDictionary
The certificate seed value dictionary.
dict
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
public void
addIssuer(byte[]
A byte array containing DER-encoded X.509v3 certificate
issuer
)

array of bytes containing DER-encoded X.509v3 certificates of acceptable issuers.

public void
addKeyUsage(String
String that consist only of {0, 1, X}
keyUsageExtension
)

(Optional; PDF 1.7) specifies an acceptable key-usage extension that must be presennt in the signing certificate for works like setKeyUsage(List) but takes only one string

public void
addKeyUsage(char
char that is one of {0, 1, X}
digitalSignature
,
char
char that is one of {0, 1, X}
nonRepudiation
,
char
char that is one of {0, 1, X}
keyEncipherment
,
char
char that is one of {0, 1, X}
dataEncipherment
,
char
char that is one of {0, 1, X}
keyAgreement
,
char
char that is one of {0, 1, X}
keyCertSign
,
char
char that is one of {0, 1, X}
cRLSign
,
char
char that is one of {0, 1, X}
encipherOnly
,
char
char that is one of {0, 1, X}
decipherOnly
)

works like addKeyUsage(String) but enters each character separately

public void
addOID(byte[]
Object Identifier of a certificate policy to be added
oid
)

works like setOID(List) but for one object

public void
addSubject(byte[]
byte array containing DER-encoded X.509v3 certificate
subject
)

(Optional) byte array containing DER-encoded X.509v3 certificate that is acceptable for signing.

private static COSArray
public COSDictionary

Returns:

The COS dictionary that matches this Java object.
getCOSObject
()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS dictionary.

public List<byte[]>

Returns:

list of array of bytes of DER-encoded X.509v3 certificates
getIssuer
()

Returns list of array of bytes of DER-encoded X.509v3 certificates

public List<String>

Returns:

list of key usages of certificate strings
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.

private static List<byte[]>
public List<byte[]>

Returns:

list of array of bytes that contain Object Identifiers of the certificate policies
getOID
()

Returns A list of array of bytes that contain Object Identifiers (OIDs) of the certificate policies that must be present in the signing certificate

public List<byte[]>

Returns:

list of byte arrays containing DER-encoded X.509v3 certificates
getSubject
()

Returns list of byte arrays that contains DER-encoded X.509v3 certificates

public List<Map<String, String>>

Returns:

list maps that contains subject distinguished names
getSubjectDN
()

Returns list of maps that contains subject distinguished names like [(cn: John Doe, o: Doe), (cn: John Smith)] both keys are typically of the form 'cn', 'o', 'email', '2.5.4.43'; and values are text strings.

public String

Returns:

string of the URL
getURL
()

returns String of the URL

public String

Returns:

string of URL type
getURLType
()

A name indicating the usage of the URL entry.

public boolean

Returns:

true if the Issuer is required
isIssuerRequired
()

public boolean

Returns:

true if the KeyUsage is required
isKeyUsageRequired
()

public boolean

Returns:

true if the OID is required
isOIDRequired
()

public boolean

Returns:

true if the Subject DN is required
isSubjectDNRequired
()

public boolean

Returns:

true if the Subject is required
isSubjectRequired
()

public boolean

Returns:

true if the URL is required
isURLRequired
()

public void
removeIssuer(byte[]
A byte array containing DER-encoded X.509v3 certificate
issuer
)

Removes an issuer from the issuers list

public void
removeKeyUsage(String
ASCII string that consists of {0, 1, X}
keyUsageExtension
)

Removes a key usage extension

public void
removeOID(byte[]
Object Identifier of the certificate policy to be removed
oid
)

removes an OID from the list

public void
removeSubject(byte[]
byte array containing DER-encoded X.509v3 certificate
subject
)

removes a subject from the list

public void
setIssuer(List<byte[]>
A list of byte array containing DER-encoded X.509v3 certificates
issuers
)

(Optional) A list of array of bytes containing DER-encoded X.509v3 certificates of acceptable issuers.

public void
setIssuerRequired(boolean
if true, the specified Issuer shall be enforced as a constraint.
flag
)

set true if Issuer shall be required as a constraint on signature.

public void
setKeyUsage(List<String>
list of ASCII strings that consists only of {0, 1, X}
keyUsageExtensions
)

(Optional; PDF 1.7) A List of ASCII strings, where each string specifies an acceptable key-usage extension that must be present in the signing certificate.

public void
setKeyUsageRequired(boolean
if true, the specified KeyUsage shall be enforced as a constraint.
flag
)

set true if KeyUsage shall be required as a constraint on signature.

public void
setOID(List<byte[]>
list of byte arrays that contain OIDs
oidByteStrings
)

(Optional) A list of byte arrays that contain Object Identifiers (OIDs) of the certificate policies that must be present in the signing certificate.

public void
setOIDRequired(boolean
if true, the specified OID shall be enforced as a constraint.
flag
)

set true if OID shall be required as a constraint on signature.

public void
setSubject(List<byte[]>
list of byte arrays containing DER-encoded X.509v3 certificates that are acceptable for signing.
subjects
)

(Optional) A list of byte arrays containing DER-encoded X.509v3 certificates that are acceptable for signing.

public void
setSubjectDN(List<Map<String, String>>
list of maps that contains subject distinguished names
subjectDN
)

(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.

public void
setSubjectDNRequired(boolean
if true, the specified Subject DN shall be enforced as a constraint.
flag
)

set true if subject DN shall be required as a constraint on signature.

public void
setSubjectRequired(boolean
if true, the specified Subject shall be enforced as a constraint.
flag
)

set true if subject shall be required as a constraint on signature.

public void
setURL(String
String of the URL
url
)

(Optional) A URL, the use for which is defined by the URLType entry.

public void
setURLRequired(boolean
if true, the specified URL shall be enforced as a constraint.
flag
)

set true if URL shall be required as a constraint on signature.

public void
setURLType(String
String of the urlType
urlType
)

(Optional; PDF 1.7) A name indicating the usage of the URL entry.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

dictionaryback to summary
private final COSDictionary dictionary
FLAG_ISSUERback to summary
public static final int FLAG_ISSUER

A Ff flag.

FLAG_KEY_USAGEback to summary
public static final int FLAG_KEY_USAGE

A Ff flag.

FLAG_OIDback to summary
public static final int FLAG_OID

A Ff flag.

FLAG_SUBJECTback to summary
public static final int FLAG_SUBJECT

A Ff flag.

FLAG_SUBJECT_DNback to summary
public static final int FLAG_SUBJECT_DN

A Ff flag.

FLAG_URLback to summary
public static final int FLAG_URL

A Ff flag.

Constructor Detail

PDSeedValueCertificateback to summary
public PDSeedValueCertificate()

Default constructor.

PDSeedValueCertificateback to summary
public PDSeedValueCertificate(COSDictionary dict)

Constructor.

Parameters
dict:COSDictionary

The certificate seed value dictionary.

Method Detail

addIssuerback to summary
public void addIssuer(byte[] issuer)

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.

Parameters
issuer:byte[]

A byte array containing DER-encoded X.509v3 certificate

addKeyUsageback to summary
public void addKeyUsage(String keyUsageExtension)

(Optional; PDF 1.7) specifies an acceptable key-usage extension that must be presennt in the signing certificate for works like setKeyUsage(List) but takes only one string

Parameters
keyUsageExtension:String

String that consist only of {0, 1, X}

addKeyUsageback to summary
public void addKeyUsage(char digitalSignature, char nonRepudiation, char keyEncipherment, char dataEncipherment, char keyAgreement, char keyCertSign, char cRLSign, char encipherOnly, char decipherOnly)

works like addKeyUsage(String) but enters each character separately

Parameters
digitalSignature:char

char that is one of {0, 1, X}

nonRepudiation:char

char that is one of {0, 1, X}

keyEncipherment:char

char that is one of {0, 1, X}

dataEncipherment:char

char that is one of {0, 1, X}

keyAgreement:char

char that is one of {0, 1, X}

keyCertSign:char

char that is one of {0, 1, X}

cRLSign:char

char that is one of {0, 1, X}

encipherOnly:char

char that is one of {0, 1, X}

decipherOnly:char

char that is one of {0, 1, X}

addOIDback to summary
public void addOID(byte[] oid)

works like setOID(List) but for one object

Parameters
oid:byte[]

Object Identifier of a certificate policy to be added

addSubjectback to summary
public void addSubject(byte[] subject)

(Optional) byte array containing DER-encoded X.509v3 certificate that is acceptable for signing. works like setSubject(List) but one byte array

Parameters
subject:byte[]

byte array containing DER-encoded X.509v3 certificate

convertListOfByteArraysToCOSArrayback to summary
private static COSArray convertListOfByteArraysToCOSArray(List<byte[]> strings)
getCOSObjectback to summary
public COSDictionary getCOSObject()

Implements org.apache.pdfbox.pdmodel.common.COSObjectable.getCOSObject.

Convert this standard java object to a COS dictionary.

Returns:COSDictionary

The COS dictionary that matches this Java object.

Annotations
@Override
getIssuerback to summary
public List<byte[]> getIssuer()

Returns list of array of bytes of DER-encoded X.509v3 certificates

Returns:List<byte[]>

list of array of bytes of DER-encoded X.509v3 certificates

getKeyUsageback to summary
public List<String> 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:

  1. digitalSignature
  2. non-Repudiation
  3. keyEncipherment
  4. dataEncipherment
  5. keyAgreement
  6. keyCertSign
  7. cRLSign
  8. encipherOnly
  9. decipherOnly
Returns:List<String>

list of key usages of certificate strings

getListOfByteArraysFromCOSArrayback to summary
private static List<byte[]> getListOfByteArraysFromCOSArray(COSArray array)
getOIDback to summary
public List<byte[]> getOID()

Returns A list of array of bytes that contain Object Identifiers (OIDs) of the certificate policies that must be present in the signing certificate

Returns:List<byte[]>

list of array of bytes that contain Object Identifiers of the certificate policies

getSubjectback to summary
public List<byte[]> getSubject()

Returns list of byte arrays that contains DER-encoded X.509v3 certificates

Returns:List<byte[]>

list of byte arrays containing DER-encoded X.509v3 certificates

getSubjectDNback to summary
public List<Map<String, String>> getSubjectDN()

Returns list of maps that contains subject distinguished names like [(cn: John Doe, o: Doe), (cn: John Smith)] both keys are typically of the form 'cn', 'o', 'email', '2.5.4.43'; and values are text strings.

Returns:List<Map<String, String>>

list maps that contains subject distinguished names

getURLback to summary
public String getURL()

returns String of the URL

Returns:String

string of the URL

getURLTypeback to summary
public String getURLType()

A name indicating the usage of the URL entry. There are standard uses and there can be implementation-specific use for this URL. The following value specifies a valid standard usage:

  • Browser, The URL references content that should be displayed in a web browser to allow enrolling for a new credential if a matching credential is not found. The Ff attribute’s URL bit is ignored for this usage.
  • ASSP, The URL references a signature web service that can be used for server-based signing. If the Ff attribute’s URL bit indicates that this is a required constraint, this implies that the credential used when signing must come from this server.
Returns:String

string of URL type

isIssuerRequiredback to summary
public boolean isIssuerRequired()
Returns:boolean

true if the Issuer is required

isKeyUsageRequiredback to summary
public boolean isKeyUsageRequired()
Returns:boolean

true if the KeyUsage is required

isOIDRequiredback to summary
public boolean isOIDRequired()
Returns:boolean

true if the OID is required

isSubjectDNRequiredback to summary
public boolean isSubjectDNRequired()
Returns:boolean

true if the Subject DN is required

isSubjectRequiredback to summary
public boolean isSubjectRequired()
Returns:boolean

true if the Subject is required

isURLRequiredback to summary
public boolean isURLRequired()
Returns:boolean

true if the URL is required

removeIssuerback to summary
public void removeIssuer(byte[] issuer)

Removes an issuer from the issuers list

Parameters
issuer:byte[]

A byte array containing DER-encoded X.509v3 certificate

removeKeyUsageback to summary
public void removeKeyUsage(String keyUsageExtension)

Removes a key usage extension

Parameters
keyUsageExtension:String

ASCII string that consists of {0, 1, X}

removeOIDback to summary
public void removeOID(byte[] oid)

removes an OID from the list

Parameters
oid:byte[]

Object Identifier of the certificate policy to be removed

removeSubjectback to summary
public void removeSubject(byte[] subject)

removes a subject from the list

Parameters
subject:byte[]

byte array containing DER-encoded X.509v3 certificate

setIssuerback to summary
public void setIssuer(List<byte[]> issuers)

(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.

Parameters
issuers:List<byte[]>

A list of byte array containing DER-encoded X.509v3 certificates

setIssuerRequiredback to summary
public void setIssuerRequired(boolean flag)

set true if Issuer shall be required as a constraint on signature.

Parameters
flag:boolean

if true, the specified Issuer shall be enforced as a constraint.

setKeyUsageback to summary
public void setKeyUsage(List<String> keyUsageExtensions)

(Optional; PDF 1.7) A List of ASCII strings, where each string specifies an acceptable key-usage extension that must be present in the signing certificate. Multiple strings specify a range of acceptable key-usage extensions; where each string 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:

  1. digitalSignature
  2. non-Repudiation
  3. keyEncipherment
  4. dataEncipherment
  5. keyAgreement
  6. keyCertSign
  7. cRLSign
  8. encipherOnly
  9. decipherOnly
Parameters
keyUsageExtensions:List<String>

list of ASCII strings that consists only of {0, 1, X}

setKeyUsageRequiredback to summary
public void setKeyUsageRequired(boolean flag)

set true if KeyUsage shall be required as a constraint on signature.

Parameters
flag:boolean

if true, the specified KeyUsage shall be enforced as a constraint.

setOIDback to summary
public void setOID(List<byte[]> oidByteStrings)

(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.

Parameters
oidByteStrings:List<byte[]>

list of byte arrays that contain OIDs

setOIDRequiredback to summary
public void setOIDRequired(boolean flag)

set true if OID shall be required as a constraint on signature.

Parameters
flag:boolean

if true, the specified OID shall be enforced as a constraint.

setSubjectback to summary
public void setSubject(List<byte[]> subjects)

(Optional) A list of byte arrays containing DER-encoded X.509v3 certificates that are acceptable for signing. if Subject is not null and isSubjectRequired() is true then the subject constraint is enforced on the subjects in this array subjects.

Parameters
subjects:List<byte[]>

list of byte arrays containing DER-encoded X.509v3 certificates that are acceptable for signing.

setSubjectDNback to summary
public void setSubjectDN(List<Map<String, String>> subjectDN)

(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.

Parameters
subjectDN:List<Map<String, String>>

list of maps that contains subject distinguished names

setSubjectDNRequiredback to summary
public void setSubjectDNRequired(boolean flag)

set true if subject DN shall be required as a constraint on signature.

Parameters
flag:boolean

if true, the specified Subject DN shall be enforced as a constraint.

setSubjectRequiredback to summary
public void setSubjectRequired(boolean flag)

set true if subject shall be required as a constraint on signature.

Parameters
flag:boolean

if true, the specified Subject shall be enforced as a constraint.

setURLback to summary
public void setURL(String url)

(Optional) A URL, the use for which is defined by the URLType entry.

Parameters
url:String

String of the URL

setURLRequiredback to summary
public void setURLRequired(boolean flag)

set true if URL shall be required as a constraint on signature.

Parameters
flag:boolean

if true, the specified URL shall be enforced as a constraint.

setURLTypeback to summary
public void setURLType(String urlType)

(Optional; PDF 1.7) A name indicating the usage of the URL entry. There are standard uses and there can be implementation-specific uses for this URL. The following value specifies a valid standard usage:

  • Browser, The URL references content that should be displayed in a web browser to allow enrolling for a new credential if a matching credential is not found. The Ff attribute’s URL bit is ignored for this usage.
  • ASSP, The URL references a signature web service that can be used for server-based signing. If the Ff attribute’s URL bit indicates that this is a required constraint, this implies that the credential used when signing must come from this server.
Third parties can extend the use of this attribute with their own attribute values, which must conform to the guidelines specified in PDF Spec 1.7 Appendix E (PDF Name Registry) if urlType is not set the default is Browser for URL
Parameters
urlType:String

String of the urlType