Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xades-X-L and a xades-A support #146

Merged
merged 87 commits into from
Feb 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
9dae633
fix test case broken by revision 247 (changed paths)
tomato42 Oct 26, 2012
dc1a599
basic support for XAdES-X signature verification
tomato42 Oct 12, 2012
4f4f285
add tests for enriching C form to X and verification of X form
tomato42 Oct 12, 2012
db4a610
preliminary support for XAdES-X-L form verification
tomato42 Nov 5, 2012
c392ca8
extract certs and CRLs from -X-L form tags
tomato42 Oct 26, 2012
bf1fa0d
add support for AttrAuthoritiesCertValues and AttributeRevocationValues
tomato42 Oct 30, 2012
56c50bb
test creation of optional -X-L form properties
tomato42 Oct 31, 2012
f368348
add certificates and CRLs used in verification of TimeStamps to -X-L …
tomato42 Oct 30, 2012
177a5ce
separate certificate verifiers for TimeStamps and Signature
tomato42 Nov 5, 2012
1db7b94
backend for generating our own certificates for tests
tomato42 Oct 24, 2012
0210c81
test XAdES-X-L form with minimal trust anchors
tomato42 Nov 6, 2012
bb7cd96
add tests of CertPathBuilder
tomato42 Oct 24, 2012
1231d52
fix test01_T_ver2 caused by bug in X509CRLSelector
tomato42 Dec 14, 2012
1126b58
use the new verifier implementation
tomato42 Dec 15, 2012
1e57ae6
create hybrid approach unmarshaller
tomato42 Dec 15, 2012
34cfade
create hybrid verifier
tomato42 Nov 22, 2012
300677b
provide XML location information to TimeStampVerifiers
tomato42 Nov 22, 2012
57515b7
constraints on time stamps, certificates and CRLs
tomato42 Dec 6, 2012
257c457
allow for creation of C form from T form with current CRLs
tomato42 Dec 13, 2012
53d07d9
make PKIX certificate validator more tolerant of input
tomato42 Dec 14, 2012
5ea45dd
PKIX cert validator should be tolerant of input
tomato42 Dec 14, 2012
8aacc5c
make verifiers of EncapsulatedPKIData collect the PKI data
tomato42 Dec 15, 2012
bff7f81
fix XadesVerifierErrosTest tests
tomato42 Dec 14, 2012
ffc46e4
extend XadesHybridVerifier to XAdES-X-L support
tomato42 Dec 15, 2012
32e34da
documentation fixes
tomato42 Dec 14, 2012
6c0ea57
add tests for basic A form
tomato42 Dec 16, 2012
3432c01
add support for validating ArchiveTimeStamp property
tomato42 Dec 16, 2012
903c1d4
Align implementation with version 1.4.2 of the standard
tomato42 Dec 16, 2012
73209ff
update form checker to XAdES-A support
tomato42 Dec 16, 2012
b41dfe1
add ArchiveTimeStamp unmarshaller
tomato42 Dec 16, 2012
65ba11e
add ability to extend X-L form to basic A form
tomato42 Dec 16, 2012
a7afa61
allow for the validation of timestamp to change time
tomato42 Dec 16, 2012
5ba94f9
add XAdES-A tests with past timestamps
tomato42 Dec 17, 2012
bde3816
add note about grace time and verification
tomato42 Dec 17, 2012
d446f08
add TimeStampValidationData property
tomato42 Dec 17, 2012
176413d
add support for XAdES 1.4.1 ValidationDataType
tomato42 Dec 17, 2012
a2c09e2
unmarshalling of TimeStampValidationData property
tomato42 Dec 17, 2012
9b0ab83
add ValidationData property structure verifier
tomato42 Dec 17, 2012
4e4edc4
add TimeStampValidationData verifier
tomato42 Dec 17, 2012
62d6066
emphisise that TimeStampValidationData is from 1.4.1
tomato42 Dec 18, 2012
8a64130
add TimeStampValidationData marshaller
tomato42 Dec 17, 2012
92986f7
TimeStampValidationData property generator
tomato42 Dec 17, 2012
2e7f582
allow for adding TimeStampValidationData
tomato42 Dec 17, 2012
35b924c
add test for creation and consumption of TimeStampValidationData
tomato42 Dec 17, 2012
66fe05e
add support for A form properties to ArchiveTimeStampVerifier
tomato42 Dec 17, 2012
32bf4aa
add simple test for TimeStampStampValidationData prop creation
tomato42 Dec 17, 2012
0b8d4c3
align ValidationDataType with version 1.4.2 of standard
tomato42 Dec 18, 2012
a288b70
update old unmarshaller
tomato42 Dec 17, 2012
58163e7
fix message in AgedTimeStampTest
tomato42 Dec 18, 2012
6e3b65e
add test for A-TimeStamping already A-TimeStamped document
tomato42 Dec 18, 2012
289c4d4
add support for A-timeStamping already A-timeStamped document
tomato42 Dec 18, 2012
58f93d6
don't require optional properties in ArchiveTimeStamp
tomato42 Dec 16, 2012
6807b7e
add support for creating multiple timeStamps of T and X type
tomato42 Dec 18, 2012
c6ddb9f
save validation data with time stamp property
tomato42 Dec 19, 2012
63ce052
clean up SurrogateTimeStampTokenProvider
tomato42 Dec 19, 2012
4284c92
update JavaDocs to reflect support for XAdES-A
tomato42 Dec 19, 2012
3c99612
make certs and CRLs saved in properties unique
tomato42 Dec 20, 2012
4e6ae87
add only non duplicated data to A-VD form
tomato42 Dec 20, 2012
47f4f40
consider parameters individually in tsValDataProp
tomato42 Dec 23, 2012
72ad4f3
don't assume presence of data in TSValData property
tomato42 Dec 23, 2012
4b333a7
don't try to create empty TSVerData property
tomato42 Dec 23, 2012
3f30b7a
remove verifyAextendAVD test
tomato42 Dec 23, 2012
1f418e6
update AgedTimeStampTest for new TSValData creator
tomato42 Dec 23, 2012
a866046
fix subCA cert creation
tomato42 Dec 23, 2012
38b6303
realistic tests
tomato42 Dec 24, 2012
63d29c0
fix variable names in PropertiesUtils
tomato42 Dec 24, 2012
0fa8667
clean imports and add code comments
tomato42 Dec 24, 2012
f686109
add validation data before validating all properties
tomato42 Dec 24, 2012
c9e73a3
don't fail windows-only tests on non-windows platforms
tomato42 Dec 24, 2012
53b75c2
Fix A form validation.
Jul 13, 2016
8614e48
Merge branch 'master' into xades_a_support
Jul 14, 2016
c7f3115
Add new crl for rootgva
Jul 14, 2016
af0f391
Update trusted CAs and CRLs
Jul 15, 2016
81c60c1
Fix some tests.
Jul 15, 2016
f4fa329
Fix some tests
Aug 4, 2016
bd7bcb8
Remove DO_BREAK_LINES from Base64 marshaller
Aug 18, 2016
bb5ccdd
Update bouncycastle and adds support for proxy configuration in tests
Jul 15, 2016
b25e9dd
Prepare sun-jax.episode for external usage
Aug 18, 2016
1272a69
Select the right certificate from ds:KeyInfo
Sep 16, 2016
282d302
Add custom unsigned properties to ArchiveTimeStamp digest
Sep 23, 2016
ad41df4
Close files after adding to FileSystemDirectoryCertStore
Nov 21, 2016
9732eaa
Update test tstoken, crls and xmls
Feb 6, 2017
232bb6a
Changes DefaultTimeStampTokenProvider to non final to
Feb 6, 2017
37b32f1
Merge remote-tracking branch 'silegis/xades_a_support' into xades_a_s…
Feb 6, 2017
6cc7332
DefaultTimeStampTokenProvider.getHttpConnection is now protected.
Apr 11, 2017
f854856
Merge branch 'master' of https://github.com/luisgoncalves/xades4j.git…
Feb 5, 2018
56c36bd
Remove BoucyCastleProvider from test
Feb 6, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 25 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@
<version>1.56</version>
</dependency>
</dependencies>

<distributionManagement>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
Expand All @@ -97,6 +96,29 @@
</build>

<profiles>
<profile>
<id>test-with-proxy</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<property>
<name>http.proxyHost</name>
<value>${http.proxyHost}</value>
</property>
<property>
<name>http.proxyPort</name>
<value>${http.proxyPort}</value>
</property>
</systemProperties>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<build>
Expand Down Expand Up @@ -170,4 +192,4 @@
</profile>
</profiles>

</project>
</project>
10 changes: 2 additions & 8 deletions src/main/java/xades4j/production/DataGenArchiveTimeStamp.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@
import org.w3c.dom.Element;
import xades4j.properties.ArchiveTimeStampProperty;
import xades4j.properties.CertificateValuesProperty;
import xades4j.properties.CompleteCertificateRefsProperty;
import xades4j.properties.CompleteRevocationRefsProperty;
import xades4j.properties.QualifyingProperty;
import xades4j.properties.RevocationValuesProperty;
import xades4j.properties.SignatureTimeStampProperty;
import xades4j.properties.data.ArchiveTimeStampData;
import xades4j.properties.data.BaseXAdESTimeStampData;
import xades4j.providers.AlgorithmsProviderEx;
Expand Down Expand Up @@ -94,13 +91,10 @@ protected void addPropSpecificTimeStampInput(
if (ki != null)
digestInput.addNode(ki.getElement());

// Unsigned properties, in order of appearance.
Map<String, Integer> propsCnt = new HashMap<String, Integer>(5);
// Required properties, in order of appearance.
Map<String, Integer> propsCnt = new HashMap<String, Integer>(2);
propsCnt.put(CertificateValuesProperty.PROP_NAME, 0);
propsCnt.put(RevocationValuesProperty.PROP_NAME, 0);
propsCnt.put(CompleteCertificateRefsProperty.PROP_NAME, 0);
propsCnt.put(CompleteRevocationRefsProperty.PROP_NAME, 0);
propsCnt.put(SignatureTimeStampProperty.PROP_NAME, 0);

e = DOMHelper.getFirstChildElement(unsignedSigPropsElem);
// UnsignedProperties shouldn't be empty!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* XAdES4j - A Java library for generation and verification of XAdES signatures.
* Copyright (C) 2012 Hubert Kario - QBS.
*
* 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 java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;

import xades4j.properties.AttrAuthoritiesCertValuesProperty;
import xades4j.properties.data.AttrAuthoritiesCertValuesData;
import xades4j.properties.data.CertificateValuesData;
import xades4j.properties.data.PropertyDataObject;

/**
* @author Hubert Kario
*/
public class DataGenAttrAuthoritiesCertValues
implements PropertyDataObjectGenerator<AttrAuthoritiesCertValuesProperty>
{
@Override
public PropertyDataObject generatePropertyData(
AttrAuthoritiesCertValuesProperty prop,
PropertiesDataGenerationContext ctx)
throws PropertyDataGenerationException
{
AttrAuthoritiesCertValuesData attrAuthCertValuesData =
new AttrAuthoritiesCertValuesData();
try
{
for (X509Certificate cer : prop.getCertificates())
{
attrAuthCertValuesData.addData(cer.getEncoded());
}
} catch (CertificateEncodingException ex)
{
throw new PropertyDataGenerationException(prop, "cannot get encoded certificate", ex);
}

return attrAuthCertValuesData;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* XAdES4j - A Java library for generation and verification of XAdES signatures.
* Copyright (C) 2012 Hubert Kario - QBS
*
* 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 java.security.cert.CRLException;
import java.security.cert.X509CRL;

import xades4j.properties.AttributeRevocationValuesProperty;
import xades4j.properties.data.AttributeRevocationValuesData;
import xades4j.properties.data.PropertyDataObject;

/**
*
* @author Hubert Kario
*
*/
public class DataGenAttributeRevocationValues implements
PropertyDataObjectGenerator<AttributeRevocationValuesProperty>
{
@Override
public PropertyDataObject generatePropertyData(
AttributeRevocationValuesProperty prop,
PropertiesDataGenerationContext ctx)
throws PropertyDataGenerationException
{
AttributeRevocationValuesData attrRevocValuesData = new AttributeRevocationValuesData();
try
{
for (X509CRL crl : prop.getCrls())
{
attrRevocValuesData.addData(crl.getEncoded());
}
} catch (CRLException ex)
{
throw new PropertyDataGenerationException(prop, "cannot get encoded CRL", ex);
}
return attrRevocValuesData;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* XAdES4j - A Java library for generation and verification of XAdES signatures.
* Copyright (C) 2012 Hubert Kario - QBS.
*
* 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 java.security.cert.CRLException;
import java.security.cert.CertificateEncodingException;
import java.security.cert.X509CRL;
import java.security.cert.X509Certificate;

import xades4j.properties.TimeStampValidationDataProperty;
import xades4j.properties.data.PropertyDataObject;
import xades4j.properties.data.TimeStampValidationDataData;

/**
*
* @author Hubert Kario
*
*/
public class DataGenTimeStampValidationData implements
PropertyDataObjectGenerator<TimeStampValidationDataProperty>
{

@Override
public PropertyDataObject generatePropertyData(
TimeStampValidationDataProperty prop,
PropertiesDataGenerationContext ctx)
throws PropertyDataGenerationException
{
TimeStampValidationDataData tsValidationDataData =
new TimeStampValidationDataData();

try
{
for (X509Certificate cer : prop.getCertificates())
{
tsValidationDataData.addCertificateData(cer.getEncoded());
}
} catch (CertificateEncodingException e)
{
throw new PropertyDataGenerationException(prop, "cannot get encoded certificate", e);
}

try
{
for (X509CRL crl : prop.getCrls())
{
tsValidationDataData.addCRLData(crl.getEncoded());
}
} catch (CRLException e)
{
throw new PropertyDataGenerationException(prop, "cannot get encoded CRL", e);
}

return tsValidationDataData;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import xades4j.properties.AllDataObjsCommitmentTypeProperty;
import xades4j.properties.AllDataObjsTimeStampProperty;
import xades4j.properties.ArchiveTimeStampProperty;
import xades4j.properties.AttrAuthoritiesCertValuesProperty;
import xades4j.properties.AttributeRevocationValuesProperty;
import xades4j.properties.CertificateValuesProperty;
import xades4j.properties.CommitmentTypeProperty;
import xades4j.properties.CompleteCertificateRefsProperty;
Expand All @@ -39,6 +41,7 @@
import xades4j.properties.SignerRoleProperty;
import xades4j.properties.SigningCertificateProperty;
import xades4j.properties.SigningTimeProperty;
import xades4j.properties.TimeStampValidationDataProperty;
import xades4j.properties.data.CustomPropertiesDataObjsStructureVerifier;
import xades4j.providers.AlgorithmsProvider;
import xades4j.providers.AlgorithmsProviderEx;
Expand Down Expand Up @@ -163,12 +166,24 @@ public void provideProperties(DataObjectDesc dataObj)
{
}).to(DataGenCertificateValues.class);

bind(new TypeLiteral<PropertyDataObjectGenerator<AttrAuthoritiesCertValuesProperty>>()
{
}).to(DataGenAttrAuthoritiesCertValues.class);

bind(new TypeLiteral<PropertyDataObjectGenerator<RevocationValuesProperty>>()
{
}).to(DataGenRevocationValues.class);

bind(new TypeLiteral<PropertyDataObjectGenerator<AttributeRevocationValuesProperty>>()
{
}).to(DataGenAttributeRevocationValues.class);

bind(new TypeLiteral<PropertyDataObjectGenerator<ArchiveTimeStampProperty>>()
{
}).to(DataGenArchiveTimeStamp.class);

bind(new TypeLiteral<PropertyDataObjectGenerator<TimeStampValidationDataProperty>>()
{
}).to(DataGenTimeStampValidationData.class);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import xades4j.properties.SigningTimeProperty;
import xades4j.properties.UnsignedSignatureProperty;
import xades4j.providers.SignaturePropertiesCollector;
import xades4j.utils.PropertiesList;
import xades4j.utils.PropertiesSet;

/**
Expand All @@ -34,13 +35,13 @@
class SignaturePropertiesCollectorImpl implements SignaturePropertiesCollector
{
private final PropertiesSet<SignedSignatureProperty> signedSigProps;
private final PropertiesSet<UnsignedSignatureProperty> unsignedSigProps;
private final PropertiesList<UnsignedSignatureProperty> unsignedSigProps;

public SignaturePropertiesCollectorImpl()
{

this.signedSigProps = new PropertiesSet<SignedSignatureProperty>(2);
this.unsignedSigProps = new PropertiesSet<UnsignedSignatureProperty>(0);
this.unsignedSigProps = new PropertiesList<UnsignedSignatureProperty>(0);
}

/***** Signed signature properties *****/
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/xades4j/production/XadesCSigningProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,19 @@
* <p>
* The {@code AttributeCertificateRefs} and {@code AttributeRevocationRefs} properties
* are not supported.
* <p>
* If the (implicit or explicit) policy you're following requires grace periods for
* signature creation, it is highly recommended <b>not</b> to use this signing profile
* but to use {@link XadesTSigningProfile} for initial signature creation and then extend
* the signature to XAdES-C form after the grace period has elapsed and new revocation
* information is available.
* @author Luís
*/
public class XadesCSigningProfile extends XadesTSigningProfile
{
/**
* @see XadesCSigningProfile
*/
public XadesCSigningProfile(
KeyingDataProvider keyingProvider,
ValidationDataProvider validationDataProv)
Expand All @@ -40,6 +49,9 @@ public XadesCSigningProfile(
withBinding(ValidationDataProvider.class, validationDataProv);
}

/**
* @see XadesCSigningProfile
*/
public XadesCSigningProfile(
KeyingDataProvider keyingProvider,
Class<? extends ValidationDataProvider> validationDataProvClass)
Expand All @@ -48,6 +60,9 @@ public XadesCSigningProfile(
withBinding(ValidationDataProvider.class, validationDataProvClass);
}

/**
* @see XadesCSigningProfile
*/
public XadesCSigningProfile(
Class<? extends KeyingDataProvider> keyingProviderClass,
ValidationDataProvider validationDataProv)
Expand All @@ -56,6 +71,9 @@ public XadesCSigningProfile(
withBinding(ValidationDataProvider.class, validationDataProv);
}

/**
* @see XadesCSigningProfile
*/
public XadesCSigningProfile(
Class<? extends KeyingDataProvider> keyingProviderClass,
Class<? extends ValidationDataProvider> validationDataProvClass)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
* is used to add unsigned signature properties to an existing signature in order
* augment its format. This can be done as part of the {@link xades4j.verification.XadesVerifier#verify(org.w3c.dom.Element, xades4j.verification.SignatureSpecificVerificationOptions, xades4j.production.XadesSignatureFormatExtender, xades4j.verification.XAdESForm) verification process}.
* The {@code XadesSignatureFormatExtender} can also be used separately, but no
* checks are made on the correctness of the signature.
* checks are made on the correctness of the signature or added properties.
* <p>
* This profile follows the same principles of {@link XadesSigningProfile}.
* @author Luís
Expand Down
Loading