diff options
Diffstat (limited to 'bkucommon/src/main/java')
-rw-r--r-- | bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/CreateCMSSignatureCommandImpl.java | 4 | ||||
-rw-r--r-- | bkucommon/src/main/java/at/gv/egiz/bku/slcommands/impl/cms/Signature.java | 8 |
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); |