Search in sources :

Example 1 with SignaturePolicyBase

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

the class SignerTTest method testSignTWithPolicy.

@Test
public void testSignTWithPolicy() throws Exception {
    System.out.println("signTWithPolicy");
    Document doc = getTestDocument();
    Element elemToSign = doc.getDocumentElement();
    SignerT signer = (SignerT) new XadesTSigningProfile(keyingProviderMy).withPolicyProvider(new SignaturePolicyInfoProvider() {

        @Override
        public SignaturePolicyBase getSignaturePolicy() {
            return new SignaturePolicyImpliedProperty();
        }
    }).newSigner();
    new Enveloped(signer).sign(elemToSign);
    outputDocument(doc, "document.signed.t.epes.xml");
}
Also used : SignaturePolicyBase(xades4j.properties.SignaturePolicyBase) SignaturePolicyInfoProvider(xades4j.providers.SignaturePolicyInfoProvider) Element(org.w3c.dom.Element) SignaturePolicyImpliedProperty(xades4j.properties.SignaturePolicyImpliedProperty) Document(org.w3c.dom.Document) Test(org.junit.Test)

Example 2 with SignaturePolicyBase

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

the class PropertiesUtils method addXadesEpesProperties.

public static void addXadesEpesProperties(Collection<SignedSignatureProperty> ssp, SignaturePolicyInfoProvider policyInfoProvider) {
    SignaturePolicyBase policyProp = policyInfoProvider.getSignaturePolicy();
    if (null == policyProp)
        throw new NullPointerException("Null policy");
    ssp.add(policyProp);
}
Also used : SignaturePolicyBase(xades4j.properties.SignaturePolicyBase)

Aggregations

SignaturePolicyBase (xades4j.properties.SignaturePolicyBase)2 Test (org.junit.Test)1 Document (org.w3c.dom.Document)1 Element (org.w3c.dom.Element)1 SignaturePolicyImpliedProperty (xades4j.properties.SignaturePolicyImpliedProperty)1 SignaturePolicyInfoProvider (xades4j.providers.SignaturePolicyInfoProvider)1