From 586cc1afb6716499c12ff89df37f00651ce4a56a Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Mon, 3 Jul 2023 17:00:25 +0200 Subject: [PATCH] RevocationState.isEffective(creationTime) is now also true --- .../pgpainless/wot/dijkstra/sq/RevocationState.kt | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/wot-dijkstra/src/main/kotlin/org/pgpainless/wot/dijkstra/sq/RevocationState.kt b/wot-dijkstra/src/main/kotlin/org/pgpainless/wot/dijkstra/sq/RevocationState.kt index d97d175b..9557a00f 100644 --- a/wot-dijkstra/src/main/kotlin/org/pgpainless/wot/dijkstra/sq/RevocationState.kt +++ b/wot-dijkstra/src/main/kotlin/org/pgpainless/wot/dijkstra/sq/RevocationState.kt @@ -5,6 +5,7 @@ package org.pgpainless.wot.dijkstra.sq import java.util.* +import kotlin.math.abs /** * Revocation State of a certificate. @@ -48,7 +49,15 @@ class RevocationState private constructor(val type: Type, val timestamp: Date?) fun isNotRevoked(): Boolean = type == Type.None fun isEffective(referenceTime: ReferenceTime): Boolean { - return isHardRevocation() || - (isSoftRevocation() && referenceTime.timestamp.after(timestamp)) + if (isHardRevocation()) { + return true + } + if (isSoftRevocation()) { + if (referenceTime.timestamp.after(timestamp)) { + return true + } + return abs(referenceTime.timestamp.time / 1000 - timestamp!!.time / 1000) == 0L // less than one second diff + } + return false } } \ No newline at end of file