mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-12-25 04:17: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
|
package org.pgpainless.wot.dijkstra.sq
|
||||||
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
import kotlin.math.abs
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Revocation State of a certificate.
|
* 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 isNotRevoked(): Boolean = type == Type.None
|
||||||
|
|
||||||
fun isEffective(referenceTime: ReferenceTime): Boolean {
|
fun isEffective(referenceTime: ReferenceTime): Boolean {
|
||||||
return isHardRevocation() ||
|
if (isHardRevocation()) {
|
||||||
(isSoftRevocation() && referenceTime.timestamp.after(timestamp))
|
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