Ensure zip keyfile has unique entries

This commit is contained in:
Christian Grigis 2021-02-09 18:39:34 +01:00 committed by Marvin W
parent 3885ed6ef8
commit 8a1ac35c4d
1 changed files with 12 additions and 2 deletions

View File

@ -445,8 +445,18 @@ class ExposureNotificationServiceImpl(private val context: Context, private val
for (entry in zip.entries()) {
when (entry.name) {
"export.bin" -> dataEntry = entry
"export.sig" -> sigEntry = entry
"export.bin" ->
if (dataEntry != null) {
throw Exception("Zip archive contains more than one 'export.bin' entry")
} else {
dataEntry = entry
}
"export.sig" ->
if (sigEntry != null) {
throw Exception("Zip archive contains more than one 'export.sig' entry")
} else {
sigEntry = entry
}
else -> throw Exception("Unexpected entry in zip archive: ${entry.name}")
}
}