summaryrefslogtreecommitdiff
path: root/utils/src/main/java/at/gv/egiz
diff options
context:
space:
mode:
authormcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-11-11 15:51:08 +0000
committermcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2009-11-11 15:51:08 +0000
commit68941b57df2caeead67a5bede2ef5a635d07db32 (patch)
tree78c93c71a20b4775af3991f4395c2267cc39fab8 /utils/src/main/java/at/gv/egiz
parentcaca721368d8c24559b1cd5ea2018884b4874f6b (diff)
downloadmocca-68941b57df2caeead67a5bede2ef5a635d07db32.tar.gz
mocca-68941b57df2caeead67a5bede2ef5a635d07db32.tar.bz2
mocca-68941b57df2caeead67a5bede2ef5a635d07db32.zip
Added support for SHA-256 and partial support for e-card G3, BELPIC and Italian cards.
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@540 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'utils/src/main/java/at/gv/egiz')
-rw-r--r--utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesFactory.java15
1 files changed, 9 insertions, 6 deletions
diff --git a/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesFactory.java b/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesFactory.java
index 82cba624..6f694b91 100644
--- a/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesFactory.java
+++ b/utils/src/main/java/at/gv/egiz/xades/QualifyingPropertiesFactory.java
@@ -104,14 +104,14 @@ public class QualifyingPropertiesFactory {
}
- public DigestAlgAndValueType createDigestAlgAndValueType(X509Certificate certificate) throws QualifyingPropertiesException {
+ public DigestAlgAndValueType createDigestAlgAndValueType(X509Certificate certificate, DigestMethod dm) throws QualifyingPropertiesException {
DigestMethodType digestMethodType = dsFactory.createDigestMethodType();
- digestMethodType.setAlgorithm(DigestMethod.SHA1);
-
+ digestMethodType.setAlgorithm(dm.getAlgorithm());
+
byte[] digest;
try {
- MessageDigest messageDigest = MessageDigest.getInstance("SHA-1");
+ MessageDigest messageDigest = MessageDigest.getInstance(dm.getAlgorithm());
digest = messageDigest.digest(certificate.getEncoded());
} catch (CertificateEncodingException e) {
throw new QualifyingPropertiesException(e);
@@ -155,7 +155,10 @@ public class QualifyingPropertiesFactory {
return dataObjectFormatType;
}
- public JAXBElement<QualifyingPropertiesType> createQualifyingProperties111(String target, Date signingTime, List<X509Certificate> certificates, String idValue, List<DataObjectFormatType> dataObjectFormats) throws QualifyingPropertiesException {
+ public JAXBElement<QualifyingPropertiesType> createQualifyingProperties111(
+ String target, Date signingTime, List<X509Certificate> certificates,
+ String idValue, List<DataObjectFormatType> dataObjectFormats,
+ DigestMethod digestMethod) throws QualifyingPropertiesException {
GregorianCalendar gregorianCalendar = new GregorianCalendar();
gregorianCalendar.setTimeZone(TimeZone.getTimeZone("UTC"));
@@ -175,7 +178,7 @@ public class QualifyingPropertiesFactory {
for (X509Certificate certificate : certificates) {
CertIDType certIDType = qpFactory.createCertIDType();
- certIDType.setCertDigest(createDigestAlgAndValueType(certificate));
+ certIDType.setCertDigest(createDigestAlgAndValueType(certificate, digestMethod));
certIDType.setIssuerSerial(createX509IssuerSerialType(certificate));
certIDs.add(certIDType);