Package org.pgpainless.algorithm
Class Trustworthiness
- java.lang.Object
-
- org.pgpainless.algorithm.Trustworthiness
-
public class Trustworthiness extends java.lang.Object
Facade class forTrustSignature
. A trust signature subpacket marks the trustworthiness of a certificate and defines its capabilities to act as a trusted introducer.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Trustworthiness.Builder
-
Field Summary
Fields Modifier and Type Field Description static int
MARGINALLY_CONVINCED
static int
NOT_TRUSTED
static int
THRESHOLD_FULLY_CONVINCED
-
Constructor Summary
Constructors Constructor Description Trustworthiness(int amount, int depth)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canIntroduce(int otherDepth)
Return true, if the certified cert can introduce certificates with trust depth ofboolean
canIntroduce(Trustworthiness other)
Return true, if the certified cert can introduce certificates with the givenstatic Trustworthiness.Builder
fullyTrusted()
This means that we are fully convinced of the trustworthiness of the key.int
getAmount()
Get the trust amount.int
getDepth()
Get the depth of the trust signature.boolean
isFullyTrusted()
Return true if the certificate is fully trusted.boolean
isIntroducer()
Return true, if the cert is an introducer.boolean
isMarginallyTrusted()
Return true if the certificate is at least marginally trusted.boolean
isNotTrusted()
Returns true, if the trust amount is equal to 0.static Trustworthiness.Builder
marginallyTrusted()
This means that we are marginally (partially) convinced of the trustworthiness of the key.static Trustworthiness.Builder
untrusted()
This means that we do not trust the key.
-
-
-
Field Detail
-
THRESHOLD_FULLY_CONVINCED
public static final int THRESHOLD_FULLY_CONVINCED
- See Also:
- Constant Field Values
-
MARGINALLY_CONVINCED
public static final int MARGINALLY_CONVINCED
- See Also:
- Constant Field Values
-
NOT_TRUSTED
public static final int NOT_TRUSTED
- See Also:
- Constant Field Values
-
-
Method Detail
-
getAmount
public int getAmount()
Get the trust amount. This value means how confident the issuer of the signature is in validity of the binding.- Returns:
- trust amount
-
getDepth
public int getDepth()
Get the depth of the trust signature. This value controls, whether the certificate can act as a trusted introducer.- Returns:
- depth
-
isNotTrusted
public boolean isNotTrusted()
Returns true, if the trust amount is equal to 0. This means the key is not trusted. Otherwise return false- Returns:
- true if untrusted
-
isMarginallyTrusted
public boolean isMarginallyTrusted()
Return true if the certificate is at least marginally trusted. That is the case, if the trust amount is greater than 0.- Returns:
- true if the cert is at least marginally trusted
-
isFullyTrusted
public boolean isFullyTrusted()
Return true if the certificate is fully trusted. That is the case if the trust amount is greater than or equal to 120.- Returns:
- true if the cert is fully trusted
-
isIntroducer
public boolean isIntroducer()
Return true, if the cert is an introducer. That is the case if the depth is greater 0.- Returns:
- true if introducer
-
canIntroduce
public boolean canIntroduce(int otherDepth)
Return true, if the certified cert can introduce certificates with trust depth ofotherDepth
.- Parameters:
otherDepth
- other certifications trust depth- Returns:
- true if the cert can introduce the other
-
canIntroduce
public boolean canIntroduce(Trustworthiness other)
Return true, if the certified cert can introduce certificates with the givenother
trust depth.- Parameters:
other
- other certificates trust depth- Returns:
- true if the cert can introduce the other
-
fullyTrusted
public static Trustworthiness.Builder fullyTrusted()
This means that we are fully convinced of the trustworthiness of the key.- Returns:
- builder
-
marginallyTrusted
public static Trustworthiness.Builder marginallyTrusted()
This means that we are marginally (partially) convinced of the trustworthiness of the key.- Returns:
- builder
-
untrusted
public static Trustworthiness.Builder untrusted()
This means that we do not trust the key. Can be used to overwrite previous trust.- Returns:
- builder
-
-