Class DiagnosticDataBuilder
java.lang.Object
eu.europa.esig.dss.validation.reports.diagnostic.DiagnosticDataBuilder
- Direct Known Subclasses:
CertificateDiagnosticDataBuilder,SignedDocumentDiagnosticDataBuilder
Contains a common code for DiagnosticData building
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ListCertificateSourceThe list of all certificate sourcesprotected Map<String, CertificateToken> A map between certificate id Strings and the related CertificateTokensprotected 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)protected Map<String, CertificateToken> A map between certificate id Strings and the related CertificateTokens for signing certificatesThe cached map of trusted lists with corresponding TLInfoprotected TokenExtractionStrategyThe token extraction strategyprotected Set<CertificateToken> The certificates used during the validation processprotected Set<RevocationToken<?>> The revocation used during the validation processprotected DateThe validation timeprotected Map<String, XmlCertificate> The cached map of certificatesprotected Map<String, XmlOrphanCertificateToken> The cached map of orphan certificatesprotected Map<String, XmlOrphanRevocationToken> The cached map of orphan revocation dataprotected Map<String, XmlRevocation> The cached map of revocation dataprotected Map<String, XmlTrustedList> The 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)build()BuildsXmlDiagnosticDataprotected XmlCertificatebuildDetachedXmlCertificate(CertificateToken certToken) This method builds anXmlCertificatefrom the givenCertificateTokenprotected XmlRevocationbuildDetachedXmlRevocation(RevocationToken<?> revocationToken) This method builds anXmlRevocationfrom the givenRevocationTokenprotected XmlOrphanCertificateTokenbuildXmlOrphanCertificateToken(CertificateToken certificateToken) This method builds anXmlOrphanCertificateTokenfrom the givenCertificateTokenprotected XmlOrphanTokensBuilds a list ofXmlOrphanTokensdefaultDigestAlgorithm(DigestAlgorithm digestAlgorithm) This method allows to set the defaultDigestAlgorithmwhich will be used for tokens' DigestAlgoAndValue calculationprotected Collection<CertificateToken> getUsedCertificatesByCertificateRef(CertificateRef certificateRef) Returns used certificate by thecertificateRefprotected XmlBasicSignaturegetXmlBasicSignature(Token token) GetsXmlBasicSignaturefor aTokenprotected XmlCertificateRefgetXmlCertificateRef(CertificateRef ref, CertificateRefOrigin origin) Builds aXmlCertificateReffromCertificateRefprotected XmlRevocationRefgetXmlCRLRevocationRef(CRLRef crlRef, Set<RevocationRefOrigin> origins) Builds aXmlRevocationReffromCRLRefprotected XmlDigestAlgoAndValuegetXmlDigestAlgoAndValue(DigestAlgorithm digestAlgo, byte[] digestValue) Builds aXmlDigestAlgoAndValueforDigestAlgorithmanddigestValueprotected XmlDigestAlgoAndValuegetXmlDigestAlgoAndValue(Digest digest) Builds aXmlDigestAlgoAndValueforDigestprotected List<XmlChainItem> getXmlForCertificateChain(Token token) Returns a certificate chain for thetokenprotected List<XmlChainItem> getXmlForCertificateChain(Token token, CertificateSource certificateSource) Returns a certificate chain for thetokenfrom thecertificateSourceprotected List<XmlChainItem> getXmlForCertificateChain(CertificateValidity certificateValidity, CertificateSource certificateSource) Builds a certificate chain for aCertificateValidityprotected XmlFoundCertificatesgetXmlFoundCertificates(Identifier tokenIdentifier, TokenCertificateSource certificateSource) Returns found certificates from the sourceprotected XmlFoundCertificatesgetXmlFoundCertificates(TokenCertificateSource certificateSource) Returns found certificates from the sourceprotected XmlRevocationRefgetXmlOCSPRevocationRef(OCSPRef ocspRef, Set<RevocationRefOrigin> origins) Builds aXmlRevocationReffromOCSPRefprotected XmlOrphanCertificategetXmlOrphanCertificate(CertificateOrigin origin, CertificateToken certificateToken, TokenCertificateSource certificateSource, CertificateToken signingCertificate) This method builds anXmlOrphanCertificateTokenprotected List<XmlRelatedCertificate> getXmlRelatedCertificateForOrphanReferences(TokenCertificateSource certificateSource) Returns a list ofXmlRelatedCertificates for orphan references withincertificateSourceprotected <R extends Revocation>
List<XmlRevocationRef> getXmlRevocationRefs(String tokenId, Map<RevocationRef<R>, Set<RevocationRefOrigin>> refsAndOrigins) Returns a list ofXmlRevocationReffor a token withtokenIdprotected XmlSignerInfogetXmlSignerInfo(SignerIdentifier signerIdentifier) Creates aXmlSignerInfofromSignerIdentifierprotected XmlSigningCertificategetXmlSigningCertificate(Identifier tokenIdentifier, CertificateValidity certificateValidity) Gets a signing certificate token for a token withtokenIdentifierprotected voidlinkSigningCertificateAndChains(Set<CertificateToken> certificates) Links the certificates and their certificate chainsprotected voidpopulateCertificateOriginMap(Map<String, XmlRelatedCertificate> relatedCertificatesMap, CertificateOrigin origin, List<CertificateToken> certificateTokens, TokenCertificateSource certificateSource) Fills the certificates origins map with the given propertiesprotected voidpopulateOrphanCertificateOriginMap(Map<String, XmlOrphanCertificate> orphanCertificatesMap, CertificateOrigin origin, List<CertificateToken> certificateTokens, TokenCertificateSource certificateSource, CertificateToken signingCertificate) Fills the orphan certificate map with the given valuesprotected XmlRelatedCertificatepopulateXmlRelatedCertificatesList(CertificateOrigin origin, CertificateToken cert, TokenCertificateSource certificateSource) Builds anXmlRelatedCertificateprotected voidpopulateXmlRelatedCertificatesList(List<XmlRelatedCertificate> relatesCertificates, TokenCertificateSource certificateSource, CertificateToken cert, CertificateRef certificateRef) Builds anXmlRelatedCertificateand populates therelatesCertificateslisttokenExtractionStrategy(TokenExtractionStrategy tokenExtractionStrategy) This method allows to set theTokenExtractionStrategyto follow for the token extractiontokenIdentifierProvider(TokenIdentifierProvider identifierProvider) This method allows to set theTokenIdentifierProviderfor identifiers generationusedCertificates(Set<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(XmlCertificateRef xmlCertificateRef, CertificateRef ref, 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
The token extraction strategy -
defaultDigestAlgorithm
The 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
The cached map of orphan certificates -
xmlOrphanRevocationTokensMap
The cached map of orphan revocation data -
referenceMap
-
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
-
-
Constructor Details
-
DiagnosticDataBuilder
protected DiagnosticDataBuilder()Default constructor instantiating object with null values
-
-
Method Details
-
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(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
This method allows to set the defaultDigestAlgorithmwhich will be used for tokens' DigestAlgoAndValue calculation- Parameters:
digestAlgorithm-DigestAlgorithmto set as default- Returns:
- the builder
-
build
-
linkSigningCertificateAndChains
Links the certificates and their certificate chains- Parameters:
certificates- a set ofCertificateTokens
-
buildXmlOrphanTokens
Builds a list ofXmlOrphanTokens- Returns:
XmlOrphanTokens
-
getXmlSignerInfo
Creates aXmlSignerInfofromSignerIdentifier- Parameters:
signerIdentifier-SignerIdentifier- Returns:
XmlSignerInfo
-
buildDetachedXmlRevocation
This method builds anXmlRevocationfrom the givenRevocationToken- Parameters:
revocationToken-RevocationToken- Returns:
XmlRevocation
-
getXmlRevocationRefs
protected <R extends Revocation> List<XmlRevocationRef> getXmlRevocationRefs(String tokenId, Map<RevocationRef<R>, Set<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
Builds aXmlRevocationReffromCRLRef- Parameters:
crlRef-CRLReforigins- a set ofRevocationRefOrigins- Returns:
XmlRevocationRef
-
getXmlOCSPRevocationRef
protected XmlRevocationRef getXmlOCSPRevocationRef(OCSPRef ocspRef, Set<RevocationRefOrigin> origins) Builds aXmlRevocationReffromOCSPRef- Parameters:
ocspRef-OCSPReforigins- a set ofRevocationRefOrigins- Returns:
XmlRevocationRef
-
getXmlForCertificateChain
Returns a certificate chain for thetoken- Parameters:
token-Token- Returns:
- a list of
XmlChainItem
-
getXmlForCertificateChain
protected List<XmlChainItem> getXmlForCertificateChain(Token token, CertificateSource certificateSource) Returns a certificate chain for thetokenfrom thecertificateSource- Parameters:
token-TokencertificateSource-CertificateSource- Returns:
- a list of
XmlChainItem
-
getXmlForCertificateChain
protected List<XmlChainItem> getXmlForCertificateChain(CertificateValidity certificateValidity, CertificateSource certificateSource) Builds a certificate chain for aCertificateValidity- Parameters:
certificateValidity-CertificateValiditycertificateSource-CertificateSource- Returns:
- a list of
XmlChainItem
-
getXmlSigningCertificate
protected XmlSigningCertificate getXmlSigningCertificate(Identifier tokenIdentifier, CertificateValidity certificateValidity) Gets a signing certificate token for a token withtokenIdentifier- Parameters:
tokenIdentifier-IdentifiercertificateValidity-CertificateValidity- Returns:
XmlSigningCertificate
-
getXmlFoundCertificates
Returns found certificates from the source- Parameters:
certificateSource-TokenCertificateSource- Returns:
XmlFoundCertificates
-
getXmlFoundCertificates
protected XmlFoundCertificates getXmlFoundCertificates(Identifier tokenIdentifier, TokenCertificateSource certificateSource) Returns found certificates from the source- Parameters:
tokenIdentifier-Identifierof the tokencertificateSource-TokenCertificateSource- Returns:
XmlFoundCertificates
-
populateCertificateOriginMap
protected void populateCertificateOriginMap(Map<String, XmlRelatedCertificate> relatedCertificatesMap, CertificateOrigin origin, List<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 XmlRelatedCertificate populateXmlRelatedCertificatesList(CertificateOrigin origin, CertificateToken cert, TokenCertificateSource certificateSource) Builds anXmlRelatedCertificate- Parameters:
origin-CertificateOrigincert-CertificateTokencertificateSource-TokenCertificateSource- Returns:
XmlRelatedCertificate
-
populateXmlRelatedCertificatesList
protected void populateXmlRelatedCertificatesList(List<XmlRelatedCertificate> relatesCertificates, TokenCertificateSource certificateSource, CertificateToken cert, CertificateRef certificateRef) Builds anXmlRelatedCertificateand populates therelatesCertificateslist- Parameters:
relatesCertificates- a list of created earlierXmlRelatedCertificatecertificateSource-TokenCertificateSourcecert-CertificateTokencertificateRef-CertificateRef
-
getXmlCertificateRef
Builds aXmlCertificateReffromCertificateRef- Parameters:
ref-XmlCertificateReforigin-CertificateRefOrigin- Returns:
XmlCertificateRef
-
populateOrphanCertificateOriginMap
protected void populateOrphanCertificateOriginMap(Map<String, XmlOrphanCertificate> orphanCertificatesMap, CertificateOrigin origin, List<CertificateToken> certificateTokens, TokenCertificateSource certificateSource, 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 XmlOrphanCertificate getXmlOrphanCertificate(CertificateOrigin origin, CertificateToken certificateToken, TokenCertificateSource certificateSource, CertificateToken signingCertificate) This method builds anXmlOrphanCertificateToken- Parameters:
origin-CertificateOrigincertificateToken-CertificateTokencertificateSource-TokenCertificateSourcesigningCertificate-CertificateToken- Returns:
XmlOrphanCertificateToken
-
buildXmlOrphanCertificateToken
protected XmlOrphanCertificateToken buildXmlOrphanCertificateToken(CertificateToken certificateToken) This method builds anXmlOrphanCertificateTokenfrom the givenCertificateToken- Parameters:
certificateToken-CertificateToken- Returns:
XmlOrphanCertificateToken
-
getXmlRelatedCertificateForOrphanReferences
protected List<XmlRelatedCertificate> getXmlRelatedCertificateForOrphanReferences(TokenCertificateSource certificateSource) Returns a list ofXmlRelatedCertificates for orphan references withincertificateSource- Parameters:
certificateSource-TokenCertificateSource- Returns:
- a list of
XmlRelatedCertificates
-
getUsedCertificatesByCertificateRef
protected Collection<CertificateToken> getUsedCertificatesByCertificateRef(CertificateRef certificateRef) Returns used certificate by thecertificateRef- Parameters:
certificateRef-CertificateRef- Returns:
- a collection of
CertificateTokens
-
verifyAgainstCertificateToken
protected void verifyAgainstCertificateToken(XmlCertificateRef xmlCertificateRef, CertificateRef ref, CertificateToken signingCertificate) Verifies the reference against a certificate token- Parameters:
xmlCertificateRef-XmlCertificateRefref-CertificateRefsigningCertificate-CertificateToken
-
getXmlBasicSignature
GetsXmlBasicSignaturefor aToken- Parameters:
token-Token- Returns:
XmlBasicSignature
-
buildDetachedXmlCertificate
This method builds anXmlCertificatefrom the givenCertificateToken- Parameters:
certToken-CertificateToken- Returns:
XmlCertificate
-
getXmlDigestAlgoAndValue
Builds aXmlDigestAlgoAndValueforDigest- Parameters:
digest-Digest- Returns:
XmlDigestAlgoAndValue
-
getXmlDigestAlgoAndValue
protected XmlDigestAlgoAndValue getXmlDigestAlgoAndValue(DigestAlgorithm digestAlgo, byte[] digestValue) Builds aXmlDigestAlgoAndValueforDigestAlgorithmanddigestValue- Parameters:
digestAlgo-DigestAlgorithmdigestValue- digest value bytes- Returns:
XmlDigestAlgoAndValue
-