Class DefaultPDFDocTimestampSignatureInterface
java.lang.Object
se.swedenconnect.sigval.pdf.timestamp.issue.impl.DefaultPDFDocTimestampSignatureInterface
- All Implemented Interfaces:
org.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface
,se.idsec.signservice.security.sign.pdf.PDFBoxSignatureInterface
,PDFDocTimestampSignatureInterface
public class DefaultPDFDocTimestampSignatureInterface
extends Object
implements PDFDocTimestampSignatureInterface
Implementation of the PDF box signing interface used to add a document timestamp to a PDF document
which includes a SVT token.
This implementation generates the timestamp as part of this service.
Another implementation of this interface could allow an external time stamp service to provide the timestamp.
- Author:
- Martin Lindström (martin@idsec.se), Stefan Santesson (stefan@idsec.se)
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultPDFDocTimestampSignatureInterface
(PrivateKey privateKey, List<X509Certificate> certificates, String algorithm) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
byte[]
getSvt()
boolean
isPades()
void
byte[]
sign
(InputStream content) SignatureInterface implementation.
-
Constructor Details
-
DefaultPDFDocTimestampSignatureInterface
public DefaultPDFDocTimestampSignatureInterface(PrivateKey privateKey, List<X509Certificate> certificates, String algorithm) Constructor.- Parameters:
privateKey
- private signing keycertificates
- signing certificate chainalgorithm
- signing algorithm
-
-
Method Details
-
getCmsSignedData
public byte[] getCmsSignedData()- Specified by:
getCmsSignedData
in interfacese.idsec.signservice.security.sign.pdf.PDFBoxSignatureInterface
-
getCmsSignedAttributes
public byte[] getCmsSignedAttributes()- Specified by:
getCmsSignedAttributes
in interfacese.idsec.signservice.security.sign.pdf.PDFBoxSignatureInterface
-
getCertificateChain
- Specified by:
getCertificateChain
in interfacePDFDocTimestampSignatureInterface
-
setSvt
- Specified by:
setSvt
in interfacePDFDocTimestampSignatureInterface
-
getSvt
- Specified by:
getSvt
in interfacePDFDocTimestampSignatureInterface
-
sign
SignatureInterface implementation.This method will be called from inside of the pdfbox and creates the PKCS #7 signature (CMS ContentInfo). The given InputStream contains the bytes that are given by the byte range.
- Specified by:
sign
in interfaceorg.apache.pdfbox.pdmodel.interactive.digitalsignature.SignatureInterface
- Parameters:
content
- the message bytes being signed (specified by ByteRange in the signature dictionary)- Returns:
- CMS ContentInfo bytes holding the complete PKCS#7 signature structure
- Throws:
IOException
- error during signature creation
-
isPades
public boolean isPades()- Specified by:
isPades
in interfacese.idsec.signservice.security.sign.pdf.PDFBoxSignatureInterface
-