Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
Merge pull request #295 from ggalmazor/issue_293_fix_upload_encrypted…
Browse files Browse the repository at this point in the history
…_forms_bug

Issue 293 Aggregate sets a wrong size for encryption fields
  • Loading branch information
yanokwa authored Aug 8, 2018
2 parents b6cc2e7 + 1b22099 commit cca9f7b
Showing 1 changed file with 17 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,24 @@ protected BaseFormParserForJavaRosa(String existingXml, String existingTitle, bo
isFieldEncryptedForm = (base64EncryptedFieldRsaPublicKey != null);
} else {
isFileEncryptedForm = true;
// encrypted -- use the encrypted form template (above) to define
// the
// storage for this form.
// When a form is encrypted, we don't use the actual form that the users sends
// because the submissions we will get for this form will only have three fields:
// - base64EncryptedKey
// - base64EncryptedElementSignature
// - encryptedXmlFile
//
// To address this, we will use the form defined in ENCRYPTED_FORM_DEFINITION instead
// which follows the structure described above.
// This is discussed in https://github.com/opendatakit/aggregate/issues/294
XFormParser exfp = parseFormDefinition(ENCRYPTED_FORM_DEFINITION);
// Reset bind element and string length maps since we won't be using the original
// form parsed and processed at the beginning of this constructor.
Document encryptedFormDoc = parseXmlToDocument(ENCRYPTED_FORM_DEFINITION);
stringLengths.clear();
bindElements.clear();
List<Element> encryptedFormBindings = getBindings(encryptedFormDoc);
encryptedFormBindings.forEach(this::storeCopyOfBinding);
encryptedFormBindings.forEach(this::storeLengthOfBinding);
try {
formDef = exfp.parse();
} catch (IOException e) {
Expand Down

0 comments on commit cca9f7b

Please sign in to comment.