mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-24 11:57:59 +01:00
RevocationState.isEffective(creationTime) is now also true
This commit is contained in:
parent
b58e464dfb
commit
4c139d19c1
1 changed files with 11 additions and 2 deletions
|
@ -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
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue