Commit f7c966ad authored by Lukas HAMEURY's avatar Lukas HAMEURY
Browse files

Merge branch 'xades-multiple' into 'master'

Problème de multiple signature au format xades détaché

See merge request i-parapheur/signature/libersign!36
parents 967d3120 5f82e1db
......@@ -5,6 +5,11 @@ Tous les changements notables sur ce projet seront documentés dans ce fichier.
Ce format est basé sur [Keep a Changelog](http://keepachangelog.com/)
et ce projet adhère au [Semantic Versioning](http://semver.org/).
## [1.9.10] - 2020-01-22
## Corrections
- Problème de multiple signature au format xades détaché
## [1.9.9] - 2020-01-20
### Modifications
......
......@@ -282,8 +282,27 @@ public class SignUtil {
// signatureBytes = XADESSignUtil.sign(signingCertificate, privKey, hexDecode(digests.get(iddoc)));
XADESSignUtil signeur = new XADESSignUtil(digests.get(iddoc).pesIds);
signatureBytes = signeur.signXAdES132(signingCertificate, privKey, hexDecode(digests.get(iddoc).digests));
signedHashMap.put(iddoc, new String(Base64Coder.encode(signatureBytes)));
if (digests.get(iddoc).digests.contains(",")) {
// the result will be serialized in this:
StringBuilder sigStringBuilder = new StringBuilder();
String[] hashesTab = digests.get(iddoc).digests.split(",");
boolean first = true;
for (String hashesTab1 : hashesTab) {
if (first) {
first = false;
} else {
sigStringBuilder.append(",");
}
signatureBytes = signeur.signXAdES132(signingCertificate, privKey, hexDecode(hashesTab1));
// After, gather the signatures!
sigStringBuilder.append(new String(Base64Coder.encode(signatureBytes)));
}
signedHashMap.put(iddoc, sigStringBuilder.toString());
} else {
signatureBytes = signeur.signXAdES132(signingCertificate, privKey, hexDecode(digests.get(iddoc).digests));
signedHashMap.put(iddoc, new String(Base64Coder.encode(signatureBytes)));
}
} else if ("XADES132".equalsIgnoreCase(formatSigString)) {
XADESSignUtil signeur = new XADESSignUtil(digests.get(iddoc).pesIds,
digests.get(iddoc).pespolicyid,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment