Search in sources :

Example 1 with SignaturePolicyDocumentProvider

use of xades4j.providers.SignaturePolicyDocumentProvider in project xades4j by luisgoncalves.

the class DefaultVerificationBindingsModule method configure.

@Override
protected void configure() {
    bind(MessageDigestEngineProvider.class).to(DefaultMessageDigestProvider.class);
    bind(TimeStampVerificationProvider.class).to(DefaultTimeStampVerificationProvider.class);
    bind(SignaturePolicyDocumentProvider.class).toInstance(new SignaturePolicyDocumentProvider() {

        @Override
        public InputStream getSignaturePolicyDocumentStream(ObjectIdentifier sigPolicyId) {
            return null;
        }
    });
    // QualifyingPropertiesVerifier is not configurable but the individual
    // verifiers may have dependencies.
    bind(QualifyingPropertiesVerifier.class).to(QualifyingPropertiesVerifierImpl.class);
    bind(QualifyingPropertyVerifiersMapper.class).to(QualifyingPropertyVerifiersMapperImpl.class);
    // customGlobalStructureVerifiers.add(new CustomPropertiesDataObjsStructureVerifier()
    // {
    // @Override
    // public void verifiy(DataGetter<PropertyDataObject> dataObjsGetter) throws PropertyDataStructureException
    // {
    // if (dataObjsGetter.getOfType(SigningCertificateData.class).isEmpty())
    // throw new PropertyDataStructureException("property is required and isn't present", SigningCertificateProperty.PROP_NAME);
    // }
    // });
    // QualifyingPropertyVerifiersMapperImpl relies on the injector to get
    // the individual verifiers, so they need to be bound.
    // - SignedSignatureProperties
    bindBuiltInVerifier(SigningTimeData.class, SigningTimeVerifier.class);
    bindBuiltInVerifier(SignerRoleData.class, SignerRoleVerifier.class);
    bindBuiltInVerifier(SignatureProdPlaceData.class, SigProdPlaceVerifier.class);
    bindBuiltInVerifier(SigningCertificateData.class, SigningCertificateVerifier.class);
    bindBuiltInVerifier(SignaturePolicyData.class, SignaturePolicyVerifier.class);
    // - SignedDataObjectProperties
    bindBuiltInVerifier(CommitmentTypeData.class, CommitmentTypeVerifier.class);
    bindBuiltInVerifier(DataObjectFormatData.class, DataObjFormatVerifier.class);
    bindBuiltInVerifier(AllDataObjsTimeStampData.class, AllDataObjsTimeStampVerifier.class);
    bindBuiltInVerifier(IndividualDataObjsTimeStampData.class, IndivDataObjsTimeStampVerifier.class);
    // - UnsignedSignatureProperties
    bindBuiltInVerifier(SignatureTimeStampData.class, SignatureTimeStampVerifier.class);
    bindBuiltInVerifier(CompleteCertificateRefsData.class, CompleteCertRefsVerifier.class);
    bindBuiltInVerifier(CompleteRevocationRefsData.class, CompleteRevocRefsVerifier.class);
    MapBinder<QName, QualifyingPropertyVerifier> unkownElemsBinder = MapBinder.newMapBinder(binder(), QName.class, QualifyingPropertyVerifier.class);
    unkownElemsBinder.addBinding(new QName(QualifyingProperty.XADES_XMLNS, CounterSignatureProperty.PROP_NAME)).to(CounterSignatureVerifier.class);
    // Verification based on XML elements names.
    bind(new TypeLiteral<QualifyingPropertyVerifier<GenericDOMData>>() {
    }).to(GenericDOMDataVerifier.class);
    // Ensure empty sets when no bindings are defined
    Multibinder.newSetBinder(binder(), RawSignatureVerifier.class);
    Multibinder.newSetBinder(binder(), CustomSignatureVerifier.class);
    Multibinder.newSetBinder(binder(), CustomPropertiesDataObjsStructureVerifier.class);
}
Also used : TimeStampVerificationProvider(xades4j.providers.TimeStampVerificationProvider) DefaultTimeStampVerificationProvider(xades4j.providers.impl.DefaultTimeStampVerificationProvider) InputStream(java.io.InputStream) QName(javax.xml.namespace.QName) GenericDOMData(xades4j.properties.data.GenericDOMData) SignaturePolicyDocumentProvider(xades4j.providers.SignaturePolicyDocumentProvider) TypeLiteral(com.google.inject.TypeLiteral) MessageDigestEngineProvider(xades4j.providers.MessageDigestEngineProvider) ObjectIdentifier(xades4j.properties.ObjectIdentifier)

Aggregations

TypeLiteral (com.google.inject.TypeLiteral)1 InputStream (java.io.InputStream)1 QName (javax.xml.namespace.QName)1 ObjectIdentifier (xades4j.properties.ObjectIdentifier)1 GenericDOMData (xades4j.properties.data.GenericDOMData)1 MessageDigestEngineProvider (xades4j.providers.MessageDigestEngineProvider)1 SignaturePolicyDocumentProvider (xades4j.providers.SignaturePolicyDocumentProvider)1 TimeStampVerificationProvider (xades4j.providers.TimeStampVerificationProvider)1 DefaultTimeStampVerificationProvider (xades4j.providers.impl.DefaultTimeStampVerificationProvider)1