public class AtsHashIndex extends AbstractAtsHashIndex
ArchiveTimeStampv3
).
ATSHashIndex ::= SEQUENCE {
hashIndAlgorithm AlgorithmIdentifier DEFAULT {algorithm id-sha256},
certificatesHashIndex SEQUENCE OF OCTET STRING,
crlsHashIndex SEQUENCE OF OCTET STRING,
unsignedAttrsHashIndex SEQUENCE OF OCTET STRING
}
The AtsHashIndex identifies all components that are protected by an archival timestamp. These
components shall then be used for verifying the signature, the archive timestamp has been applied
to. Only the components identified by an ats-hash-index attribute are considered to be trusted.
An example code to identify the protected components may look like this:
CadesSignatureStream cadesSig = new CadesSignatureStream(in, data);
SignerInfo signerInfo = cadesSig.getSignerInfos()[signerInfoIndex];
ArchiveTimeStamp[] archiveTsps = cadesSig.getArchiveTimeStamps(signerInfoIndex);
for (ArchiveTimeStamp archiveTimestamp : archiveTsps) {
archiveTimestamp.verifyTimestampToken(null);
AbstractAtsHashIndex atsHashIndexAbstract = archiveTimestamp.getAtsHashIndex();
if(atsHashIndexAbstract instanceof AtsHashIndex){
AtsHashIndex atsHashIndex = (AtsHashIndex)atsHashIndexAbstract;
Certificate[] indexedCertificates = atsHashIndex.getIndexedCertificates(cadesSig);
X509CRL[] indexedCrls = atsHashIndex.getIndexedCrls(cadesSig);
BasicOCSPResponse[] indexedOcspResponses = atsHashIndex.getIndexedOcspResponses(cadesSig);
Attribute[] indexedUnsignedAttrs = atsHashIndex.getIndexedUnsignedAttributes(signerInfo);
}
}
Modifier and Type | Field and Description |
---|---|
static iaik.asn1.ObjectID |
oid
The attributeType object identifier of the AtsHashIndex attribute.
|
DEFAULTHASHALGORITHM
Constructor and Description |
---|
AtsHashIndex()
Default constructor.
|
AtsHashIndex(iaik.asn1.structures.AlgorithmID hashAlgorithm)
Constructor used to specify an alternative digest algorithm.
|
AtsHashIndex(iaik.asn1.structures.AlgorithmID hashAlgorithm,
iaik.cms.CertificateChoices[] certificates,
iaik.cms.RevocationInfoChoice[] revInfos,
iaik.asn1.structures.Attribute[] unsignedAttributes)
Constructor specifying the digest algorithm and the components to include the hash for.
|
AtsHashIndex(iaik.asn1.ASN1Object obj)
Creates an ATSHashIndex from its ASN.1 representation.
|
AtsHashIndex(iaik.cms.CertificateChoices[] certificates,
iaik.cms.RevocationInfoChoice[] revInfos,
iaik.asn1.structures.Attribute[] unsignedAttributes)
Constructor specifying the components to include the hash for.
|
Modifier and Type | Method and Description |
---|---|
void |
addUnsignedAttribute(iaik.asn1.structures.Attribute unsignedAttribute)
Calculate and add the unsigned attribute's hash.
|
void |
addUnsignedAttributeHash(byte[] unsignedAttributeHash)
Add an unsigned attribute hash value to be included in this AtsHashIndex attribute.
|
boolean |
containsUnsignedAttrHash(byte[] unsignedAttrHash)
Returns true if the given unsigned attribute hash is included in this AtsHashIndex.
|
iaik.asn1.ObjectID |
getAttributeType() |
iaik.asn1.structures.Attribute[] |
getIndexedUnsignedAttributes(iaik.cms.SignerInfo signerInfo)
Returns all unsigned attributes included in the given signer info, whose hash values are
contained in this AtsHashIndex.
|
java.util.ArrayList<byte[]> |
getUnsignedAttributeReferencesWithoutOriginalValues(iaik.cms.SignerInfo signerInfo)
Returns all unsigned attribute references (unsigned attribute hashes) included in this
AtsHashIndex, for
which no corresponding unsigned attribute can be found in the given signer info.
|
java.util.Vector<byte[]> |
getUnsignedAttributesHashes()
Returns all included unsigned attribute hashes.
|
boolean |
multipleAllowed() |
addCertificate, addCertificateHash, addRevocatioInfo, addRevocationInfoHash, containsCertificateHash, containsReferencesWithoutOriginalValues, containsRevocationInfoHash, decode, equals, getCertificateHashes, getCertificateReferencesWithoutOriginalValues, getIndexedCertificates, getIndexedCrls, getIndexedEncodedCrls, getIndexedOcspResponses, getIndexedOtherRevocationInfos, getRevocationInfoHashes, getRevocationInfoReferencesWithoutOriginalValues, toASN1Object, toString
public static final iaik.asn1.ObjectID oid
public AtsHashIndex() throws java.security.NoSuchAlgorithmException
java.security.NoSuchAlgorithmException
- if the default hash algorithm can't be usedpublic AtsHashIndex(iaik.asn1.structures.AlgorithmID hashAlgorithm) throws java.security.NoSuchAlgorithmException
hashAlgorithm
- the digest algorithm to use for calculating the digest values of all included
componentsjava.security.NoSuchAlgorithmException
- if the specified digest algorithm is unknownpublic AtsHashIndex(iaik.asn1.structures.AlgorithmID hashAlgorithm, iaik.cms.CertificateChoices[] certificates, iaik.cms.RevocationInfoChoice[] revInfos, iaik.asn1.structures.Attribute[] unsignedAttributes) throws java.security.NoSuchAlgorithmException, iaik.asn1.CodingException
hashAlgorithm
- digest algorithm to use for calculating the components' hashcertificates
- certificates of which to calculate and include the hashrevInfos
- revocation information (CRLs and/or OCSP responses) of which to calculate and include
the hashunsignedAttributes
- unsigned attributes (like signature timestamps) of which to calculate and include the
hashjava.security.NoSuchAlgorithmException
- if the specified digest algorithm is unknowniaik.asn1.CodingException
- if the components could not be encoded for hash calculationpublic AtsHashIndex(iaik.cms.CertificateChoices[] certificates, iaik.cms.RevocationInfoChoice[] revInfos, iaik.asn1.structures.Attribute[] unsignedAttributes) throws java.security.NoSuchAlgorithmException, iaik.asn1.CodingException
certificates
- certificates of which to calculate and include the hashrevInfos
- revocation information (CRLs and/or OCSP responses) of which to calculate and include
the hashunsignedAttributes
- unsigned attributes (like signature timestamps) of which to calculate and include the
hashjava.security.NoSuchAlgorithmException
- if the specified digest algorithm is unknowniaik.asn1.CodingException
- if the components could not be encoded for hash calculationpublic AtsHashIndex(iaik.asn1.ASN1Object obj) throws iaik.asn1.CodingException, java.security.NoSuchAlgorithmException
obj
- the ATSHashIndex as ASN1Objectiaik.asn1.CodingException
- if the ASN1Object could not be parsedjava.security.NoSuchAlgorithmException
- if the default hash algorithm can't be usedpublic void addUnsignedAttribute(iaik.asn1.structures.Attribute unsignedAttribute)
unsignedAttribute
- unsigned attribute (e.g. signature timestamp) of which to calculate and include the
hashpublic iaik.asn1.structures.Attribute[] getIndexedUnsignedAttributes(iaik.cms.SignerInfo signerInfo)
signerInfo
- the signer info that was archived by the corresponding archive timestamppublic java.util.ArrayList<byte[]> getUnsignedAttributeReferencesWithoutOriginalValues(iaik.cms.SignerInfo signerInfo)
signerInfo
- the signer info containing the unsigned attributes to match against the unsigned
attribute hashes of this AtsHashIndexpublic java.util.Vector<byte[]> getUnsignedAttributesHashes()
public void addUnsignedAttributeHash(byte[] unsignedAttributeHash)
unsignedAttributeHash
- the hash value of an unsigned attributepublic boolean containsUnsignedAttrHash(byte[] unsignedAttrHash)
unsignedAttrHash
- the hash to be searched forpublic iaik.asn1.ObjectID getAttributeType()
getAttributeType
in class AbstractAtsHashIndex
public boolean multipleAllowed()
multipleAllowed
in class AbstractAtsHashIndex