Ejemplo n.º 1
0
 /**
  * Returns the id of the token. The signature is identified by its index: 0 for the first one.
  *
  * @param index (position/order) of the signature within the report
  * @return {@code String} identifying the token
  */
 public String getBasicBuildingBlocksSignatureId(final int index) {
   List<XmlBasicBuildingBlocks> bbbs = jaxbDetailedReport.getBasicBuildingBlocks();
   if (CollectionUtils.size(bbbs) >= index) {
     XmlBasicBuildingBlocks bbb = jaxbDetailedReport.getBasicBuildingBlocks().get(index);
     if (bbb != null) {
       return bbb.getId();
     }
   }
   return null;
 }
Ejemplo n.º 2
0
 /**
  * This method returns the result of the Basic Building Block for a token (signature, timestamp,
  * revocation)
  *
  * @param tokenId
  * @return the SubIndication
  */
 public SubIndication getBasicBuildingBlocksSubIndication(String tokenId) {
   List<XmlBasicBuildingBlocks> basicBuildingBlocks = jaxbDetailedReport.getBasicBuildingBlocks();
   for (XmlBasicBuildingBlocks xmlBasicBuildingBlocks : basicBuildingBlocks) {
     if (StringUtils.equals(xmlBasicBuildingBlocks.getId(), tokenId)) {
       return xmlBasicBuildingBlocks.getConclusion().getSubIndication();
     }
   }
   return null;
 }
Ejemplo n.º 3
0
 private XmlConstraintsConclusion getArchivalValidationConclusion(String signatureId) {
   List<eu.europa.esig.dss.jaxb.detailedreport.XmlSignature> signatures =
       detailedReport.getSignatures();
   for (eu.europa.esig.dss.jaxb.detailedreport.XmlSignature xmlSignature : signatures) {
     if (StringUtils.equals(signatureId, xmlSignature.getId())) {
       return xmlSignature.getValidationProcessArchivalData();
     }
   }
   return null;
 }
Ejemplo n.º 4
0
 public List<String> getRevocationIds() {
   List<String> result = new ArrayList<String>();
   List<XmlBasicBuildingBlocks> bbbs = jaxbDetailedReport.getBasicBuildingBlocks();
   for (XmlBasicBuildingBlocks bbb : bbbs) {
     if (StringUtils.equals(Context.REVOCATION.name(), bbb.getType())) {
       result.add(bbb.getId());
     }
   }
   return result;
 }
Ejemplo n.º 5
0
 private XmlSignature getXmlSignatureById(String signatureId) {
   List<XmlSignature> signatures = jaxbDetailedReport.getSignatures();
   if (CollectionUtils.isNotEmpty(signatures)) {
     for (XmlSignature xmlSignature : signatures) {
       if (StringUtils.equals(signatureId, xmlSignature.getId())) {
         return xmlSignature;
       }
     }
   }
   return null;
 }
Ejemplo n.º 6
0
 public List<String> getSignatureIds() {
   List<String> result = new ArrayList<String>();
   List<XmlBasicBuildingBlocks> bbbs = jaxbDetailedReport.getBasicBuildingBlocks();
   for (XmlBasicBuildingBlocks bbb : bbbs) {
     if (StringUtils.equals(Context.SIGNATURE.name(), bbb.getType())
         || StringUtils.equals(Context.COUNTER_SIGNATURE.name(), bbb.getType())) {
       result.add(bbb.getId());
     }
   }
   return result;
 }
Ejemplo n.º 7
0
 public SubIndication getTimestampValidationSubIndication(String timestampId) {
   List<XmlSignature> signatures = jaxbDetailedReport.getSignatures();
   if (CollectionUtils.isNotEmpty(signatures)) {
     for (XmlSignature xmlSignature : signatures) {
       List<XmlValidationProcessTimestamps> validationTimestamps =
           xmlSignature.getValidationProcessTimestamps();
       if (CollectionUtils.isNotEmpty(validationTimestamps)) {
         for (XmlValidationProcessTimestamps tspValidation : validationTimestamps) {
           if (StringUtils.equals(tspValidation.getId(), timestampId)
               && tspValidation.getConclusion() != null) {
             return tspValidation.getConclusion().getSubIndication();
           }
         }
       }
     }
   }
   return null;
 }
Ejemplo n.º 8
0
 private Set<String> getInfos(String signatureId) {
   Set<String> infos = new HashSet<String>();
   List<eu.europa.esig.dss.jaxb.detailedreport.XmlSignature> signatures =
       detailedReport.getSignatures();
   for (eu.europa.esig.dss.jaxb.detailedreport.XmlSignature xmlSignature : signatures) {
     if (StringUtils.equals(signatureId, xmlSignature.getId())) {
       collectInfos(infos, xmlSignature.getValidationProcessBasicSignatures());
       List<XmlValidationProcessTimestamps> validationProcessTimestamps =
           xmlSignature.getValidationProcessTimestamps();
       if (CollectionUtils.isNotEmpty(validationProcessTimestamps)) {
         for (XmlValidationProcessTimestamps xmlValidationProcessTimestamps :
             validationProcessTimestamps) {
           collectInfos(infos, xmlValidationProcessTimestamps);
         }
       }
       collectInfos(infos, xmlSignature.getValidationProcessLongTermData());
       collectInfos(infos, xmlSignature.getValidationProcessArchivalData());
     }
   }
   // Collections.sort(infos);
   return infos;
 }
Ejemplo n.º 9
0
 private void collectInfos(Set<String> result, XmlConstraintsConclusion constraintConclusion) {
   if (constraintConclusion != null) {
     if (CollectionUtils.isNotEmpty(constraintConclusion.getConstraint())) {
       for (XmlConstraint constraint : constraintConclusion.getConstraint()) {
         if (StringUtils.isNotEmpty(constraint.getId())) {
           List<XmlBasicBuildingBlocks> basicBuildingBlocks =
               detailedReport.getBasicBuildingBlocks();
           if (CollectionUtils.isNotEmpty(basicBuildingBlocks)) {
             for (XmlBasicBuildingBlocks xmlBasicBuildingBlocks : basicBuildingBlocks) {
               if (StringUtils.equals(xmlBasicBuildingBlocks.getId(), constraint.getId())) {
                 collectInfos(result, xmlBasicBuildingBlocks);
               }
             }
           }
         }
         XmlName info = constraint.getInfo();
         if (info != null) {
           result.add(info.getValue());
         }
       }
     }
   }
 }
Ejemplo n.º 10
0
 /**
  * Returns the number of Basic Building Blocks.
  *
  * @return {@code int} number of Basic Building Blocks
  */
 public int getBasicBuildingBlocksNumber() {
   return jaxbDetailedReport.getBasicBuildingBlocks().size();
 }