1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-05 20:15:59 +01:00

RevocationState.isEffective(creationTime) is now also true

This commit is contained in:
Paul Schaub 2023-07-03 17:00:25 +02:00
parent b58e464dfb
commit 4c139d19c1
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -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
}
}