// Path: src/main/java/org/simplify4u/plugins/utils/HexUtils.java
// public static String fingerprintToString(byte[] bytes) {
//     StringBuilder ret = new StringBuilder();
//     ret.append("0x");
//     for (byte b : bytes) {
//         ret.append(String.format("%02X", b));
//     }
//     return ret.toString();
// }


import static org.simplify4u.plugins.utils.HexUtils.fingerprintToString;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.EqualsAndHashCode;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;
        KeyIdFingerprint(byte[] fingerprint) {
            this.fingerprint = fingerprint;
        }

        @Override
        public String getHashPath() {
            StringBuilder ret = new StringBuilder();
            ret.append(String.format("%02X/", fingerprint[0]));
            ret.append(String.format("%02X/", fingerprint[1]));
            for (byte b: fingerprint) {
                ret.append(String.format("%02X", b));
            }
            ret.append(".asc");
            return ret.toString();
        }

        @Override
        public PGPPublicKey getKeyFromRing(PGPPublicKeyRing publicKeyRing) {
            return publicKeyRing.getPublicKey(fingerprint);
        }

        @Override
        public PGPPublicKeyRing getKeyRingFromRingCollection(PGPPublicKeyRingCollection pgpRingCollection)
                throws PGPException {
            return pgpRingCollection.getPublicKeyRing(fingerprint);
        }

        @Override
        @JsonValue
        public String toString() {
// Path: src/main/java/org/simplify4u/plugins/utils/HexUtils.java
// public static String fingerprintToString(byte[] bytes) {
//     StringBuilder ret = new StringBuilder();
//     ret.append("0x");
//     for (byte b : bytes) {
//         ret.append(String.format("%02X", b));
//     }
//     return ret.toString();
// }


// Path: src/main/java/org/simplify4u/plugins/pgp/KeyId.java
import static org.simplify4u.plugins.utils.HexUtils.fingerprintToString;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.EqualsAndHashCode;
import org.bouncycastle.openpgp.PGPException;
import org.bouncycastle.openpgp.PGPPublicKey;
import org.bouncycastle.openpgp.PGPPublicKeyRing;
import org.bouncycastle.openpgp.PGPPublicKeyRingCollection;

        KeyIdFingerprint(byte[] fingerprint) {
            this.fingerprint = fingerprint;
        }

        @Override
        public String getHashPath() {
            StringBuilder ret = new StringBuilder();
            ret.append(String.format("%02X/", fingerprint[0]));
            ret.append(String.format("%02X/", fingerprint[1]));
            for (byte b: fingerprint) {
                ret.append(String.format("%02X", b));
            }
            ret.append(".asc");
            return ret.toString();
        }

        @Override
        public PGPPublicKey getKeyFromRing(PGPPublicKeyRing publicKeyRing) {
            return publicKeyRing.getPublicKey(fingerprint);
        }

        @Override
        public PGPPublicKeyRing getKeyRingFromRingCollection(PGPPublicKeyRingCollection pgpRingCollection)
                throws PGPException {
            return pgpRingCollection.getPublicKeyRing(fingerprint);
        }

        @Override
        @JsonValue
        public String toString() {
            return fingerprintToString(fingerprint);