1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-12-25 04:17:59 +01:00

Certification Revocations equate to tsig of 0/0

This commit is contained in:
Paul Schaub 2023-07-10 15:22:36 +02:00
parent 09fabd4608
commit c4b4c13d9b
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311

View file

@ -5,6 +5,7 @@
package org.pgpainless.wot.util package org.pgpainless.wot.util
import org.bouncycastle.openpgp.PGPSignature import org.bouncycastle.openpgp.PGPSignature
import org.pgpainless.algorithm.SignatureType
import org.pgpainless.signature.subpackets.SignatureSubpacketsUtil import org.pgpainless.signature.subpackets.SignatureSubpacketsUtil
import org.pgpainless.wot.network.Node import org.pgpainless.wot.network.Node
import org.pgpainless.wot.network.EdgeComponent import org.pgpainless.wot.network.EdgeComponent
@ -35,6 +36,19 @@ class CertificationFactory {
target: Node, target: Node,
targetUserId: String?, targetUserId: String?,
signature: PGPSignature): EdgeComponent { signature: PGPSignature): EdgeComponent {
if (signature.signatureType == SignatureType.CERTIFICATION_REVOCATION.code) {
// Revocations equate to trust of 0/0
return EdgeComponent(
issuer,
target,
targetUserId,
SignatureSubpacketsUtil.getSignatureCreationTime(signature)!!.time,
SignatureSubpacketsUtil.getSignatureExpirationTimeAsDate(signature),
SignatureSubpacketsUtil.isExportable(signature),
0,
Depth.limited(0),
regexSetFrom(signature))
} else {
return EdgeComponent( return EdgeComponent(
issuer, issuer,
target, target,
@ -46,6 +60,7 @@ class CertificationFactory {
getTrustDepthFrom(signature), getTrustDepthFrom(signature),
regexSetFrom(signature)) regexSetFrom(signature))
} }
}
@JvmStatic @JvmStatic
private fun getTrustAmountFrom(signature: PGPSignature): Int { private fun getTrustAmountFrom(signature: PGPSignature): Int {