public abstract class AbstractCadesSignature
extends java.lang.Object
Constructor and Description |
---|
AbstractCadesSignature() |
Modifier and Type | Method and Description |
---|---|
void |
addArchiveTimeStamp(int signerInfoIndex,
CadesLTAParameters params)
Adds an archive timestamp to this signature for the given signer.
|
void |
addArchiveTimeStamp(iaik.x509.X509Certificate signerCert,
CadesLTAParameters params)
Adds an archive timestamp to this signature for the given signer.
|
void |
addSignerInfo(java.security.PrivateKey privateKey,
iaik.x509.X509Certificate[] certChain,
SignatureParameters params)
Adds SignerInfo containing all required attributes as given by the parameters.
|
void |
encodeUpgradedSignature()
Writes the encoding of the upgraded CMS signature to the previously specified output stream.
|
ArchiveTimeStampv3[] |
getArchiveTimeStamps(int signerInfoIndex)
Returns all archive timestamps included in this signature for the given signer.
|
ArchiveTimeStampv3[] |
getArchiveTimeStamps(iaik.x509.X509Certificate signerCert)
Returns all archive timestamps included in this signature for the given signer.
|
ContentTimeStamp[] |
getContentTimeStamps(int signerInfoIndex)
Return all content timestamps included in this signature for the given signer.
|
ContentTimeStamp[] |
getContentTimeStamps(iaik.x509.X509Certificate signerCert)
Return all content timestamps included in this signature for the given signer.
|
static iaik.x509.X509CRL |
getCRL(iaik.x509.X509Certificate certificate)
Extract corresponding CRL of certificate, if an URL to the CRL is included.
|
SignatureTimeStamp[] |
getSignatureTimeStamps(int signerInfoIndex)
Return all signature timestamps included in this signature for the given signer.
|
SignatureTimeStamp[] |
getSignatureTimeStamps(iaik.x509.X509Certificate signerCert)
Return all signature timestamps included in this signature for the given signer.
|
iaik.tsp.TimeStampToken |
getSignatureTimeStampToken(int signerInfoIndex)
Extract signature timestamp token if included.
|
iaik.tsp.TimeStampToken |
getSignatureTimeStampToken(iaik.x509.X509Certificate signerCert)
Extract signature timestamp token if included.
|
iaik.cms.SignedDataStream |
getSignedDataObject()
Get the SignedData object of type SignedData or SignedDataStream
|
iaik.cms.SignerInfo[] |
getSignerInfos()
Extract all SignerInfos included in this CAdES signature.
|
void |
verifySignatureTimestampImprint(int signerInfoIndex)
Verify signature timestamp if included.
|
void |
verifySignatureTimestampImprint(int signerInfoIndex,
iaik.x509.X509Certificate tsaCertificate)
Verify signature timestamp if included.
|
void |
verifySignatureTimestampImprint(iaik.x509.X509Certificate signerCertificate)
Verify signature timestamp if included.
|
void |
verifySignatureTimestampImprint(iaik.x509.X509Certificate signerCertificate,
iaik.x509.X509Certificate tsaCertificate)
Verify signature timestamp if included.
|
iaik.x509.X509Certificate |
verifySignatureValue(int signerInfoIndex)
Verifies the signature that has been created by the signer at signerInfoIndex.
|
void |
verifySignatureValue(java.security.PublicKey signerPublicKey,
int signerInfoIndex)
Uses the provided public key to verify the signature that has been created by the signer at
signerInfoIndex.
|
iaik.cms.SignerInfo |
verifySignatureValue(iaik.x509.X509Certificate signerCertificate)
Verifies the signature that has been created by the signer corresponding to the given
signerCertificate.
|
public void addSignerInfo(java.security.PrivateKey privateKey, iaik.x509.X509Certificate[] certChain, SignatureParameters params) throws java.io.IOException, java.security.NoSuchAlgorithmException, CmsCadesException
privateKey
- the signer's private keycertChain
- corresponding certificate chainparams
- parameters containing details about the required signaturejava.io.IOException
- If the data, that shall be signed, can't be readjava.security.NoSuchAlgorithmException
- If the digest algorithm, specified in the parameters, is invalid or not availableCmsCadesException
- If the attributes can't be createdpublic void encodeUpgradedSignature() throws java.io.IOException, CmsCadesException
OutputStream archivedSignature = new ByteArrayOutputStream();
CadesSignatureStream cadesSig = new CadesSignatureStream(signature, data, archivedSignature);
cadesSig.addArchiveTimeStamp(signerCertificate, archiveParameters);
cadesSig.encodeUpgradedSignature();
java.io.IOException
- if no output stream was specified with the constructor or data can't be readCmsCadesException
- if signed data attributes or signed data object can't be createdpublic iaik.cms.SignedDataStream getSignedDataObject()
public iaik.cms.SignerInfo[] getSignerInfos() throws CmsCadesException
CmsCadesException
- if no SignerInfo is included.public iaik.x509.X509Certificate verifySignatureValue(int signerInfoIndex) throws iaik.cms.CMSSignatureException
signerInfoIndex
- the index of the SignerInfo whose signature has to be verifiediaik.cms.CMSSignatureException
- if the signature verification failspublic iaik.cms.SignerInfo verifySignatureValue(iaik.x509.X509Certificate signerCertificate) throws iaik.cms.CMSSignatureException
signerCertificate
- the certificate of the signer whose signature should be verifiediaik.cms.CMSSignatureException
- if the signature verification failspublic void verifySignatureValue(java.security.PublicKey signerPublicKey, int signerInfoIndex) throws iaik.cms.CMSSignatureException
signerPublicKey
- the public key of the signer to verify the messagesignerInfoIndex
- the index of the SignerInfo whose signature has to be verifiediaik.cms.CMSSignatureException
- if the signature verification failspublic void verifySignatureTimestampImprint(iaik.x509.X509Certificate signerCertificate) throws CmsCadesException, iaik.tsp.TspVerificationException
signerCertificate
- the signer's certificateCmsCadesException
- if tsa certificate is not included to verify timestamp, if timestamp can't be
extracted or if signerinfoindex is invalidiaik.tsp.TspVerificationException
- if signature of timestamp token is invalid or an parsing error occurspublic void verifySignatureTimestampImprint(int signerInfoIndex) throws CmsCadesException, iaik.tsp.TspVerificationException
signerInfoIndex
- the index of the SignerInfo including the timestampCmsCadesException
- if tsa certificate is not included to verify timestamp, if timestamp can't be
extracted or if signerinfoindex is invalidiaik.tsp.TspVerificationException
- if signature of timestamp token is invalid or an parsing error occurspublic void verifySignatureTimestampImprint(iaik.x509.X509Certificate signerCertificate, iaik.x509.X509Certificate tsaCertificate) throws CmsCadesException, iaik.tsp.TspVerificationException
signerCertificate
- the signer's certificatetsaCertificate
- the certificate of the timestamp authorityCmsCadesException
- if timestamp can't be extracted or if signerInfoIndex is invalidiaik.tsp.TspVerificationException
- if signature of timestamp token is invalid or an parsing error occurspublic void verifySignatureTimestampImprint(int signerInfoIndex, iaik.x509.X509Certificate tsaCertificate) throws CmsCadesException, iaik.tsp.TspVerificationException
signerInfoIndex
- the index of the SignerInfo containing the timestamptsaCertificate
- the certificate of the timestamp authorityCmsCadesException
- if timestamp can't be extracted or if signerInfoIndex is invalidiaik.tsp.TspVerificationException
- if signature of timestamp token is invalid or an parsing error occurspublic iaik.tsp.TimeStampToken getSignatureTimeStampToken(iaik.x509.X509Certificate signerCert) throws CmsCadesException
signerCert
- the signer's certificateCmsCadesException
- if signerInfoIndex is invalid or timestamp token can't be parsedpublic iaik.tsp.TimeStampToken getSignatureTimeStampToken(int signerInfoIndex) throws CmsCadesException
signerInfoIndex
- the index of the SignerInfo containing the timestamp tokenCmsCadesException
- if signerInfoIndex is invalid or timestamp token can't be parsedpublic SignatureTimeStamp[] getSignatureTimeStamps(iaik.x509.X509Certificate signerCert) throws CmsCadesException
signerCert
- the signer's certificateCmsCadesException
- if signerInfoIndex is invalid or timestamp token can't be parsedpublic SignatureTimeStamp[] getSignatureTimeStamps(int signerInfoIndex) throws CmsCadesException
signerInfoIndex
- the index of the SignerInfo containing the timestamp tokenCmsCadesException
- if signerInfoIndex is invalid or timestamp token can't be parsedpublic ContentTimeStamp[] getContentTimeStamps(iaik.x509.X509Certificate signerCert) throws CmsCadesException
signerCert
- the signer's certificateCmsCadesException
- if signerInfoIndex is invalid or timestamp token can't be parsedpublic ContentTimeStamp[] getContentTimeStamps(int signerInfoIndex) throws CmsCadesException
signerInfoIndex
- the index of the SignerInfo containing the timestamp tokenCmsCadesException
- if signerInfoIndex is invalid or timestamp token can't be parsedpublic static iaik.x509.X509CRL getCRL(iaik.x509.X509Certificate certificate) throws CmsCadesException, java.io.IOException
certificate
- certificate to extract the CRL fromCmsCadesException
- if CRL can't be extractedjava.io.IOException
- if CRL can't be retrieved from given URLpublic void addArchiveTimeStamp(int signerInfoIndex, CadesLTAParameters params) throws CmsCadesException, java.security.NoSuchAlgorithmException
ArchiveTimeStampv3.DEFAULTHASHALGORITHM
is used.
Prior to adding the archive timestamp all certificates and revocation information included in
the given parameters are added to this signature.signerInfoIndex
- the index of the SignerInfo the archive timestamp shall be added toparams
- the parameters specifying all details needed for the creation of the archive timestampCmsCadesException
- if signerInfoIndex is invalid, the parameter data can't be added to the signature or
the timestamp can't be createdjava.security.NoSuchAlgorithmException
- if the timestamp digest algorithm is unknownpublic void addArchiveTimeStamp(iaik.x509.X509Certificate signerCert, CadesLTAParameters params) throws CmsCadesException, java.security.NoSuchAlgorithmException
ArchiveTimeStampv3.DEFAULTHASHALGORITHM
is used.
Prior to adding the archive timestamp all certificates and revocation information included in
the given parameters are added to this signature.signerCert
- the signer's certificateparams
- the parameters specifying all details needed for the creation of the archive timestampCmsCadesException
- if signerInfoIndex is invalid, the parameter data can't be added to the signature or
the timestamp can't be createdjava.security.NoSuchAlgorithmException
- if the timestamp digest algorithm is unknownpublic ArchiveTimeStampv3[] getArchiveTimeStamps(iaik.x509.X509Certificate signerCert) throws CmsCadesException, java.security.NoSuchAlgorithmException
signerCert
- the signer's certificateCmsCadesException
- if no signer info for this certificate exists or archive timestamps can't be
extractedjava.security.NoSuchAlgorithmException
- if timestamp digest algorithm is unknown or no content hash for this digest algorithm
is availablepublic ArchiveTimeStampv3[] getArchiveTimeStamps(int signerInfoIndex) throws CmsCadesException, java.security.NoSuchAlgorithmException
signerInfoIndex
- the index of the SignerInfo containing the timestamp tokenCmsCadesException
- if signerInfoIndex is invalid or archive timestamps can't be extractedjava.security.NoSuchAlgorithmException
- if timestamp digest algorithm is unknown or no content hash for this digest algorithm
is available