summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2013-12-09 18:26:07 +0000
committertkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4>2013-12-09 18:26:07 +0000
commitca26d2805186957ecf06ec0a9ff7b1606d49134d (patch)
tree3f221e6180013e7abdee0e185cad4adc558b3b6a
parent844c4a05d58766dd25ae1f97d6a69ee165fdbcc1 (diff)
downloadmocca-ca26d2805186957ecf06ec0a9ff7b1606d49134d.tar.gz
mocca-ca26d2805186957ecf06ec0a9ff7b1606d49134d.tar.bz2
mocca-ca26d2805186957ecf06ec0a9ff7b1606d49134d.zip
Enable enveloping CMS signatures
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1243 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateCMSSignatureCommandImpl.java4
-rw-r--r--bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/Signature.java8
2 files changed, 7 insertions, 5 deletions
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateCMSSignatureCommandImpl.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateCMSSignatureCommandImpl.java
index 4825351b..cb974d06 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateCMSSignatureCommandImpl.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateCMSSignatureCommandImpl.java
@@ -110,8 +110,8 @@ public class CreateCMSSignatureCommandImpl extends
// DataObject, SigningCertificate, SigningTime
Date signingTime = new Date();
try {
- signature = new Signature(request.getDataObject(), signingCertificate,
- signingTime, configurationFacade.getUseStrongHash());
+ signature = new Signature(request.getDataObject(), request.getStructure(),
+ signingCertificate, signingTime, configurationFacade.getUseStrongHash());
} catch (Exception e) {
log.error("Error creating CMS Signature.", e);
throw new SLCommandException(4000);
diff --git a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/Signature.java b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/Signature.java
index 2c23f05b..749b0dbf 100644
--- a/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/Signature.java
+++ b/bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/Signature.java
@@ -88,10 +88,12 @@ public class Signature {
@SuppressWarnings("unused")
private String digestAlgorithmURI;
- public Signature(CMSDataObjectRequiredMetaType dataObject,
- X509Certificate signingCertificate, Date signingTime, boolean useStrongHash) throws NoSuchAlgorithmException, CertificateEncodingException, CertificateException, X509ExtensionException, InvalidParameterException, CodingException {
+ public Signature(CMSDataObjectRequiredMetaType dataObject, String structure,
+ X509Certificate signingCertificate, Date signingTime, boolean useStrongHash)
+ throws NoSuchAlgorithmException, CertificateEncodingException, CertificateException, X509ExtensionException, InvalidParameterException, CodingException {
byte[] data = getContent(dataObject);
- this.signedData = new SignedData(data, SignedData.EXPLICIT);
+ int mode = structure.equalsIgnoreCase("enveloping") ? SignedData.IMPLICIT : SignedData.EXPLICIT;
+ this.signedData = new SignedData(data, mode);
setAlgorithmIDs(signingCertificate, useStrongHash);
createSignerInfo(signingCertificate);
setSignerCertificate(signingCertificate);