Class Signature
- java.lang.Object
-
- com.ironsoftware.ironpdf.signature.Signature
-
public class Signature extends Object
A class that represents a PDF signing certificate (.PFX or .p12) format which can be used to digitally sign a PDF. This protecting it from alteration.
-
-
Constructor Summary
Constructors Constructor Description Signature(byte[] certificateRawData, String password)
Initializes a new instance of theSignature
class.Signature(byte[] certificateRawData, String password, Instant signatureDate, byte[] signatureImage, String signingContact, String signingLocation, String signingReason)
Initializes a new instance of theSignature
class.Signature(String filePathToCertificate, String password)
Initializes a new instance of theSignature
class using a .pfx or .p12 digital signature file.Signature(Path filePathToCertificate, String password)
Initializes a new instance of theSignature
class using a .pfx or .p12 digital signature file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
getCertificateRawData()
Get certificate raw data byte [ ].int
getInternalIndex()
Internal using onlyString
getPassword()
Gets password.Instant
getSignatureDate()
Gets signature date.byte[]
getSignatureImage()
Get signature image.String
getSigningContact()
Gets signing contact.String
getSigningLocation()
Gets signing location.String
getSigningReason()
Gets signing reason.String
getTimeStampUrl()
Gets Url to be used when time-stamping the signaturevoid
setCertificateRawData(byte[] certificateRawData)
Sets certificate raw data.void
setPassword(String password)
Sets password.void
setSignatureDate(Instant signatureDate)
Sets signature date.void
setSignatureImage(byte[] signatureImage)
Sets signature image.void
setSigningContact(String signingContact)
Sets signing contact.void
setSigningLocation(String signingLocation)
Sets signing location.void
setSigningReason(String signingReason)
Sets signing reason.void
setTimeStampUrl(String timeStampUrl)
Sets Url to be used when time-stamping the signature
-
-
-
Constructor Detail
-
Signature
public Signature(String filePathToCertificate, String password) throws IOException
Initializes a new instance of theSignature
class using a .pfx or .p12 digital signature file.- Parameters:
filePathToCertificate
- The file path to certificate.password
- The certificate's password.- Throws:
IOException
- if an I/O error occurs reading from the stream
-
Signature
public Signature(Path filePathToCertificate, String password) throws IOException
Initializes a new instance of theSignature
class using a .pfx or .p12 digital signature file.- Parameters:
filePathToCertificate
- The file path to certificate.password
- The certificate's password.- Throws:
IOException
- if an I/O error occurs reading from the stream
-
Signature
public Signature(byte[] certificateRawData, String password)
Initializes a new instance of theSignature
class.- Parameters:
certificateRawData
- The certificate as a binary data (byte array).password
- The certificate's password.
-
Signature
public Signature(byte[] certificateRawData, String password, Instant signatureDate, byte[] signatureImage, String signingContact, String signingLocation, String signingReason)
Initializes a new instance of theSignature
class.- Parameters:
certificateRawData
- the certificate as a binary data (byte array).password
- the certificate's password.signatureDate
- the date and time of the digital signature. If left null, the signature will be timestamped at the millisecond that the PdfDocument is saved to Disk or Stream.signatureImage
- a visual image for the sign, often a PNG of a human signature or company stamp (optional).This appends a visual signature in addition to cryptographic signing.
signingContact
- the contact person or email address for signing related inquiries (optional).signingLocation
- the physical location the PDF was signed (optional).signingReason
- the reason the PDF was signed (optional).
-
-
Method Detail
-
getCertificateRawData
public byte[] getCertificateRawData()
Get certificate raw data byte [ ].- Returns:
- the byte [ ]
-
setCertificateRawData
public void setCertificateRawData(byte[] certificateRawData)
Sets certificate raw data.- Parameters:
certificateRawData
- the certificate raw data
-
getSignatureDate
public Instant getSignatureDate()
Gets signature date. The date and time of the digital signature. If left null, the signature will be timestamped at the millisecond that the PdfDocument is saved to Disk or Stream.- Returns:
- the signature date
-
setSignatureDate
public void setSignatureDate(Instant signatureDate)
Sets signature date. The date and time of the digital signature. If left null, the signature will be timestamped at the millisecond that the PdfDocument is saved to Disk or Stream.- Parameters:
signatureDate
- the signature date
-
getSignatureImage
public byte[] getSignatureImage()
Get signature image. A visual image for the sign, often a PNG of a human signature or company stamp (optional).This appends a visual signature in addition to cryptographic signing.
- Returns:
- the image byte[]
-
setSignatureImage
public void setSignatureImage(byte[] signatureImage)
Sets signature image. A visual image for the sign, often a PNG of a human signature or company stamp (optional).This appends a visual signature in addition to cryptographic signing.
- Parameters:
signatureImage
- the signature image
-
getSigningContact
public String getSigningContact()
Gets signing contact. The contact person or email address for signing related inquiries (optional).- Returns:
- the signing contact
-
setSigningContact
public void setSigningContact(String signingContact)
Sets signing contact. The contact person or email address for signing related inquiries (optional).- Parameters:
signingContact
- the signing contact
-
getSigningLocation
public String getSigningLocation()
Gets signing location. The physical location the PDF was signed (optional).- Returns:
- the signing location
-
setSigningLocation
public void setSigningLocation(String signingLocation)
Sets signing location. The physical location the PDF was signed (optional).- Parameters:
signingLocation
- the signing location
-
getSigningReason
public String getSigningReason()
Gets signing reason. The reason the PDF was signed (optional).- Returns:
- the signing reason
-
setSigningReason
public void setSigningReason(String signingReason)
Sets signing reason. The reason the PDF was signed (optional).- Parameters:
signingReason
- the signing reason
-
getPassword
public String getPassword()
Gets password.- Returns:
- the password
-
setPassword
public void setPassword(String password)
Sets password.- Parameters:
password
- the password
-
getTimeStampUrl
public String getTimeStampUrl()
Gets Url to be used when time-stamping the signature- Returns:
- the timestamp url
-
setTimeStampUrl
public void setTimeStampUrl(String timeStampUrl)
Sets Url to be used when time-stamping the signature- Parameters:
timeStampUrl
- the timestamp url
-
getInternalIndex
public int getInternalIndex()
Internal using only
-
-