public class CadesLTAParameters
extends java.lang.Object
ArchiveTimeStampv3
as defined in
ETSI EN 319 122 using
AbstractCadesSignature.addArchiveTimeStamp(iaik.x509.X509Certificate,
iaik.pdf.parameters.CadesLTAParameters)
. This creates a CMS signature according to profile
CAdES-LTA.
Before adding the archive timestamp all certificates and revocation information included in these
parameters will be added to the signature object. Only components, that existed before the
timestamp, are considered to be trusted. For requesting the timestamp, the timestamp server
details and digest algorithm as set in these parameters are used.Constructor and Description |
---|
CadesLTAParameters(java.lang.String tsaUrl,
java.lang.String username,
java.lang.String password)
Parameter constructor setting basic details about the timestamp server to be used for
requesting the archive timestamp.
|
CadesLTAParameters(java.lang.String tsaUrl,
java.lang.String username,
java.lang.String password,
java.lang.String timestampDigestAlgorithm)
Parameter constructor setting basic details about the timestamp server to be used for
requesting the archive timestamp.
|
Modifier and Type | Method and Description |
---|---|
void |
addArchiveDetails(iaik.x509.X509Certificate[] certificates,
iaik.x509.X509CRL[] crls,
iaik.x509.ocsp.OCSPResponse[] ocspResponses)
Sets certificates and revocation information to be added to the signature before adding the
archive timestamp.
|
void |
addArchiveTimeStamp(iaik.cms.SignedDataStream signedData,
iaik.cms.SignerInfo signerInfo)
Adds an archive timestamp to the given signature and signer.
|
void |
addEncodedCrl(byte[] encodedCRL)
Add encoded CRL that shall be archived and therefore shall be added to the signature before
adding the archive timestamp.
|
static byte[] |
calculateArchiveTimestampImprint(iaik.cms.SignedDataStream signedData,
iaik.cms.SignerInfo signerInfo,
iaik.asn1.structures.AlgorithmID hashAlgorithm,
byte[] atsHashIndexEncoding)
Calculate the digest value for all data that shall be timestamped with the archive timestamp.
|
iaik.x509.X509Certificate[] |
getCertificates()
Returns all certificates included in this parameter instance, that shall be added to the
signature object.
|
iaik.x509.X509CRL[] |
getCrls()
Returns all CRLs included in this parameter instance, that shall be added to the signature
object.
|
byte[][] |
getEncodedCrls()
Returns all encoded CRLs included in this parameter instance, that shall be added to the
signature object.
|
iaik.x509.ocsp.OCSPResponse[] |
getOcspResponses()
Returns all OCSP responses included in this parameter instance, that shall be added to the
signature object.
|
java.lang.String |
getTimestampDigestAlgorithm()
Returns the digest algorithm for hashing the data, that shall be timestamped.
|
java.lang.String |
getTsaPw()
Get password for authentication at the timestamp authority, used to create the archive
timestamp.
|
java.lang.String |
getTsaUrl()
Get URL of timestamp authority, used to create the archive timestamp.
|
java.lang.String |
getTsaUsername()
Get username for authentication at the timestamp authority, used to create the archive
timestamp.
|
boolean |
getUseAtsHashIndexv3()
Returns, which ats-hash-index attribute will be used for this archive time stamp.
|
void |
setTimestampDigestAlgorithm(java.lang.String digestAlgorithm)
Set the digest algorithm for hashing the data, that shall be timestamped.
|
void |
setUseAtsHashIndexv3(boolean useAtsHashIndexv3)
Sets which ats-hash-index attribute to use for the archive time stamp.
|
public CadesLTAParameters(java.lang.String tsaUrl, java.lang.String username, java.lang.String password) throws CmsCadesException
ArchiveTimeStampv3.DEFAULTHASHALGORITHM
(SHA-256) is used to hash
the data, that shall be timestamped.tsaUrl
- URL of the timestamp authorityusername
- username for authorizationpassword
- password for authorizationCmsCadesException
- if timestamp authority URL is null or emptypublic CadesLTAParameters(java.lang.String tsaUrl, java.lang.String username, java.lang.String password, java.lang.String timestampDigestAlgorithm) throws CmsCadesException
ArchiveTimeStampv3.DEFAULTHASHALGORITHM
(SHA-256) is used.tsaUrl
- URL of the timestamp authorityusername
- username for authorizationpassword
- password for authorizationtimestampDigestAlgorithm
- digest algorithm used to hash the data for the timestampCmsCadesException
- if timestamp authority URL is null or emptypublic void setUseAtsHashIndexv3(boolean useAtsHashIndexv3)
useAtsHashIndexv3
- true, if the ats-hash-index-v3 attribute shall be set in the archive time stamppublic boolean getUseAtsHashIndexv3()
public void addArchiveDetails(iaik.x509.X509Certificate[] certificates, iaik.x509.X509CRL[] crls, iaik.x509.ocsp.OCSPResponse[] ocspResponses)
certificates
- certificates, that shall be added to the signature objectcrls
- CRLs, that shall be added to the signature objectocspResponses
- OCSP responses, that shall be added to the signature objectpublic void addEncodedCrl(byte[] encodedCRL)
encodedCRL
- the encoding of the CRL that shall be addedpublic iaik.x509.X509Certificate[] getCertificates()
public iaik.x509.X509CRL[] getCrls()
public byte[][] getEncodedCrls()
public iaik.x509.ocsp.OCSPResponse[] getOcspResponses()
public void setTimestampDigestAlgorithm(java.lang.String digestAlgorithm)
digestAlgorithm
- the digest algorithm to create the timestamp imprintpublic java.lang.String getTimestampDigestAlgorithm()
public java.lang.String getTsaUrl()
public java.lang.String getTsaUsername()
public java.lang.String getTsaPw()
public void addArchiveTimeStamp(iaik.cms.SignedDataStream signedData, iaik.cms.SignerInfo signerInfo) throws CmsCadesException, java.security.NoSuchAlgorithmException
signedData
- signature object to add the timestamp tosignerInfo
- the signer info, the timestamp shall be added forCmsCadesException
- if the revocation information can't be added to the signature or the timestamp can't
be createdjava.security.NoSuchAlgorithmException
- if the timestamp digest algorithm is unknownpublic static byte[] calculateArchiveTimestampImprint(iaik.cms.SignedDataStream signedData, iaik.cms.SignerInfo signerInfo, iaik.asn1.structures.AlgorithmID hashAlgorithm, byte[] atsHashIndexEncoding) throws java.security.NoSuchAlgorithmException, iaik.asn1.CodingException
signedData
- signature object to be timestampedsignerInfo
- signer info to be timestampedhashAlgorithm
- digest algorithm to be used for digesting the required dataatsHashIndexEncoding
- the encoding of the AtsHashIndex attribute, that will also be added as unsigned
attribute to the timestamp tokenjava.security.NoSuchAlgorithmException
- if the given digest algorithm is unknown or no content hash for this algorithm is
availableiaik.asn1.CodingException
- if the signed attributes could not be encoded