ODK upload encrypted submission questions

(adding opendatakit-developers@, as this question should be asked and
followed-up on that list).

Encrypted forms are handled as ordinary form definitions up until the form
is marked as finalized.

At that point, the form's submission XML is encrypted into
submission.xml.enc and a new submission XML is constructed based upon a
form definition that describes an encrypted form, its encrypted
attachments, an encrypted representation of the single-use encryption key
that was used for that encryption, and the cryptographic signature of the
original form submission XML and its attachments.

The form definition that corresponds to the resulting submission XML is
defined in the source code of the XML form definition parsing logic here:

Note that this is not a fully-usable interactive form definition (you can't
give it to ODK Collect have have it work). It contains enough information
for ODK Aggregate to construct the storage structures for the encrypted
form. And it treats all the attachments as 'image/*' in the form
definition, though, when they are uploaded, they are all uploaded as
generic binary octet attachments (since they are encrypted).

The decryption of the form and the verification of the signature is handled
by this routine:

We intentionally do not provide any means to decrypt the form on the
server.
It must be done through the ODK Briefcase app.

··· On Tue, Dec 1, 2015 at 10:43 PM, Tom Snyder wrote:

Hi, Mitchell,
I am wondering if you would answer a few questions for me. I am building
a jersey web service to accept an encrypted Kobo form which I've been told
is based on ODK. My 1st question is : does ODK send the submission.XML.enc
file as part of the upload? Is there open source code that can show me how
to access both the XML payload and the submission.XML.enc encrypted data as
it is received by the server?
I appreciate any guidance and help you can provide.

Tom

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

http://www.smartstainable.org


http://www.geMatrix.com

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Thank you Mitch,

Is the submission.xml.enc sent on each post to the server along with the
XML file ha contains the key, the file name and the digest?

Kind thanks,
Tom

··· On Wed, Dec 2, 2015 at 12:20 PM, Mitch Sundt wrote:

(adding opendatakit-developers@, as this question should be asked and
followed-up on that list).

Encrypted forms are handled as ordinary form definitions up until the form
is marked as finalized.

At that point, the form's submission XML is encrypted into
submission.xml.enc and a new submission XML is constructed based upon a
form definition that describes an encrypted form, its encrypted
attachments, an encrypted representation of the single-use encryption key
that was used for that encryption, and the cryptographic signature of the
original form submission XML and its attachments.

The form definition that corresponds to the resulting submission XML is
defined in the source code of the XML form definition parsing logic here:

https://github.com/opendatakit/aggregate/blob/master/src/main/java/org/opendatakit/aggregate/parser/BaseFormParserForJavaRosa.java#L159

Note that this is not a fully-usable interactive form definition (you
can't give it to ODK Collect have have it work). It contains enough
information for ODK Aggregate to construct the storage structures for the
encrypted form. And it treats all the attachments as 'image/*' in the form
definition, though, when they are uploaded, they are all uploaded as
generic binary octet attachments (since they are encrypted).

The decryption of the form and the verification of the signature is
handled by this routine:

https://github.com/opendatakit/briefcase/blob/master/src/org/opendatakit/briefcase/util/FileSystemUtils.java#L738

We intentionally do not provide any means to decrypt the form on the
server.
It must be done through the ODK Briefcase app.

On Tue, Dec 1, 2015 at 10:43 PM, Tom Snyder tom.snyder@gematrix.com wrote:

Hi, Mitchell,
I am wondering if you would answer a few questions for me. I am building
a jersey web service to accept an encrypted Kobo form which I've been told
is based on ODK. My 1st question is : does ODK send the submission.XML.enc
file as part of the upload? Is there open source code that can show me how
to access both the XML payload and the submission.XML.enc encrypted data as
it is received by the server?
I appreciate any guidance and help you can provide.

Tom

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

http://www.smartstainable.org


http://www.geMatrix.com

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fabout.twitter.com%2Fresources%2Fbuttons&region=follow_link&screen_name=smartstainable&tw_p=followbutton&variant=2.0

http://www.smartstainable.com/

Yes.

··· On Tue, Dec 29, 2015 at 8:51 AM, Tom Snyder wrote:

Thank you Mitch,

Is the submission.xml.enc sent on each post to the server along with the
XML file ha contains the key, the file name and the digest?

Kind thanks,
Tom

On Wed, Dec 2, 2015 at 12:20 PM, Mitch Sundt mitchellsundt@gmail.com wrote:

(adding opendatakit-developers@, as this question should be asked and
followed-up on that list).

Encrypted forms are handled as ordinary form definitions up until the
form is marked as finalized.

At that point, the form's submission XML is encrypted into
submission.xml.enc and a new submission XML is constructed based upon a
form definition that describes an encrypted form, its encrypted
attachments, an encrypted representation of the single-use encryption key
that was used for that encryption, and the cryptographic signature of the
original form submission XML and its attachments.

The form definition that corresponds to the resulting submission XML is
defined in the source code of the XML form definition parsing logic here:

https://github.com/opendatakit/aggregate/blob/master/src/main/java/org/opendatakit/aggregate/parser/BaseFormParserForJavaRosa.java#L159

Note that this is not a fully-usable interactive form definition (you
can't give it to ODK Collect have have it work). It contains enough
information for ODK Aggregate to construct the storage structures for the
encrypted form. And it treats all the attachments as 'image/*' in the form
definition, though, when they are uploaded, they are all uploaded as
generic binary octet attachments (since they are encrypted).

The decryption of the form and the verification of the signature is
handled by this routine:

https://github.com/opendatakit/briefcase/blob/master/src/org/opendatakit/briefcase/util/FileSystemUtils.java#L738

We intentionally do not provide any means to decrypt the form on the
server.
It must be done through the ODK Briefcase app.

On Tue, Dec 1, 2015 at 10:43 PM, Tom Snyder tom.snyder@gematrix.com wrote:

Hi, Mitchell,
I am wondering if you would answer a few questions for me. I am
building a jersey web service to accept an encrypted Kobo form which I've
been told is based on ODK. My 1st question is : does ODK send the
submission.XML.enc file as part of the upload? Is there open source code
that can show me how to access both the XML payload and the
submission.XML.enc encrypted data as it is received by the server?
I appreciate any guidance and help you can provide.

Tom

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

http://www.smartstainable.org


http://www.geMatrix.com

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fabout.twitter.com%2Fresources%2Fbuttons&region=follow_link&screen_name=smartstainable&tw_p=followbutton&variant=2.0

http://www.smartstainable.com/

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

Hi, Mitch,
I'm still a bit puzzled at this as I get the following in the Request Input
Stream for a given simple form:
--RZovx2LrfsYpGOT6gUHpiJQmMz0OCX
Content-Disposition: form-data; name="xml_submission_file";
filename="simplesec_2016-01-02_13-48-22.xml"
Content-Type: text/xml
Content-Transfer-Encoding: binary

rR1Xc90YuOCLx7iVjZvmLRy+YSfoMcpRX+WfWrKFS1oz2RWYR5fTyn3sZoHsfy+ZHnug/rgRayAdx/RYuYDtzCmUdr93sGAzI4aefg2sfRE08uukDTSl7vCNQq1p0fDN3oZQZ26Ql2BwxjCxubU+fFzMssXqnwjRwsyQjZbK8ieJ4Gf/GYHY0478oi2olAU/fPQtxdF1j1TNgNb3MelbLCGcJ12cjkBYYKPQDk1daRao10WypUbJOtG0Mc+r4K4VtSdr7xEukzIRw9kxaqZZj18sO7/KbWaYMvKH8DURvegFiDnf8ZZomH7kanhhjcAplXyXChLAqwjnZL9jLWPfgg==<orx:meta
xmlns:orx="http://openrosa.org/xforms
">orx:instanceIDuuid:6f573414-34e3-4d8f-a9c4-3260651b16b9</orx:instanceID></orx:meta>
submission.xml.encY2dc/n3NSV01GtyZHA7rxITk/grfdNo0dsRBmm97zY0I8OWtIoftlXTFR2BRXpoQMt14VcQ21WEpRU/J5gkFs//VGAd/a4+pgimc6qk2iaOq91fF/vpsYvosRjH3RtMvU+HcyfoKHEpCeqZAsW7+FF2qtWnEILchN1IeFHk3Mhw1Zybx3z/4mn8Ww2vC3Nm6rPOz0QwOpD9Jg26Rr9MRJz0pQAwe+V2RWsZPXM1ukdPDNy7RoPtJ5qQDacGxowGds86ZXJ8cS8djquTSCk7sdcH8sU+iK6CH8nX30CMzU6xdo8HGjnvEhj4iH7vHDjRymsQbGQLNz1VNHtq0WBIpWA==
--RZovx2LrfsYpGOT6gUHpiJQmMz0OCX--

I've taken apart the form and only find one part - the

But nowhere do I see the submission.xml.enc file included in the input
stream. Can you provide any guidance please.

Kind thanks,
Tom

··· On Tue, Dec 29, 2015 at 9:30 AM, Mitch Sundt wrote:

Yes.

On Tue, Dec 29, 2015 at 8:51 AM, Tom Snyder tom.snyder@gematrix.com wrote:

Thank you Mitch,

Is the submission.xml.enc sent on each post to the server along with the
XML file ha contains the key, the file name and the digest?

Kind thanks,
Tom

On Wed, Dec 2, 2015 at 12:20 PM, Mitch Sundt mitchellsundt@gmail.com wrote:

(adding opendatakit-developers@, as this question should be asked and
followed-up on that list).

Encrypted forms are handled as ordinary form definitions up until the
form is marked as finalized.

At that point, the form's submission XML is encrypted into
submission.xml.enc and a new submission XML is constructed based upon a
form definition that describes an encrypted form, its encrypted
attachments, an encrypted representation of the single-use encryption key
that was used for that encryption, and the cryptographic signature of the
original form submission XML and its attachments.

The form definition that corresponds to the resulting submission XML is
defined in the source code of the XML form definition parsing logic here:

https://github.com/opendatakit/aggregate/blob/master/src/main/java/org/opendatakit/aggregate/parser/BaseFormParserForJavaRosa.java#L159

Note that this is not a fully-usable interactive form definition (you
can't give it to ODK Collect have have it work). It contains enough
information for ODK Aggregate to construct the storage structures for the
encrypted form. And it treats all the attachments as 'image/*' in the form
definition, though, when they are uploaded, they are all uploaded as
generic binary octet attachments (since they are encrypted).

The decryption of the form and the verification of the signature is
handled by this routine:

https://github.com/opendatakit/briefcase/blob/master/src/org/opendatakit/briefcase/util/FileSystemUtils.java#L738

We intentionally do not provide any means to decrypt the form on the
server.
It must be done through the ODK Briefcase app.

On Tue, Dec 1, 2015 at 10:43 PM, Tom Snyder tom.snyder@gematrix.com wrote:

Hi, Mitchell,
I am wondering if you would answer a few questions for me. I am
building a jersey web service to accept an encrypted Kobo form which I've
been told is based on ODK. My 1st question is : does ODK send the
submission.XML.enc file as part of the upload? Is there open source code
that can show me how to access both the XML payload and the
submission.XML.enc encrypted data as it is received by the server?
I appreciate any guidance and help you can provide.

Tom

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

http://www.smartstainable.org


http://www.geMatrix.com

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fabout.twitter.com%2Fresources%2Fbuttons&region=follow_link&screen_name=smartstainable&tw_p=followbutton&variant=2.0

http://www.smartstainable.com/

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fabout.twitter.com%2Fresources%2Fbuttons&region=follow_link&screen_name=smartstainable&tw_p=followbutton&variant=2.0

http://www.smartstainable.com/

Please disregard the last request. The server was not recognizing multi
part.
Thank you,
Tom

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

http://www.smartstainable.org

··· ________________________________

On Jan 2, 2016 1:53 PM, "Tom Snyder" tom.snyder@gematrix.com wrote:

Hi, Mitch,
I'm still a bit puzzled at this as I get the following in the Request
Input Stream for a given simple form:
--RZovx2LrfsYpGOT6gUHpiJQmMz0OCX
Content-Disposition: form-data; name="xml_submission_file";
filename="simplesec_2016-01-02_13-48-22.xml"
Content-Type: text/xml
Content-Transfer-Encoding: binary

rR1Xc90YuOCLx7iVjZvmLRy+YSfoMcpRX+WfWrKFS1oz2RWYR5fTyn3sZoHsfy+ZHnug/rgRayAdx/RYuYDtzCmUdr93sGAzI4aefg2sfRE08uukDTSl7vCNQq1p0fDN3oZQZ26Ql2BwxjCxubU+fFzMssXqnwjRwsyQjZbK8ieJ4Gf/GYHY0478oi2olAU/fPQtxdF1j1TNgNb3MelbLCGcJ12cjkBYYKPQDk1daRao10WypUbJOtG0Mc+r4K4VtSdr7xEukzIRw9kxaqZZj18sO7/KbWaYMvKH8DURvegFiDnf8ZZomH7kanhhjcAplXyXChLAqwjnZL9jLWPfgg==<orx:meta
xmlns:orx="http://openrosa.org/xforms
">orx:instanceIDuuid:6f573414-34e3-4d8f-a9c4-3260651b16b9</orx:instanceID></orx:meta>

submission.xml.encY2dc/n3NSV01GtyZHA7rxITk/grfdNo0dsRBmm97zY0I8OWtIoftlXTFR2BRXpoQMt14VcQ21WEpRU/J5gkFs//VGAd/a4+pgimc6qk2iaOq91fF/vpsYvosRjH3RtMvU+HcyfoKHEpCeqZAsW7+FF2qtWnEILchN1IeFHk3Mhw1Zybx3z/4mn8Ww2vC3Nm6rPOz0QwOpD9Jg26Rr9MRJz0pQAwe+V2RWsZPXM1ukdPDNy7RoPtJ5qQDacGxowGds86ZXJ8cS8djquTSCk7sdcH8sU+iK6CH8nX30CMzU6xdo8HGjnvEhj4iH7vHDjRymsQbGQLNz1VNHtq0WBIpWA==
--RZovx2LrfsYpGOT6gUHpiJQmMz0OCX--

I've taken apart the form and only find one part - the

But nowhere do I see the submission.xml.enc file included in the input
stream. Can you provide any guidance please.

Kind thanks,
Tom

On Tue, Dec 29, 2015 at 9:30 AM, Mitch Sundt mitchellsundt@gmail.com wrote:

Yes.

On Tue, Dec 29, 2015 at 8:51 AM, Tom Snyder tom.snyder@gematrix.com wrote:

Thank you Mitch,

Is the submission.xml.enc sent on each post to the server along with the
XML file ha contains the key, the file name and the digest?

Kind thanks,
Tom

On Wed, Dec 2, 2015 at 12:20 PM, Mitch Sundt mitchellsundt@gmail.com wrote:

(adding opendatakit-developers@, as this question should be asked and
followed-up on that list).

Encrypted forms are handled as ordinary form definitions up until the
form is marked as finalized.

At that point, the form's submission XML is encrypted into
submission.xml.enc and a new submission XML is constructed based upon a
form definition that describes an encrypted form, its encrypted
attachments, an encrypted representation of the single-use encryption key
that was used for that encryption, and the cryptographic signature of the
original form submission XML and its attachments.

The form definition that corresponds to the resulting submission XML is
defined in the source code of the XML form definition parsing logic here:

https://github.com/opendatakit/aggregate/blob/master/src/main/java/org/opendatakit/aggregate/parser/BaseFormParserForJavaRosa.java#L159

Note that this is not a fully-usable interactive form definition (you
can't give it to ODK Collect have have it work). It contains enough
information for ODK Aggregate to construct the storage structures for the
encrypted form. And it treats all the attachments as 'image/*' in the form
definition, though, when they are uploaded, they are all uploaded as
generic binary octet attachments (since they are encrypted).

The decryption of the form and the verification of the signature is
handled by this routine:

https://github.com/opendatakit/briefcase/blob/master/src/org/opendatakit/briefcase/util/FileSystemUtils.java#L738

We intentionally do not provide any means to decrypt the form on the
server.
It must be done through the ODK Briefcase app.

On Tue, Dec 1, 2015 at 10:43 PM, Tom Snyder tom.snyder@gematrix.com wrote:

Hi, Mitchell,
I am wondering if you would answer a few questions for me. I am
building a jersey web service to accept an encrypted Kobo form which I've
been told is based on ODK. My 1st question is : does ODK send the
submission.XML.enc file as part of the upload? Is there open source code
that can show me how to access both the XML payload and the
submission.XML.enc encrypted data as it is received by the server?
I appreciate any guidance and help you can provide.

Tom

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

http://www.smartstainable.org


http://www.geMatrix.com

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fabout.twitter.com%2Fresources%2Fbuttons&region=follow_link&screen_name=smartstainable&tw_p=followbutton&variant=2.0

http://www.smartstainable.com/

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fabout.twitter.com%2Fresources%2Fbuttons&region=follow_link&screen_name=smartstainable&tw_p=followbutton&variant=2.0

http://www.smartstainable.com/

Please ignore the last request.
Thank you,
Tom

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

http://www.smartstainable.org

··· ________________________________

On Jan 2, 2016 1:53 PM, "Tom Snyder" tom.snyder@gematrix.com wrote:

Hi, Mitch,
I'm still a bit puzzled at this as I get the following in the Request Input
Stream for a given simple form:
--RZovx2LrfsYpGOT6gUHpiJQmMz0OCX
Content-Disposition: form-data; name="xml_submission_file";
filename="simplesec_2016-01-02_13-48-22.xml"
Content-Type: text/xml
Content-Transfer-Encoding: binary

rR1Xc90YuOCLx7iVjZvmLRy+YSfoMcpRX+WfWrKFS1oz2RWYR5fTyn3sZoHsfy+ZHnug/rgRayAdx/RYuYDtzCmUdr93sGAzI4aefg2sfRE08uukDTSl7vCNQq1p0fDN3oZQZ26Ql2BwxjCxubU+fFzMssXqnwjRwsyQjZbK8ieJ4Gf/GYHY0478oi2olAU/fPQtxdF1j1TNgNb3MelbLCGcJ12cjkBYYKPQDk1daRao10WypUbJOtG0Mc+r4K4VtSdr7xEukzIRw9kxaqZZj18sO7/KbWaYMvKH8DURvegFiDnf8ZZomH7kanhhjcAplXyXChLAqwjnZL9jLWPfgg==<orx:meta
xmlns:orx="http://openrosa.org/xforms
">orx:instanceIDuuid:6f573414-34e3-4d8f-a9c4-3260651b16b9</orx:instanceID></orx:meta>
submission.xml.encY2dc/n3NSV01GtyZHA7rxITk/grfdNo0dsRBmm97zY0I8OWtIoftlXTFR2BRXpoQMt14VcQ21WEpRU/J5gkFs//VGAd/a4+pgimc6qk2iaOq91fF/vpsYvosRjH3RtMvU+HcyfoKHEpCeqZAsW7+FF2qtWnEILchN1IeFHk3Mhw1Zybx3z/4mn8Ww2vC3Nm6rPOz0QwOpD9Jg26Rr9MRJz0pQAwe+V2RWsZPXM1ukdPDNy7RoPtJ5qQDacGxowGds86ZXJ8cS8djquTSCk7sdcH8sU+iK6CH8nX30CMzU6xdo8HGjnvEhj4iH7vHDjRymsQbGQLNz1VNHtq0WBIpWA==
--RZovx2LrfsYpGOT6gUHpiJQmMz0OCX--

I've taken apart the form and only find one part - the

But nowhere do I see the submission.xml.enc file included in the input
stream. Can you provide any guidance please.

Kind thanks,
Tom

On Tue, Dec 29, 2015 at 9:30 AM, Mitch Sundt mitchellsundt@gmail.com wrote:

Yes.

On Tue, Dec 29, 2015 at 8:51 AM, Tom Snyder tom.snyder@gematrix.com wrote:

Thank you Mitch,

Is the submission.xml.enc sent on each post to the server along with the
XML file ha contains the key, the file name and the digest?

Kind thanks,
Tom

On Wed, Dec 2, 2015 at 12:20 PM, Mitch Sundt mitchellsundt@gmail.com wrote:

(adding opendatakit-developers@, as this question should be asked and
followed-up on that list).

Encrypted forms are handled as ordinary form definitions up until the
form is marked as finalized.

At that point, the form's submission XML is encrypted into
submission.xml.enc and a new submission XML is constructed based upon a
form definition that describes an encrypted form, its encrypted
attachments, an encrypted representation of the single-use encryption key
that was used for that encryption, and the cryptographic signature of the
original form submission XML and its attachments.

The form definition that corresponds to the resulting submission XML is
defined in the source code of the XML form definition parsing logic here:

https://github.com/opendatakit/aggregate/blob/master/src/main/java/org/opendatakit/aggregate/parser/BaseFormParserForJavaRosa.java#L159

Note that this is not a fully-usable interactive form definition (you
can't give it to ODK Collect have have it work). It contains enough
information for ODK Aggregate to construct the storage structures for the
encrypted form. And it treats all the attachments as 'image/*' in the form
definition, though, when they are uploaded, they are all uploaded as
generic binary octet attachments (since they are encrypted).

The decryption of the form and the verification of the signature is
handled by this routine:

https://github.com/opendatakit/briefcase/blob/master/src/org/opendatakit/briefcase/util/FileSystemUtils.java#L738

We intentionally do not provide any means to decrypt the form on the
server.
It must be done through the ODK Briefcase app.

On Tue, Dec 1, 2015 at 10:43 PM, Tom Snyder tom.snyder@gematrix.com wrote:

Hi, Mitchell,
I am wondering if you would answer a few questions for me. I am
building a jersey web service to accept an encrypted Kobo form which I've
been told is based on ODK. My 1st question is : does ODK send the
submission.XML.enc file as part of the upload? Is there open source code
that can show me how to access both the XML payload and the
submission.XML.enc encrypted data as it is received by the server?
I appreciate any guidance and help you can provide.

Tom

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

http://www.smartstainable.org


http://www.geMatrix.com

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fabout.twitter.com%2Fresources%2Fbuttons&region=follow_link&screen_name=smartstainable&tw_p=followbutton&variant=2.0

http://www.smartstainable.com/

--
Mitch Sundt
Software Engineer
University of Washington
mitchellsundt@gmail.com

--

Kind thanks,
Tom Snyder
Mobile: 203-733-8281

https://twitter.com/intent/follow?original_referer=https%3A%2F%2Fabout.twitter.com%2Fresources%2Fbuttons&region=follow_link&screen_name=smartstainable&tw_p=followbutton&variant=2.0

http://www.smartstainable.com/