Search in sources :

Example 6 with QualifyingProperty

use of xades4j.properties.QualifyingProperty in project xades4j by luisgoncalves.

the class XadesVerifierImpl method getValidationDate.

/**
 **********************************************************************************
 */
private Date getValidationDate(Collection<PropertyDataObject> qualifPropsData, XMLSignature signature, SignatureSpecificVerificationOptions verificationOptions) throws XAdES4jException {
    List sigTsData = CollectionUtils.filterByType(qualifPropsData, SignatureTimeStampData.class);
    // If no signature time-stamp is present, use the current date.
    if (sigTsData.isEmpty()) {
        return verificationOptions.getDefaultVerificationDate();
    }
    // TODO support multiple SignatureTimeStamps (section 7.3 last paragraph of Standard v.1.4.2)
    // This is a temporary solution.
    // - Properties should probably be verified in two stages (before and after cert path creation).
    // - Had to remove the custom structure verifier that checked if the SigningCertificate data was present.
    QualifyingPropertyVerificationContext ctx = new QualifyingPropertyVerificationContext(signature, new QualifyingPropertyVerificationContext.CertificationChainData(new ArrayList<X509Certificate>(0), new ArrayList<X509CRL>(0), null), /**/
    new QualifyingPropertyVerificationContext.SignedObjectsData(new ArrayList<RawDataObjectDesc>(0), signature));
    Collection<PropertyInfo> props = this.qualifyingPropertiesVerifier.verifyProperties(sigTsData, ctx);
    QualifyingProperty sigTs = props.iterator().next().getProperty();
    return ((SignatureTimeStampProperty) sigTs).getTime();
}
Also used : SignatureTimeStampProperty(xades4j.properties.SignatureTimeStampProperty) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) QualifyingProperty(xades4j.properties.QualifyingProperty)

Example 7 with QualifyingProperty

use of xades4j.properties.QualifyingProperty in project xades4j by luisgoncalves.

the class QualifyingPropertiesVerifierImpl method verifyProperties.

@Override
public Collection<PropertyInfo> verifyProperties(Collection<PropertyDataObject> unmarshalledProperties, QualifyingPropertyVerificationContext ctx) throws PropertyDataStructureException, InvalidPropertyException, QualifyingPropertyVerifierNotAvailableException {
    dataObjectsStructureVerifier.verifiyPropertiesDataStructure(unmarshalledProperties);
    Collection<PropertyInfo> props = new ArrayList<PropertyInfo>(unmarshalledProperties.size());
    for (PropertyDataObject propData : unmarshalledProperties) {
        QualifyingPropertyVerifier<PropertyDataObject> propVerifier = this.propertyVerifiersMapper.getVerifier(propData);
        QualifyingProperty p = propVerifier.verify(propData, ctx);
        if (null == p)
            throw new PropertyVerifierErrorException(propData.getClass().getName());
        props.add(new PropertyInfo(propData, p));
    }
    return Collections.unmodifiableCollection(props);
}
Also used : ArrayList(java.util.ArrayList) PropertyDataObject(xades4j.properties.data.PropertyDataObject) QualifyingProperty(xades4j.properties.QualifyingProperty)

Aggregations

QualifyingProperty (xades4j.properties.QualifyingProperty)7 ArrayList (java.util.ArrayList)3 SignatureTimeStampProperty (xades4j.properties.SignatureTimeStampProperty)2 PropertyDataObject (xades4j.properties.data.PropertyDataObject)2 Method (java.lang.reflect.Method)1 Date (java.util.Date)1 List (java.util.List)1 Test (org.junit.Test)1 UnsupportedAlgorithmException (xades4j.UnsupportedAlgorithmException)1 AllDataObjsTimeStampProperty (xades4j.properties.AllDataObjsTimeStampProperty)1 IndividualDataObjsTimeStampProperty (xades4j.properties.IndividualDataObjsTimeStampProperty)1 QualifyingProperties (xades4j.properties.QualifyingProperties)1 SignedDataObjectProperty (xades4j.properties.SignedDataObjectProperty)1 SignedProperties (xades4j.properties.SignedProperties)1 SignedSignatureProperty (xades4j.properties.SignedSignatureProperty)1 UnsignedDataObjectProperty (xades4j.properties.UnsignedDataObjectProperty)1 UnsignedProperties (xades4j.properties.UnsignedProperties)1 UnsignedSignatureProperty (xades4j.properties.UnsignedSignatureProperty)1 GenericDOMData (xades4j.properties.data.GenericDOMData)1 TimeStampTokenDigestException (xades4j.providers.TimeStampTokenDigestException)1