Search in sources :

Example 1 with PGPSignatureList

use of org.bouncycastle.openpgp.PGPSignatureList in project gerrit by GerritCodeReview.

the class PushCertificateChecker method readSignature.

private PGPSignature readSignature(PushCertificate cert) throws IOException {
    ArmoredInputStream in = new ArmoredInputStream(new ByteArrayInputStream(Constants.encode(cert.getSignature())));
    PGPObjectFactory factory = new BcPGPObjectFactory(in);
    Object obj;
    while ((obj = factory.nextObject()) != null) {
        if (obj instanceof PGPSignatureList) {
            PGPSignatureList sigs = (PGPSignatureList) obj;
            if (!sigs.isEmpty()) {
                return sigs.get(0);
            }
        }
    }
    return null;
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) ArmoredInputStream(org.bouncycastle.bcpg.ArmoredInputStream) BcPGPObjectFactory(org.bouncycastle.openpgp.bc.BcPGPObjectFactory) PGPSignatureList(org.bouncycastle.openpgp.PGPSignatureList) PGPObjectFactory(org.bouncycastle.openpgp.PGPObjectFactory) BcPGPObjectFactory(org.bouncycastle.openpgp.bc.BcPGPObjectFactory)

Aggregations

ByteArrayInputStream (java.io.ByteArrayInputStream)1 ArmoredInputStream (org.bouncycastle.bcpg.ArmoredInputStream)1 PGPObjectFactory (org.bouncycastle.openpgp.PGPObjectFactory)1 PGPSignatureList (org.bouncycastle.openpgp.PGPSignatureList)1 BcPGPObjectFactory (org.bouncycastle.openpgp.bc.BcPGPObjectFactory)1