# Some quick clarifications on encryption

**URL:** <https://forum.getodk.org/t/some-quick-clarifications-on-encryption/2143>\
**Category:** Development\
**Created:** [April 24, 2013, 1:54pm UTC](https://forum.getodk.org/t/some-quick-clarifications-on-encryption/2143 "2013-04-24T13:54:05Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Berg](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/matt_berg/32/1656_2.png) [@Matt\_Berg](https://forum.getodk.org/u/Matt_Berg)\
**Post date:** [April 24, 2013, 1:54pm UTC](https://forum.getodk.org/t/some-quick-clarifications-on-encryption/2143/1 "2013-04-24T13:54:05Z")

</div>

We're looking to add support for encrypted files into formhub.

We get how ODK briefcase works to download encrypted forms and decrypt and  
export locally.

For for submission, I see you can set a public key in xlsform. If that key  
is set, does ODK collect know automatically to encrypt the submission?

Also, what does the payload of the encrypted form to aggregate from collect  
look like? I looked around but wasn't able to find documentation on that.

Thanks for the help as always,

Matt

---

<div class="post-metadata">

**Author:** ![Mitch\_S](https://getodk.b-cdn.net/letter_avatar_proxy/v4/letter/m/3ec8ea/32.png) [@Mitch\_S](https://forum.getodk.org/u/Mitch_S)\
**Post date:** [April 24, 2013, 4:36pm UTC](https://forum.getodk.org/t/some-quick-clarifications-on-encryption/2143/2 "2013-04-24T16:36:59Z")

</div>

Yes, if the xlsform defines a public key, and has an instanceID, and if the  
device is running Android 2.2 or higher, it is used to encrypt the form and  
media attachments when it is Saved as Complete (marked as finalized'). At  
that time, an effort is made to delete the unencrypted form and media files.

The encrypted form is defined in the code here:

[http://code.google.com/p/opendatakit/source/browse/src/main/java/org/opendatakit/aggregate/parser/BaseFormParserForJavaRosa.java?repo=aggregate#113](http://code.google.com/p/opendatakit/source/browse/src/main/java/org/opendatakit/aggregate/parser/BaseFormParserForJavaRosa.java?repo=aggregate#113)

> **···**
>
> On Wed, Apr 24, 2013 at 6:54 AM, Matt Berg wrote:
> 
> > We're looking to add support for encrypted files into formhub.
> > 
> > We get how ODK briefcase works to download encrypted forms and decrypt and  
> > export locally.
> > 
> > For for submission, I see you can set a public key in xlsform. If that  
> > key is set, does ODK collect know automatically to encrypt the submission?
> > 
> > Also, what does the payload of the encrypted form to aggregate from  
> > collect look like? I looked around but wasn't able to find documentation  
> > on that.
> > 
> > Thanks for the help as always,
> > 
> > Matt
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Developers" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit-developers+unsubscribe@googlegroups.com](mailto:opendatakit-developers+unsubscribe@googlegroups.com).  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> 
> --  
> Mitch Sundt  
> Software Engineer  
> University of Washington  
> [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com)

---

<div class="post-metadata">

**Author:** ![Matt\_Berg](https://getodk.b-cdn.net/user_avatar/forum.getodk.org/matt_berg/32/1656_2.png) [@Matt\_Berg](https://forum.getodk.org/u/Matt_Berg)\
**Post date:** [April 24, 2013, 4:41pm UTC](https://forum.getodk.org/t/some-quick-clarifications-on-encryption/2143/3 "2013-04-24T16:41:18Z")

</div>

Thanks Mitch that's extremely helpful.

> **···**
>
> On Wednesday, April 24, 2013, Mitch Sundt wrote:
> 
> > Yes, if the xlsform defines a public key, and has an instanceID, and if  
> > the device is running Android 2.2 or higher, it is used to encrypt the form  
> > and media attachments when it is Saved as Complete (marked as finalized').  
> > At that time, an effort is made to delete the unencrypted form and media  
> > files.
> > 
> > The encrypted form is defined in the code here:
> > 
> > [http://code.google.com/p/opendatakit/source/browse/src/main/java/org/opendatakit/aggregate/parser/BaseFormParserForJavaRosa.java?repo=aggregate#113](http://code.google.com/p/opendatakit/source/browse/src/main/java/org/opendatakit/aggregate/parser/BaseFormParserForJavaRosa.java?repo=aggregate#113)
> > 
> > On Wed, Apr 24, 2013 at 6:54 AM, Matt Berg \<[mlberg@gmail.com](mailto:mlberg@gmail.com)\<javascript:\_e({}, 'cvml', 'mlberg@gmail.com');\> wrote:
> > 
> > > We're looking to add support for encrypted files into formhub.
> > > 
> > > We get how ODK briefcase works to download encrypted forms and decrypt  
> > > and export locally.
> > > 
> > > For for submission, I see you can set a public key in xlsform. If that  
> > > key is set, does ODK collect know automatically to encrypt the submission?
> > > 
> > > Also, what does the payload of the encrypted form to aggregate from  
> > > collect look like? I looked around but wasn't able to find documentation  
> > > on that.
> > > 
> > > Thanks for the help as always,
> > > 
> > > Matt
> > > 
> > > --  
> > > You received this message because you are subscribed to the Google Groups  
> > > "ODK Developers" group.  
> > > To unsubscribe from this group and stop receiving emails from it, send an  
> > > email to [opendatakit-developers+unsubscribe@googlegroups.com](mailto:opendatakit-developers+unsubscribe@googlegroups.com)\<javascript:\_e({}, 'cvml',  
> > > 'opendatakit-developers%2Bunsubscribe@googlegroups.com');\>.  
> > > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
> > 
> > --  
> > Mitch Sundt  
> > Software Engineer  
> > University of Washington  
> > [mitchellsundt@gmail.com](mailto:mitchellsundt@gmail.com) \<javascript:\_e({}, 'cvml',  
> > 'mitchellsundt@gmail.com');\>
> > 
> > --  
> > You received this message because you are subscribed to the Google Groups  
> > "ODK Developers" group.  
> > To unsubscribe from this group and stop receiving emails from it, send an  
> > email to [opendatakit-developers+unsubscribe@googlegroups.com](mailto:opendatakit-developers+unsubscribe@googlegroups.com)\<javascript:\_e({}, 'cvml',  
> > 'opendatakit-developers%2Bunsubscribe@googlegroups.com');\>.  
> > For more options, visit [https://groups.google.com/groups/opt\_out](https://groups.google.com/groups/opt_out).
