Cannot Finalize Forms in ODKCollect

Hi everyone! Please see below for a description of the problem I'm troubleshooting. If you need any additional information, please let me know! Thank you so much for taking a look.

What is the problem? Please be detailed.
When my colleague and I attempt to finalize a form on the ODKCollect application, it gives us both the error "Invalid RSA public key. Form has not been saved as finalized". I have scoured the ODK documentation but have not been able to find any guidance on how to fix this problem.

What ODK tool and version are you using? And on what device and operating system version?
I am using ODKCollect, version 1.18.1. My device is a Huawei Mate 9, running Android version 8.0.0.

What steps can we take to reproduce the problem?
I unfortunately am not sure why my colleague and I are getting this problem so I'm uncertain how to reproduce it.

What you have you tried to fix the problem?
I bought a microSD card and moved my forms onto it; it still didn't allow for me to mark the forms as finalized even after I encrypted the card. (My colleague's entire phone is encrypted, but mine only allows for encryption on a microSD card.) I've also attempted to upload the forms manually via Form Management > Submission Admin > Manually Upload Submission Data, but it does not seem to upload properly, because when I export the data to a csv file, it only displays the meta:instanceID.

Anything else we should know or have? If you have a test form or screenshots or logs, attach here.

Hi @fwashburn! What this message is suggesting to me is that your encrypted forms aren't properly configured.

Have you successfully used encrypted forms previously? Does this problem happen on all devices or just one?

1 Like

Hi @yanokwa! I have never used encrypted forms before this. (When I used ODKCollect in Sierra Leone, I was an end user; this is my first foray into ODKCollect's backend, as well as Aggregate and Briefcase.) This problem happens on both of the devices being used for data collection, even though my colleague's device is fully encrypted, and I've moved my forms to an encrypted SD card in my phone. I haven't been able to find anyone asking about it on ODK, StockExchange, etc., so it seems like it may be a less common problem.

When I skimmed through the encrypted forms documentation last time, it sounded as if the configuration was for the forms after they've been finalized and uploaded to a server, not for finalizing them on an Android device in the first place. But I'll read through again to make sure I'm not missing anything, and post again if I still haven't been able to find the solution. Thanks!

1 Like

Ok, so at long last, I have a usable form that I can finalize! :slight_smile: Thank you for pointing me back to the Encrypted Forms documentation; it had everything I needed. Now my question is - can I somehow retroactively apply this public key to the older forms on my colleague's and my devices, as they're the ones that are already filled out?

Glad it's working! I don't know if you can retroactively apply the public key. It might work (see form update docs), but I'd strongly recommend you try it on a test device with test data first.

If that's too onerous, it might be best to create a new form with the working encryption and ask users to use that form going forward. Then when the campaign is over, maybe have them enter the old data (or pull it from the SD card using Briefcase).

1 Like

Ok, I attempted to update the older version of the form, but alas, it wouldn't allow me to do so (which makes sense based on the form update documentation). The error message was:

Error: Form Already Exists for this Namespace/Id attribute org.opendatakit.aggregate.exception.ODKFormAlreadyExistsException: Form definition file has changed but does not specify a form version. Update the form version and resubmit.

So it sounds as if we'll still need to manually enter the data we've collected thus far, since I would have to finalize the forms in order to pull them from the SD card using Briefcase (and I can't do that with the older form version we collected all of our data in). I'll look a little bit longer to try to find a workaround, but at least we have a solution for future data collection efforts! :smiley:

And to confirm, you added a larger form version number to the new one you were updating? If you did and you are still getting that message, then yes, you it can't be updated.

Briefcase might be able to pull the unfinalized forms from the device and generate a CSV of the data. Try it, and if that works, then at least you've saved yourself some data entry.

1 Like

Yes, I added a larger form number and still got the error. Good to know that Briefcase may be able to pull the unfinalized forms; I was dreading having to enter them all manually.

I've been attempting to set up the Briefcase application (I just downloaded version 1.13.0), but for some reason whenever I try to run the application it doesn't open and instead writes a text file with error messages. I'm going to start a separate thread to troubleshoot that. Thanks again for your help!