From 0b843142389211104609ef188beeef0f293c5cd0 Mon Sep 17 00:00:00 2001 From: oleksandrsarapulovgl <82441124+oleksandrsarapulovgl@users.noreply.github.com> Date: Fri, 21 May 2021 13:26:04 +0300 Subject: [PATCH] Added signature validation error checker (#13) --- .../verifier/app/decoder/model/VerificationResult.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/decoder/src/main/java/dgca/verifier/app/decoder/model/VerificationResult.kt b/decoder/src/main/java/dgca/verifier/app/decoder/model/VerificationResult.kt index a8328ac..798603c 100644 --- a/decoder/src/main/java/dgca/verifier/app/decoder/model/VerificationResult.kt +++ b/decoder/src/main/java/dgca/verifier/app/decoder/model/VerificationResult.kt @@ -37,6 +37,16 @@ data class VerificationResult( return base45Decoded && zlibDecoded && coseVerified && cborDecoded && isSchemaValid && isTestValid } + /** + * Checks if all the checks but signature validation passed. + * Ultimately value {@code true} returned by the method + * would mean that signature validation has been checked. And it failed. + */ + fun isSignatureInvalid(): Boolean { + val isTestValid = testVerification?.isDetected ?: true + return (base45Decoded && zlibDecoded && cborDecoded && isSchemaValid && isTestValid) && !coseVerified + } + override fun toString(): String { return "VerificationResult: \n" + "base45Decoded: $base45Decoded \n" +