-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #313 from luisgoncalves/support-sig-alg-parameters
Add support for signature algorithm parameters
- Loading branch information
Showing
9 changed files
with
243 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/main/java/xades4j/production/SignatureMethodAlgorithm.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* XAdES4j - A Java library for generation and verification of XAdES signatures. | ||
* Copyright (C) 2024 Luis Goncalves. | ||
* | ||
* XAdES4j is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU Lesser General Public License as published by the Free | ||
* Software Foundation; either version 3 of the License, or any later version. | ||
* | ||
* XAdES4j is distributed in the hope that it will be useful, but WITHOUT | ||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more | ||
* details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License along | ||
* with XAdES4j. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package xades4j.production; | ||
|
||
import xades4j.algorithms.Algorithm; | ||
|
||
import javax.annotation.Nullable; | ||
import java.security.spec.AlgorithmParameterSpec; | ||
|
||
final class SignatureMethodAlgorithm extends Algorithm | ||
{ | ||
private final AlgorithmParameterSpec parameters; | ||
|
||
SignatureMethodAlgorithm(String uri, @Nullable AlgorithmParameterSpec parameters) | ||
{ | ||
super(uri); | ||
this.parameters = parameters; | ||
} | ||
|
||
SignatureMethodAlgorithm(String uri) | ||
{ | ||
this(uri, null); | ||
} | ||
|
||
@Nullable | ||
AlgorithmParameterSpec getParameters() | ||
{ | ||
return parameters; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?xml version="1.0" encoding="UTF-8"?><collection Id="root"> | ||
<album> | ||
<title>Questions, unanswered</title> | ||
<artist>Steve and the flubberblubs</artist> | ||
<year>1989</year> | ||
<t:tracks xmlns:t="http://test.xades4j/tracks"> | ||
<t:song length="4:05" tracknumber="1"> | ||
<t:title>What do you know?</t:title> | ||
<t:artist>Steve and the flubberblubs</t:artist> | ||
<t:lastplayed>2006-10-17-08:31</t:lastplayed> | ||
</t:song> | ||
<t:song length="3:45" tracknumber="2"> | ||
<t:title>Who do you know?</t:title> | ||
<t:artist>Steve and the flubberblubs</t:artist> | ||
<t:lastplayed>2006-10-17-08:35</t:lastplayed> | ||
</t:song> | ||
<t:song length="5:14" tracknumber="3"> | ||
<t:title>When do you know?</t:title> | ||
<t:artist>Steve and the flubberblubs</t:artist> | ||
<t:lastplayed>2006-10-17-08:39</t:lastplayed> | ||
</t:song> | ||
<t:song length="4:19" tracknumber="4"> | ||
<t:title>Do you know?</t:title> | ||
<t:artist>Steve and the flubberblubs</t:artist> | ||
<t:lastplayed>2006-10-17-08:44</t:lastplayed> | ||
</t:song> | ||
</t:tracks> | ||
</album> | ||
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="signature-51bb5edf-039c-4c35-ab4b-4304e73a93ee"> | ||
<ds:SignedInfo> | ||
<ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/> | ||
<ds:SignatureMethod Algorithm="http://www.w3.org/2007/05/xmldsig-more#rsa-pss"> | ||
<pss:RSAPSSParams xmlns:pss="http://www.w3.org/2007/05/xmldsig-more#"> | ||
<ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> | ||
<pss:SaltLength>64</pss:SaltLength> | ||
<pss:TrailerField>1</pss:TrailerField> | ||
</pss:RSAPSSParams> | ||
</ds:SignatureMethod> | ||
<ds:Reference 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>rD/g8soqKz8EiPUBhEWfcQacS0ta4ULHX3dKMEH6ZoQ=</ds:DigestValue> | ||
</ds:Reference> | ||
<ds:Reference Type="http://uri.etsi.org/01903#SignedProperties" URI="#signedproperties-211e1eb4-e409-4169-a083-06e2201a6e3f"> | ||
<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>GddpcMqEMdYowP4GlEdTiqQcp9Mym1Mz3o9CFSyCet8=</ds:DigestValue> | ||
</ds:Reference> | ||
</ds:SignedInfo> | ||
<ds:SignatureValue> | ||
UKoTfgDL22+mv7q9NmrtFyP55WBj8WNWT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2Psb1mqdZ99b/MugsaA== | ||
</ds:X509Certificate> | ||
</ds:X509Data> | ||
</ds:KeyInfo> | ||
<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="#signature-51bb5edf-039c-4c35-ab4b-4304e73a93ee"><xades:SignedProperties Id="signedproperties-211e1eb4-e409-4169-a083-06e2201a6e3f"><xades:SignedSignatureProperties><xades:SigningTime>2024-10-18T23:17:54.123+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> |
Oops, something went wrong.