use of org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties in project camel by apache.
the class XAdESSignaturePropertiesTest method invalidXmlFragmentForClaimedRole.
@Test
public void invalidXmlFragmentForClaimedRole() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:exception");
mock.expectedMessageCount(1);
XmlSignerEndpoint endpoint = getSignerEndpoint();
XAdESSignatureProperties props = (XAdESSignatureProperties) endpoint.getProperties();
// Element 'ClaimedRole' is not closed correctly
props.setSignerClaimedRoles(Collections.singletonList("<ClaimedRole>wrong XML fragment<ClaimedRole>"));
sendBody("direct:enveloping", payload, Collections.<String, Object>emptyMap());
assertMockEndpointsSatisfied();
checkThrownException(mock, XmlSignatureException.class, "The XAdES confguration is invalid. The list of the claimed roles contains the invalid entry '<ClaimedRole>wrong XML fragment<ClaimedRole>'. An entry must either be a text or" + " an XML fragment with the root element 'ClaimedRole' with the namespace 'http://uri.etsi.org/01903/v1.3.2#'.", null);
}
use of org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties in project camel by apache.
the class XAdESSignaturePropertiesTest method testExceptionSigPolicyDigestAlgoMissing.
private void testExceptionSigPolicyDigestAlgoMissing(String value) throws InterruptedException, Exception {
MockEndpoint mock = getMockEndpoint("mock:exception");
mock.expectedMessageCount(1);
XmlSignerEndpoint endpoint = getSignerEndpoint();
XAdESSignatureProperties props = (XAdESSignatureProperties) endpoint.getProperties();
props.setSignaturePolicyDigestAlgorithm(value);
sendBody("direct:enveloping", payload, Collections.<String, Object>emptyMap());
assertMockEndpointsSatisfied();
checkThrownException(mock, XmlSignatureException.class, "The XAdES-EPES confguration is invalid. The digest algorithm for the signature policy is missing.", null);
}
use of org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties in project camel by apache.
the class XAdESSignaturePropertiesTest method allPropertiesEmpty.
@Test
public void allPropertiesEmpty() throws Exception {
XmlSignerEndpoint endpoint = getSignerEndpoint();
XAdESSignatureProperties props = new XAdESSignatureProperties();
props.setAddSigningTime(false);
props.setCommitmentTypeId("");
props.setCommitmentTypeIdDescription("");
props.setCommitmentTypeIdQualifier("");
props.setDataObjectFormatDescription("");
props.setDataObjectFormatIdentifier("");
props.setDataObjectFormatIdentifierDescription("");
props.setDataObjectFormatIdentifierQualifier("");
props.setDataObjectFormatMimeType("");
props.setDigestAlgorithmForSigningCertificate("");
props.setSignaturePolicy("None");
props.setSigPolicyId("");
props.setSigPolicyIdDescription("");
props.setSigPolicyIdQualifier("");
props.setSignaturePolicyDigestAlgorithm("");
props.setSignaturePolicyDigestValue("");
props.setSignatureProductionPlaceCity("");
props.setSignatureProductionPlaceCountryName("");
props.setSignatureProductionPlacePostalCode("");
props.setSignatureProductionPlaceStateOrProvince("");
endpoint.setProperties(props);
Document doc = testEnveloping();
// expecting no Qualifying Properties
checkNode(doc, "/ds:Signature/ds:Object/etsi:QualifyingProperties", getPrefix2NamespaceMap(), false);
}
use of org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties in project camel by apache.
the class XAdESSignaturePropertiesTest method testExceptionSigPolicyIdMissing.
private void testExceptionSigPolicyIdMissing(String value) throws InterruptedException, Exception {
MockEndpoint mock = getMockEndpoint("mock:exception");
mock.expectedMessageCount(1);
XmlSignerEndpoint endpoint = getSignerEndpoint();
XAdESSignatureProperties props = (XAdESSignatureProperties) endpoint.getProperties();
props.setSigPolicyId(value);
sendBody("direct:enveloping", payload, Collections.<String, Object>emptyMap());
assertMockEndpointsSatisfied();
checkThrownException(mock, XmlSignatureException.class, "The XAdES-EPES confguration is invalid. The signature policy identifier is missing.", null);
}
use of org.apache.camel.component.xmlsecurity.api.XAdESSignatureProperties in project camel by apache.
the class XAdESSignaturePropertiesTest method invalidXmlFragmentForCommitmentTypeQualifier.
@Test
public void invalidXmlFragmentForCommitmentTypeQualifier() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:exception");
mock.expectedMessageCount(1);
XmlSignerEndpoint endpoint = getSignerEndpoint();
XAdESSignatureProperties props = (XAdESSignatureProperties) endpoint.getProperties();
// end tag is not correct
props.setCommitmentTypeQualifiers(Collections.singletonList("<CommitmentTypeQualifier>wrong XML fragment<CommitmentTypeQualifier>"));
sendBody("direct:enveloping", payload, Collections.<String, Object>emptyMap());
assertMockEndpointsSatisfied();
checkThrownException(mock, XmlSignatureException.class, "The XAdES confguration is invalid. The list of the commitment type qualifiers contains the invalid entry '<CommitmentTypeQualifier>wrong XML fragment<CommitmentTypeQualifier>'." + " An entry must either be a text or an XML fragment with the root element 'CommitmentTypeQualifier' with the namespace 'http://uri.etsi.org/01903/v1.3.2#'.", null);
}
Aggregations