Example usage for org.bouncycastle.bcpg SignatureSubpacketTags TRUST_SIG

List of usage examples for org.bouncycastle.bcpg SignatureSubpacketTags TRUST_SIG

Introduction

In this page you can find the example usage for org.bouncycastle.bcpg SignatureSubpacketTags TRUST_SIG.

Prototype

int TRUST_SIG

To view the source code for org.bouncycastle.bcpg SignatureSubpacketTags TRUST_SIG.

Click Source Link

Usage

From source file:com.google.gerrit.gpg.PublicKeyChecker.java

License:Apache License

private CheckResult checkTrustSubpacket(PGPSignature sig, int depth) {
    SignatureSubpacket trustSub = sig.getHashedSubPackets().getSubpacket(SignatureSubpacketTags.TRUST_SIG);
    if (trustSub == null || trustSub.getData().length != 2) {
        return new CheckResult("Certification is missing trust information");
    }// w  w w  .  j av  a 2 s  .co  m
    byte amount = trustSub.getData()[1];
    if (amount < COMPLETE_TRUST) {
        return new CheckResult("Certification does not fully trust key");
    }
    byte level = trustSub.getData()[0];
    int required = depth + 1;
    if (level < required) {
        return new CheckResult(
                "Certification trusts to depth " + level + ", but depth " + required + " is required");
    }
    return CheckResult.OK;
}