use of xades4j.verification.QualifyingPropertyVerificationContext.SignedObjectsData in project xades4j by luisgoncalves.
the class IndivDataObjsTimeStampVerifier method addPropSpecificTimeStampInputAndCreateProperty.
@Override
protected QualifyingProperty addPropSpecificTimeStampInputAndCreateProperty(IndividualDataObjsTimeStampData propData, TimeStampDigestInput digestInput, QualifyingPropertyVerificationContext ctx) throws CannotAddDataToDigestInputException, TimeStampVerificationException {
SignedObjectsData dataObjsData = ctx.getSignedObjectsData();
IndividualDataObjsTimeStampProperty prop = new IndividualDataObjsTimeStampProperty();
for (String objRef : propData.getIncludes()) {
RawDataObjectDesc o = dataObjsData.findSignedDataObject(objRef);
if (null == o) {
throw new TimeStampDigestInputException(IndividualDataObjsTimeStampProperty.PROP_NAME);
}
digestInput.addReference(o.getReference());
// No problem because when an exception is thrown the data
// structures in the verification process are not reused.
o.withDataObjectTimeStamp(prop);
}
return prop;
}
use of xades4j.verification.QualifyingPropertyVerificationContext.SignedObjectsData in project xades4j by luisgoncalves.
the class CommitmentTypeVerifier method verify.
@Override
public QualifyingProperty verify(CommitmentTypeData propData, QualifyingPropertyVerificationContext ctx) throws CommitmentTypeVerificationException {
String uri = propData.getUri(), desc = propData.getDescription();
Collection<String> objsReferences = propData.getObjReferences();
CommitmentTypePropertyBase property;
if (objsReferences != null) {
// "Check that all the ObjectReference elements actually reference
// ds:Reference elements from the signature."
SignedObjectsData signedObjsData = ctx.getSignedObjectsData();
CommitmentTypeProperty commitmentTypeProperty = new CommitmentTypeProperty(uri, desc);
for (String objRef : objsReferences) {
RawDataObjectDesc dataObj = signedObjsData.findSignedDataObject(objRef);
if (null == dataObj)
throw new CommitmentTypeVerificationException(objRef);
// Associate the property to the data object.
dataObj.withCommitmentType(commitmentTypeProperty);
}
property = commitmentTypeProperty;
} else {
property = new AllDataObjsCommitmentTypeProperty(uri, desc);
}
if (propData.getQualifiers() != null) {
for (Object q : propData.getQualifiers()) {
if (q instanceof String) {
property.withQualifier((String) q);
} else if (q instanceof Element) {
property.withQualifier((Element) q);
}
}
}
return property;
}
Aggregations