Package eu.europa.esig.dss.validation
Class DiagnosticDataBuilder
java.lang.Object
eu.europa.esig.dss.validation.DiagnosticDataBuilder
- Direct Known Subclasses:
CertificateDiagnosticDataBuilder,SignedDocumentDiagnosticDataBuilder
Contains a common code for DiagnosticData building
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ListCertificateSourceThe list of all certificate sourcesA map between certificate id Strings and the related CertificateTokensprotected eu.europa.esig.dss.enumerations.DigestAlgorithmThe digest algorithm to use for digest computationprotected TokenIdentifierProviderGenerates ids for the tokensA map between references ids and their related token ids (used to map references for timestamped refs)A map between certificate id Strings and the related CertificateTokens for signing certificatesThe cached map of trusted lists with corresponding TLInfoprotected eu.europa.esig.dss.enumerations.TokenExtractionStrategyThe token extraction strategyprotected Set<eu.europa.esig.dss.model.x509.CertificateToken>The certificates used during the validation processprotected Set<RevocationToken>The revocation used during the validation processprotected DateThe validation timeThe cached map of certificatesThe cached map of orphan certificatesThe cached map of orphan revocation dataThe cached map of revocation dataThe cached map of trusted lists -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDefault constructor instantiating object with null values -
Method Summary
Modifier and TypeMethodDescriptionallCertificateSources(ListCertificateSource allCertificateSources) This method allows to setListCertificateSourcecontaining all certificate sources used in the validator (including trusted certificate sources)eu.europa.esig.dss.diagnostic.jaxb.XmlDiagnosticDatabuild()BuildsXmlDiagnosticDataprotected eu.europa.esig.dss.diagnostic.jaxb.XmlCertificatebuildDetachedXmlCertificate(eu.europa.esig.dss.model.x509.CertificateToken certToken) This method builds anXmlCertificatefrom the givenCertificateTokenprotected eu.europa.esig.dss.diagnostic.jaxb.XmlRevocationbuildDetachedXmlRevocation(RevocationToken<?> revocationToken) This method builds anXmlRevocationfrom the givenRevocationTokenprotected eu.europa.esig.dss.diagnostic.jaxb.XmlOrphanCertificateTokenbuildXmlOrphanCertificateToken(eu.europa.esig.dss.model.x509.CertificateToken certificateToken) This method builds anXmlOrphanCertificateTokenfrom the givenCertificateTokenprotected eu.europa.esig.dss.diagnostic.jaxb.XmlOrphanTokensBuilds a list ofXmlOrphanTokensdefaultDigestAlgorithm(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm) This method allows to set the defaultDigestAlgorithmwhich will be used for tokens' DigestAlgoAndValue calculationprotected eu.europa.esig.dss.model.x509.CertificateTokengetUsedCertificateByCertificateRef(CertificateRef certificateRef) Returns used certificate by thecertificateRefprotected eu.europa.esig.dss.diagnostic.jaxb.XmlBasicSignaturegetXmlBasicSignature(eu.europa.esig.dss.model.x509.Token token) GetsXmlBasicSignaturefor aTokenprotected eu.europa.esig.dss.diagnostic.jaxb.XmlCertificateRefgetXmlCertificateRef(CertificateRef ref, eu.europa.esig.dss.enumerations.CertificateRefOrigin origin) Builds aXmlCertificateReffromCertificateRefprotected eu.europa.esig.dss.diagnostic.jaxb.XmlRevocationRefgetXmlCRLRevocationRef(CRLRef crlRef, Set<eu.europa.esig.dss.enumerations.RevocationRefOrigin> origins) Builds aXmlRevocationReffromCRLRefprotected eu.europa.esig.dss.diagnostic.jaxb.XmlDigestAlgoAndValuegetXmlDigestAlgoAndValue(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgo, byte[] digestValue) Builds aXmlDigestAlgoAndValueforDigestAlgorithmanddigestValueprotected eu.europa.esig.dss.diagnostic.jaxb.XmlDigestAlgoAndValuegetXmlDigestAlgoAndValue(eu.europa.esig.dss.model.Digest digest) Builds aXmlDigestAlgoAndValueforDigestprotected List<eu.europa.esig.dss.diagnostic.jaxb.XmlChainItem>getXmlForCertificateChain(eu.europa.esig.dss.model.x509.Token token) Returns a certificate chain for thetokenprotected List<eu.europa.esig.dss.diagnostic.jaxb.XmlChainItem>getXmlForCertificateChain(eu.europa.esig.dss.model.x509.Token token, CertificateSource certificateSource) Returns a certificate chain for thetokenfrom thecertificateSourceprotected List<eu.europa.esig.dss.diagnostic.jaxb.XmlChainItem>getXmlForCertificateChain(CertificateValidity certificateValidity, CertificateSource certificateSource) Builds a certificate chain for aCertificateValidityprotected eu.europa.esig.dss.diagnostic.jaxb.XmlFoundCertificatesgetXmlFoundCertificates(eu.europa.esig.dss.model.identifier.Identifier tokenIdentifier, TokenCertificateSource certificateSource) Returns found certificates from the sourceprotected eu.europa.esig.dss.diagnostic.jaxb.XmlRevocationRefgetXmlOCSPRevocationRef(OCSPRef ocspRef, Set<eu.europa.esig.dss.enumerations.RevocationRefOrigin> origins) Builds aXmlRevocationReffromOCSPRefprotected eu.europa.esig.dss.diagnostic.jaxb.XmlOrphanCertificategetXmlOrphanCertificate(eu.europa.esig.dss.enumerations.CertificateOrigin origin, eu.europa.esig.dss.model.x509.CertificateToken certificateToken, TokenCertificateSource certificateSource, eu.europa.esig.dss.model.x509.CertificateToken signingCertificate) This method builds anXmlOrphanCertificateTokenprotected List<eu.europa.esig.dss.diagnostic.jaxb.XmlRelatedCertificate>getXmlRelatedCertificateForOrphanReferences(TokenCertificateSource certificateSource) Returns a list ofXmlRelatedCertificates for orphan references withincertificateSourceprotected <R extends eu.europa.esig.dss.model.x509.revocation.Revocation>
List<eu.europa.esig.dss.diagnostic.jaxb.XmlRevocationRef>getXmlRevocationRefs(String tokenId, Map<RevocationRef<R>, Set<eu.europa.esig.dss.enumerations.RevocationRefOrigin>> refsAndOrigins) Returns a list ofXmlRevocationReffor a token withtokenIdprotected eu.europa.esig.dss.diagnostic.jaxb.XmlSignerInfogetXmlSignerInfo(SignerIdentifier signerIdentifier) Creates aXmlSignerInfofromSignerIdentifierprotected eu.europa.esig.dss.diagnostic.jaxb.XmlSigningCertificategetXmlSigningCertificate(eu.europa.esig.dss.model.identifier.Identifier tokenIdentifier, CertificateValidity certificateValidity) Gets a signing certificate token for a token withtokenIdentifierprotected voidlinkSigningCertificateAndChains(Set<eu.europa.esig.dss.model.x509.CertificateToken> certificates) Links the certificates and their certificate chainsprotected voidpopulateCertificateOriginMap(Map<String, eu.europa.esig.dss.diagnostic.jaxb.XmlRelatedCertificate> relatedCertificatesMap, eu.europa.esig.dss.enumerations.CertificateOrigin origin, List<eu.europa.esig.dss.model.x509.CertificateToken> certificateTokens, TokenCertificateSource certificateSource) Fills the certificates origins map with the given propertiesprotected voidpopulateOrphanCertificateOriginMap(Map<String, eu.europa.esig.dss.diagnostic.jaxb.XmlOrphanCertificate> orphanCertificatesMap, eu.europa.esig.dss.enumerations.CertificateOrigin origin, List<eu.europa.esig.dss.model.x509.CertificateToken> certificateTokens, TokenCertificateSource certificateSource, eu.europa.esig.dss.model.x509.CertificateToken signingCertificate) Fills the orphan certificate map with the given valuesprotected eu.europa.esig.dss.diagnostic.jaxb.XmlRelatedCertificatepopulateXmlRelatedCertificatesList(eu.europa.esig.dss.enumerations.CertificateOrigin origin, eu.europa.esig.dss.model.x509.CertificateToken cert, TokenCertificateSource certificateSource) Builds anXmlRelatedCertificateprotected voidpopulateXmlRelatedCertificatesList(List<eu.europa.esig.dss.diagnostic.jaxb.XmlRelatedCertificate> relatesCertificates, TokenCertificateSource certificateSource, eu.europa.esig.dss.model.x509.CertificateToken cert, CertificateRef certificateRef) Builds anXmlRelatedCertificateand populates therelatesCertificateslisttokenExtractionStrategy(eu.europa.esig.dss.enumerations.TokenExtractionStrategy tokenExtractionStrategy) This method allows to set theTokenExtractionStrategyto follow for the token extractiontokenIdentifierProvider(TokenIdentifierProvider identifierProvider) This method allows to set theTokenIdentifierProviderfor identifiers generationusedCertificates(Set<eu.europa.esig.dss.model.x509.CertificateToken> usedCertificates) This method allows to set the used certificatesusedRevocations(Set<RevocationToken> usedRevocations) This method allows to set the used revocation datavalidationDate(Date validationDate) This method allows to set the validation dateprotected voidverifyAgainstCertificateToken(eu.europa.esig.dss.diagnostic.jaxb.XmlCertificateRef xmlCertificateRef, CertificateRef ref, eu.europa.esig.dss.model.x509.CertificateToken signingCertificate) Verifies the reference against a certificate token
-
Field Details
-
usedCertificates
The certificates used during the validation process -
usedRevocations
The revocation used during the validation process -
allCertificateSources
The list of all certificate sources -
validationDate
The validation time -
tokenExtractionStrategy
protected eu.europa.esig.dss.enumerations.TokenExtractionStrategy tokenExtractionStrategyThe token extraction strategy -
defaultDigestAlgorithm
protected eu.europa.esig.dss.enumerations.DigestAlgorithm defaultDigestAlgorithmThe digest algorithm to use for digest computation -
identifierProvider
Generates ids for the tokens -
xmlCertsMap
The cached map of certificates -
xmlRevocationsMap
The cached map of revocation data -
xmlTrustedListsMap
The cached map of trusted lists -
xmlOrphanCertificateTokensMap
protected Map<String,eu.europa.esig.dss.diagnostic.jaxb.XmlOrphanCertificateToken> xmlOrphanCertificateTokensMapThe cached map of orphan certificates -
xmlOrphanRevocationTokensMap
protected Map<String,eu.europa.esig.dss.diagnostic.jaxb.XmlOrphanRevocationToken> xmlOrphanRevocationTokensMapThe cached map of orphan revocation data -
referenceMap
A map between references ids and their related token ids (used to map references for timestamped refs) -
certificateIdsMap
A map between certificate id Strings and the related CertificateTokens -
signingCertificateMap
A map between certificate id Strings and the related CertificateTokens for signing certificates -
tlInfoMap
The cached map of trusted lists with corresponding TLInfo
-
-
Constructor Details
-
DiagnosticDataBuilder
protected DiagnosticDataBuilder()Default constructor instantiating object with null values
-
-
Method Details
-
usedCertificates
public DiagnosticDataBuilder usedCertificates(Set<eu.europa.esig.dss.model.x509.CertificateToken> usedCertificates) This method allows to set the used certificates- Parameters:
usedCertificates- the used certificates- Returns:
- the builder
-
usedRevocations
This method allows to set the used revocation data- Parameters:
usedRevocations- the used revocation data- Returns:
- the builder
-
allCertificateSources
This method allows to setListCertificateSourcecontaining all certificate sources used in the validator (including trusted certificate sources)- Parameters:
allCertificateSources- the list of trusted lists certificate sources- Returns:
- the builder
-
validationDate
This method allows to set the validation date- Parameters:
validationDate- the validation date- Returns:
- the builder
-
tokenExtractionStrategy
public DiagnosticDataBuilder tokenExtractionStrategy(eu.europa.esig.dss.enumerations.TokenExtractionStrategy tokenExtractionStrategy) This method allows to set theTokenExtractionStrategyto follow for the token extraction- Parameters:
tokenExtractionStrategy-TokenExtractionStrategyto use- Returns:
- the builder
-
tokenIdentifierProvider
This method allows to set theTokenIdentifierProviderfor identifiers generation- Parameters:
identifierProvider-TokenIdentifierProviderto use- Returns:
- the builder
-
defaultDigestAlgorithm
public DiagnosticDataBuilder defaultDigestAlgorithm(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgorithm) This method allows to set the defaultDigestAlgorithmwhich will be used for tokens' DigestAlgoAndValue calculation- Parameters:
digestAlgorithm-DigestAlgorithmto set as default- Returns:
- the builder
-
build
public eu.europa.esig.dss.diagnostic.jaxb.XmlDiagnosticData build()BuildsXmlDiagnosticData- Returns:
XmlDiagnosticData
-
linkSigningCertificateAndChains
protected void linkSigningCertificateAndChains(Set<eu.europa.esig.dss.model.x509.CertificateToken> certificates) Links the certificates and their certificate chains- Parameters:
certificates- a set ofCertificateTokens
-
buildXmlOrphanTokens
protected eu.europa.esig.dss.diagnostic.jaxb.XmlOrphanTokens buildXmlOrphanTokens()Builds a list ofXmlOrphanTokens- Returns:
XmlOrphanTokens
-
getXmlSignerInfo
protected eu.europa.esig.dss.diagnostic.jaxb.XmlSignerInfo getXmlSignerInfo(SignerIdentifier signerIdentifier) Creates aXmlSignerInfofromSignerIdentifier- Parameters:
signerIdentifier-SignerIdentifier- Returns:
XmlSignerInfo
-
buildDetachedXmlRevocation
protected eu.europa.esig.dss.diagnostic.jaxb.XmlRevocation buildDetachedXmlRevocation(RevocationToken<?> revocationToken) This method builds anXmlRevocationfrom the givenRevocationToken- Parameters:
revocationToken-RevocationToken- Returns:
XmlRevocation
-
getXmlRevocationRefs
protected <R extends eu.europa.esig.dss.model.x509.revocation.Revocation> List<eu.europa.esig.dss.diagnostic.jaxb.XmlRevocationRef> getXmlRevocationRefs(String tokenId, Map<RevocationRef<R>, Set<eu.europa.esig.dss.enumerations.RevocationRefOrigin>> refsAndOrigins) Returns a list ofXmlRevocationReffor a token withtokenId- Type Parameters:
R-Revocation- Parameters:
tokenId-StringrefsAndOrigins- a map ofRevocationRefs and theirRevocationRefOrigins- Returns:
- a list of
XmlRevocationRefs
-
getXmlCRLRevocationRef
protected eu.europa.esig.dss.diagnostic.jaxb.XmlRevocationRef getXmlCRLRevocationRef(CRLRef crlRef, Set<eu.europa.esig.dss.enumerations.RevocationRefOrigin> origins) Builds aXmlRevocationReffromCRLRef- Parameters:
crlRef-CRLReforigins- a set ofRevocationRefOrigins- Returns:
XmlRevocationRef
-
getXmlOCSPRevocationRef
protected eu.europa.esig.dss.diagnostic.jaxb.XmlRevocationRef getXmlOCSPRevocationRef(OCSPRef ocspRef, Set<eu.europa.esig.dss.enumerations.RevocationRefOrigin> origins) Builds aXmlRevocationReffromOCSPRef- Parameters:
ocspRef-OCSPReforigins- a set ofRevocationRefOrigins- Returns:
XmlRevocationRef
-
getXmlForCertificateChain
protected List<eu.europa.esig.dss.diagnostic.jaxb.XmlChainItem> getXmlForCertificateChain(eu.europa.esig.dss.model.x509.Token token) Returns a certificate chain for thetoken- Parameters:
token-Token- Returns:
- a list of
XmlChainItem
-
getXmlForCertificateChain
protected List<eu.europa.esig.dss.diagnostic.jaxb.XmlChainItem> getXmlForCertificateChain(eu.europa.esig.dss.model.x509.Token token, CertificateSource certificateSource) Returns a certificate chain for thetokenfrom thecertificateSource- Parameters:
token-TokencertificateSource-CertificateSource- Returns:
- a list of
XmlChainItem
-
getXmlForCertificateChain
protected List<eu.europa.esig.dss.diagnostic.jaxb.XmlChainItem> getXmlForCertificateChain(CertificateValidity certificateValidity, CertificateSource certificateSource) Builds a certificate chain for aCertificateValidity- Parameters:
certificateValidity-CertificateValiditycertificateSource-CertificateSource- Returns:
- a list of
XmlChainItem
-
getXmlSigningCertificate
protected eu.europa.esig.dss.diagnostic.jaxb.XmlSigningCertificate getXmlSigningCertificate(eu.europa.esig.dss.model.identifier.Identifier tokenIdentifier, CertificateValidity certificateValidity) Gets a signing certificate token for a token withtokenIdentifier- Parameters:
tokenIdentifier-IdentifiercertificateValidity-CertificateValidity- Returns:
XmlSigningCertificate
-
getXmlFoundCertificates
protected eu.europa.esig.dss.diagnostic.jaxb.XmlFoundCertificates getXmlFoundCertificates(eu.europa.esig.dss.model.identifier.Identifier tokenIdentifier, TokenCertificateSource certificateSource) Returns found certificates from the source- Parameters:
tokenIdentifier-Identifierof the tokencertificateSource-TokenCertificateSource- Returns:
XmlFoundCertificates
-
populateCertificateOriginMap
protected void populateCertificateOriginMap(Map<String, eu.europa.esig.dss.diagnostic.jaxb.XmlRelatedCertificate> relatedCertificatesMap, eu.europa.esig.dss.enumerations.CertificateOrigin origin, List<eu.europa.esig.dss.model.x509.CertificateToken> certificateTokens, TokenCertificateSource certificateSource) Fills the certificates origins map with the given properties- Parameters:
relatedCertificatesMap- a map to fillorigin-CertificateOrigincertificateTokens- a list ofCertificateTokenscertificateSource-TokenCertificateSource
-
populateXmlRelatedCertificatesList
protected eu.europa.esig.dss.diagnostic.jaxb.XmlRelatedCertificate populateXmlRelatedCertificatesList(eu.europa.esig.dss.enumerations.CertificateOrigin origin, eu.europa.esig.dss.model.x509.CertificateToken cert, TokenCertificateSource certificateSource) Builds anXmlRelatedCertificate- Parameters:
origin-CertificateOrigincert-CertificateTokencertificateSource-TokenCertificateSource- Returns:
XmlRelatedCertificate
-
populateXmlRelatedCertificatesList
protected void populateXmlRelatedCertificatesList(List<eu.europa.esig.dss.diagnostic.jaxb.XmlRelatedCertificate> relatesCertificates, TokenCertificateSource certificateSource, eu.europa.esig.dss.model.x509.CertificateToken cert, CertificateRef certificateRef) Builds anXmlRelatedCertificateand populates therelatesCertificateslist- Parameters:
relatesCertificates- a list of created earlierXmlRelatedCertificatecertificateSource-TokenCertificateSourcecert-CertificateTokencertificateRef-CertificateRef
-
getXmlCertificateRef
protected eu.europa.esig.dss.diagnostic.jaxb.XmlCertificateRef getXmlCertificateRef(CertificateRef ref, eu.europa.esig.dss.enumerations.CertificateRefOrigin origin) Builds aXmlCertificateReffromCertificateRef- Parameters:
ref-XmlCertificateReforigin-CertificateRefOrigin- Returns:
XmlCertificateRef
-
populateOrphanCertificateOriginMap
protected void populateOrphanCertificateOriginMap(Map<String, eu.europa.esig.dss.diagnostic.jaxb.XmlOrphanCertificate> orphanCertificatesMap, eu.europa.esig.dss.enumerations.CertificateOrigin origin, List<eu.europa.esig.dss.model.x509.CertificateToken> certificateTokens, TokenCertificateSource certificateSource, eu.europa.esig.dss.model.x509.CertificateToken signingCertificate) Fills the orphan certificate map with the given values- Parameters:
orphanCertificatesMap- a map to fillorigin-CertificateOrigincertificateTokens- a list ofCertificateTokenscertificateSource-TokenCertificateSourcesigningCertificate-CertificateToken
-
getXmlOrphanCertificate
protected eu.europa.esig.dss.diagnostic.jaxb.XmlOrphanCertificate getXmlOrphanCertificate(eu.europa.esig.dss.enumerations.CertificateOrigin origin, eu.europa.esig.dss.model.x509.CertificateToken certificateToken, TokenCertificateSource certificateSource, eu.europa.esig.dss.model.x509.CertificateToken signingCertificate) This method builds anXmlOrphanCertificateToken- Parameters:
origin-CertificateOrigincertificateToken-CertificateTokencertificateSource-TokenCertificateSourcesigningCertificate-CertificateToken- Returns:
XmlOrphanCertificateToken
-
buildXmlOrphanCertificateToken
protected eu.europa.esig.dss.diagnostic.jaxb.XmlOrphanCertificateToken buildXmlOrphanCertificateToken(eu.europa.esig.dss.model.x509.CertificateToken certificateToken) This method builds anXmlOrphanCertificateTokenfrom the givenCertificateToken- Parameters:
certificateToken-CertificateToken- Returns:
XmlOrphanCertificateToken
-
getXmlRelatedCertificateForOrphanReferences
protected List<eu.europa.esig.dss.diagnostic.jaxb.XmlRelatedCertificate> getXmlRelatedCertificateForOrphanReferences(TokenCertificateSource certificateSource) Returns a list ofXmlRelatedCertificates for orphan references withincertificateSource- Parameters:
certificateSource-TokenCertificateSource- Returns:
- a list of
XmlRelatedCertificates
-
getUsedCertificateByCertificateRef
protected eu.europa.esig.dss.model.x509.CertificateToken getUsedCertificateByCertificateRef(CertificateRef certificateRef) Returns used certificate by thecertificateRef- Parameters:
certificateRef-CertificateRef- Returns:
CertificateToken
-
verifyAgainstCertificateToken
protected void verifyAgainstCertificateToken(eu.europa.esig.dss.diagnostic.jaxb.XmlCertificateRef xmlCertificateRef, CertificateRef ref, eu.europa.esig.dss.model.x509.CertificateToken signingCertificate) Verifies the reference against a certificate token- Parameters:
xmlCertificateRef-XmlCertificateRefref-CertificateRefsigningCertificate-CertificateToken
-
getXmlBasicSignature
protected eu.europa.esig.dss.diagnostic.jaxb.XmlBasicSignature getXmlBasicSignature(eu.europa.esig.dss.model.x509.Token token) GetsXmlBasicSignaturefor aToken- Parameters:
token-Token- Returns:
XmlBasicSignature
-
buildDetachedXmlCertificate
protected eu.europa.esig.dss.diagnostic.jaxb.XmlCertificate buildDetachedXmlCertificate(eu.europa.esig.dss.model.x509.CertificateToken certToken) This method builds anXmlCertificatefrom the givenCertificateToken- Parameters:
certToken-CertificateToken- Returns:
XmlCertificate
-
getXmlDigestAlgoAndValue
protected eu.europa.esig.dss.diagnostic.jaxb.XmlDigestAlgoAndValue getXmlDigestAlgoAndValue(eu.europa.esig.dss.model.Digest digest) Builds aXmlDigestAlgoAndValueforDigest- Parameters:
digest-Digest- Returns:
XmlDigestAlgoAndValue
-
getXmlDigestAlgoAndValue
protected eu.europa.esig.dss.diagnostic.jaxb.XmlDigestAlgoAndValue getXmlDigestAlgoAndValue(eu.europa.esig.dss.enumerations.DigestAlgorithm digestAlgo, byte[] digestValue) Builds aXmlDigestAlgoAndValueforDigestAlgorithmanddigestValue- Parameters:
digestAlgo-DigestAlgorithmdigestValue- digest value bytes- Returns:
XmlDigestAlgoAndValue
-