Skip to content
Snippets Groups Projects
Unverified Commit 5cd1e8ee authored by Mohamed Metwalli's avatar Mohamed Metwalli Committed by GitHub
Browse files

Remove dgc from hash (#3359)

parent b803af80
No related branches found
No related tags found
No related merge requests found
......@@ -147,15 +147,9 @@ class RapidAntigenQrCodeExtractor @Inject constructor() : QrCodeExtractor<Corona
private fun requireValidHash() {
val isQrCodeWithPersonalData = firstName != null && lastName != null && dateOfBirth != null
val rawBuilder = StringBuilder(
val generatedHash =
"${raw.dateOfBirth}#${raw.firstName}#${raw.lastName}#${raw.timestamp}#${raw.testid}#${raw.salt}"
)
if (raw.dgc != null) {
val asInt = if (raw.dgc == true) 1 else 0
rawBuilder.append("#$asInt")
}
val generatedHash = rawBuilder.toString().toSHA256()
.toSHA256()
if (isQrCodeWithPersonalData && !generatedHash.equals(hash, true)) {
throw InvalidQRCodeException("Generated hash doesn't match QRCode hash")
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment