Skip to content

Commit

Permalink
Update Maven Surefire so that all tests are picked-up and fix failing…
Browse files Browse the repository at this point in the history
… tests
  • Loading branch information
luisgoncalves committed Jun 29, 2023
1 parent 690aef8 commit d763955
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 24 deletions.
15 changes: 15 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
<version>4.13.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>2.0.7</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
Expand Down Expand Up @@ -92,6 +98,15 @@
</distributionManagement>

<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.1.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
6 changes: 4 additions & 2 deletions src/test/java/xades4j/production/OtherSignerTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,10 @@ public void testSignWithManifest() throws Exception
XadesSigner signer = new XadesBesSigningProfile(keyingProviderMy).newSigner();

DataObjectDesc obj1 = new EnvelopedManifest()
.withSignedDataObject(new DataObjectReference("logo-01.png"))
.withSignedDataObject(new DataObjectReference("#" + root.getAttribute("Id"))
.withTransform(new EnvelopedSignatureTransform()))
.withSignedDataObject(new EnvelopedXmlObject(doc.createTextNode("DATA")));
signer.sign(new SignedDataObjects(obj1).withBaseUri("http://luisgoncalves.github.io/xades4j/images/"), root);
signer.sign(new SignedDataObjects(obj1), root);

outputDocument(doc, "document.signed.bes.manifest.xml");
}
Expand Down Expand Up @@ -139,6 +140,7 @@ public void testSignatureAlgorithms() throws Exception
.withSignatureAlgorithm("RSA", ALGO_ID_SIGNATURE_RSA_SHA512)
.withCanonicalizationAlgorithmForTimeStampProperties(new ExclusiveCanonicalXMLWithoutComments())
.withDigestAlgorithmForReferenceProperties(ALGO_ID_DIGEST_SHA512))
.with(DEFAULT_TEST_TSA)
.newSigner();
new Enveloped(signer).sign(elemToSign);

Expand Down
1 change: 0 additions & 1 deletion src/test/java/xades4j/verification/OtherVerifierTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public void testCustomVerifierCanUseBuiltInVerifier() throws Exception
public void testVerifyWithManifest() throws Exception
{
SignatureSpecificVerificationOptions options = new SignatureSpecificVerificationOptions()
.useBaseUri("http://luisgoncalves.github.io/xades4j/images/")
.followManifests(true);
verifySignature("document.signed.bes.manifest.xml", mySigsVerificationProfile, options);
}
Expand Down
40 changes: 19 additions & 21 deletions src/test/xml/document.signed.bes.manifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,26 @@
</t:song>
</t:tracks>
</album>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be">
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8">
<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
<ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
<ds:Reference Id="xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be-ref0" Type="http://www.w3.org/2000/09/xmldsig#Manifest" URI="#xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be-manifest0">
<ds:Reference Id="xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8-ref0" Type="http://www.w3.org/2000/09/xmldsig#Manifest" URI="#xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8-manifest0">
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>kCtt9xDKGbmt5ui6rg1J40WOHLjbWDiRRdOwjhd5Cmc=</ds:DigestValue>
<ds:DigestValue>3SWBDoHIDERa/DTWxAjtKeTuhpB50ZXLS8oHPzYebek=</ds:DigestValue>
</ds:Reference>
<ds:Reference Type="http://uri.etsi.org/01903#SignedProperties" URI="#xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be-signedprops">
<ds:Reference Type="http://uri.etsi.org/01903#SignedProperties" URI="#xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8-signedprops">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>JS6uI3YyZUsKEQQezECWF7URB24TKYv8rHC4zsNZdaQ=</ds:DigestValue>
<ds:DigestValue>RoKXzCLfjNU098pqp6YkiCVn9pSo9kZ7YSf+c5KBaoM=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>
<ds:SignatureValue Id="xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be-sigvalue">
Teasc7xVuUfzujnQeaB34XPZKAD1WZeKrehk+0O7WhVjpOZUUuGXxfp4f4BeUj+7X2MAizOxmo8L&#13;
0B3rKjVFgRX2uJZ511sjfZZNhu3xhpkjnj3Vbx6OZLA/oX2lvFxOznDmD/lbhT92klcpcZSr0ULw&#13;
3or42VwdN+0/18rgFoE=
<ds:SignatureValue Id="xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8-sigvalue">
BwZqG4ryswv3oRX60HpL87U7uOjMOrNXUoY6BCmNKsjEG7C65myxpxhqrypeJvIUivB9oSc620WQ&#13;
ovoXIYhRjzCQoMCy8r1Vq19sdgq02LcTpv2AaTW2+uOUeQ2AtU1y7J1CLxrR5lOxCS5bsGiydfeK&#13;
q1cduqoS2cqVvOOY7yA=
</ds:SignatureValue>
<ds:KeyInfo>
<ds:X509Data>
Expand All @@ -62,23 +62,21 @@ EwZUZXN0Q0GCEN00x9qe7SuWQvpLK0/oay8wCQYFKw4DAh0FAAOBgQBSma8g9dQjiQo4WUljRRuG&#13
yMUVRyCqW/9oRz8+0EoLNR/AhrIlGqdNbqQ1BkncgNNdqMAus5VD34v/EhgrkgWN5fZajMpYsmcR&#13;
Ahu4PzJ6hggAlWWMy245JwIYuV0s1Oi39GVTxVNOBIX//AONZlGWO4S2Psb1mqdZ99b/MugsaA==
</ds:X509Certificate>
<ds:X509IssuerSerial>
<ds:X509IssuerName>cn=Itermediate,ou=CC,o=ISEL,c=PT</ds:X509IssuerName>
<ds:X509SerialNumber>-119284162484605703133798696662099777223</ds:X509SerialNumber>
</ds:X509IssuerSerial>
<ds:X509SubjectName>cn=Luis Goncalves,ou=CC,o=ISEL,c=PT</ds:X509SubjectName>
</ds:X509Data>
</ds:KeyInfo>
<ds:Object Id="xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be-manifest0-object1">DATA</ds:Object>
<ds:Object><ds:Manifest Id="xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be-manifest0">
<ds:Reference Id="xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be-manifest0-ref0" URI="logo-01.png">
<ds:Object Id="xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8-manifest0-object1">DATA</ds:Object>
<ds:Object><ds:Manifest Id="xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8-manifest0">
<ds:Reference Id="xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8-manifest0-ref0" URI="#root">
<ds:Transforms>
<ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
</ds:Transforms>
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>nAtJEY68aecWPRPc8Mi/M99i1+IdR39gdWRJnC/35hQ=</ds:DigestValue>
<ds:DigestValue>rD/g8soqKz8EiPUBhEWfcQacS0ta4ULHX3dKMEH6ZoQ=</ds:DigestValue>
</ds:Reference>
<ds:Reference Id="xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be-manifest0-ref1" Type="http://www.w3.org/2000/09/xmldsig#Object" URI="#xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be-manifest0-object1">
<ds:Reference Id="xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8-manifest0-ref1" Type="http://www.w3.org/2000/09/xmldsig#Object" URI="#xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8-manifest0-object1">
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
<ds:DigestValue>KBQMQepvIZkHVK+BfLMnJvkicCeXqWTfw23C13cECM8=</ds:DigestValue>
<ds:DigestValue>MgIULoOFneHLtKsaBNCp61FCDJBynexXXwDCIK68xek=</ds:DigestValue>
</ds:Reference>
</ds:Manifest></ds:Object>
<ds:Object><xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:xades141="http://uri.etsi.org/01903/v1.4.1#" Target="#xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be"><xades:SignedProperties Id="xmldsig-2b8aa881-89e3-4101-8c66-e26fcb7145be-signedprops"><xades:SignedSignatureProperties><xades:SigningTime>2021-05-30T14:49:17.229+01:00</xades:SigningTime><xades:SigningCertificate><xades:Cert><xades:CertDigest><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>4btVb5gQ5cdcNhGpvDSWQZabPQrR9jf1x8e3YF9Ajss=</ds:DigestValue></xades:CertDigest><xades:IssuerSerial><ds:X509IssuerName>cn=Itermediate,ou=CC,o=ISEL,c=PT</ds:X509IssuerName><ds:X509SerialNumber>-119284162484605703133798696662099777223</ds:X509SerialNumber></xades:IssuerSerial></xades:Cert><xades:Cert><xades:CertDigest><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>vm5QpbblsWV7fCYXotPhNTeCt4nk8cLFuF36L5RJ4Ok=</ds:DigestValue></xades:CertDigest><xades:IssuerSerial><ds:X509IssuerName>cn=TestCA,ou=CC,o=ISEL,c=PT</ds:X509IssuerName><ds:X509SerialNumber>-46248926895392336918291885380930606289</ds:X509SerialNumber></xades:IssuerSerial></xades:Cert><xades:Cert><xades:CertDigest><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>AUaN+IdhKQqxIVmEOrFwq+Dn22ebTkXJqD3BoOP/x8E=</ds:DigestValue></xades:CertDigest><xades:IssuerSerial><ds:X509IssuerName>cn=TestCA,ou=CC,o=ISEL,c=PT</ds:X509IssuerName><ds:X509SerialNumber>-99704378678639105802976522062798066869</ds:X509SerialNumber></xades:IssuerSerial></xades:Cert></xades:SigningCertificate></xades:SignedSignatureProperties></xades:SignedProperties></xades:QualifyingProperties></ds:Object>
<ds:Object><xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" xmlns:xades141="http://uri.etsi.org/01903/v1.4.1#" Target="#xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8"><xades:SignedProperties Id="xmldsig-3b799c4d-7c36-4f2b-a264-a94d4ca44ba8-signedprops"><xades:SignedSignatureProperties><xades:SigningTime>2023-06-29T22:53:11.724+01:00</xades:SigningTime><xades:SigningCertificate><xades:Cert><xades:CertDigest><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>4btVb5gQ5cdcNhGpvDSWQZabPQrR9jf1x8e3YF9Ajss=</ds:DigestValue></xades:CertDigest><xades:IssuerSerial><ds:X509IssuerName>cn=Itermediate,ou=CC,o=ISEL,c=PT</ds:X509IssuerName><ds:X509SerialNumber>-119284162484605703133798696662099777223</ds:X509SerialNumber></xades:IssuerSerial></xades:Cert><xades:Cert><xades:CertDigest><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>vm5QpbblsWV7fCYXotPhNTeCt4nk8cLFuF36L5RJ4Ok=</ds:DigestValue></xades:CertDigest><xades:IssuerSerial><ds:X509IssuerName>cn=TestCA,ou=CC,o=ISEL,c=PT</ds:X509IssuerName><ds:X509SerialNumber>-46248926895392336918291885380930606289</ds:X509SerialNumber></xades:IssuerSerial></xades:Cert><xades:Cert><xades:CertDigest><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>AUaN+IdhKQqxIVmEOrFwq+Dn22ebTkXJqD3BoOP/x8E=</ds:DigestValue></xades:CertDigest><xades:IssuerSerial><ds:X509IssuerName>cn=TestCA,ou=CC,o=ISEL,c=PT</ds:X509IssuerName><ds:X509SerialNumber>-99704378678639105802976522062798066869</ds:X509SerialNumber></xades:IssuerSerial></xades:Cert></xades:SigningCertificate></xades:SignedSignatureProperties></xades:SignedProperties></xades:QualifyingProperties></ds:Object>
</ds:Signature></collection>

0 comments on commit d763955

Please sign in to comment.