Example usage for org.eclipse.jgit.transport PushCertificate getSignature

List of usage examples for org.eclipse.jgit.transport PushCertificate getSignature

Introduction

In this page you can find the example usage for org.eclipse.jgit.transport PushCertificate getSignature.

Prototype

public String getSignature() 

Source Link

Document

Get the raw signature

Usage

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

License:Apache License

private PGPSignature readSignature(PushCertificate cert) throws IOException {
    ArmoredInputStream in = new ArmoredInputStream(
            new ByteArrayInputStream(Constants.encode(cert.getSignature())));
    PGPObjectFactory factory = new BcPGPObjectFactory(in);
    Object obj;//from  w w w. ja  v a  2s . c om
    while ((obj = factory.nextObject()) != null) {
        if (obj instanceof PGPSignatureList) {
            PGPSignatureList sigs = (PGPSignatureList) obj;
            if (!sigs.isEmpty()) {
                return sigs.get(0);
            }
        }
    }
    return null;
}