From c4b4c13d9bc809a242b4fb053051709456068b52 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Mon, 10 Jul 2023 15:22:36 +0200 Subject: [PATCH] Certification Revocations equate to tsig of 0/0 --- .../wot/util/CertificationFactory.kt | 35 +++++++++++++------ 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/pgpainless-wot/src/main/kotlin/org/pgpainless/wot/util/CertificationFactory.kt b/pgpainless-wot/src/main/kotlin/org/pgpainless/wot/util/CertificationFactory.kt index 822ce30b..6a8e7b84 100644 --- a/pgpainless-wot/src/main/kotlin/org/pgpainless/wot/util/CertificationFactory.kt +++ b/pgpainless-wot/src/main/kotlin/org/pgpainless/wot/util/CertificationFactory.kt @@ -5,6 +5,7 @@ package org.pgpainless.wot.util import org.bouncycastle.openpgp.PGPSignature +import org.pgpainless.algorithm.SignatureType import org.pgpainless.signature.subpackets.SignatureSubpacketsUtil import org.pgpainless.wot.network.Node import org.pgpainless.wot.network.EdgeComponent @@ -35,16 +36,30 @@ class CertificationFactory { target: Node, targetUserId: String?, signature: PGPSignature): EdgeComponent { - return EdgeComponent( - issuer, - target, - targetUserId, - SignatureSubpacketsUtil.getSignatureCreationTime(signature)!!.time, - SignatureSubpacketsUtil.getSignatureExpirationTimeAsDate(signature), - SignatureSubpacketsUtil.isExportable(signature), - getTrustAmountFrom(signature), - getTrustDepthFrom(signature), - regexSetFrom(signature)) + 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( + issuer, + target, + targetUserId, + SignatureSubpacketsUtil.getSignatureCreationTime(signature)!!.time, + SignatureSubpacketsUtil.getSignatureExpirationTimeAsDate(signature), + SignatureSubpacketsUtil.isExportable(signature), + getTrustAmountFrom(signature), + getTrustDepthFrom(signature), + regexSetFrom(signature)) + } } @JvmStatic