Example usage for org.eclipse.jgit.transport PushCertificateParser fromString

List of usage examples for org.eclipse.jgit.transport PushCertificateParser fromString

Introduction

In this page you can find the example usage for org.eclipse.jgit.transport PushCertificateParser fromString.

Prototype

public static PushCertificate fromString(String str) throws PackProtocolException, IOException 

Source Link

Document

Parse a push certificate from a string.

Usage

From source file:com.google.gerrit.gpg.api.GpgApiAdapterImpl.java

License:Apache License

@Override
public PushCertificateInfo checkPushCertificate(String certStr, IdentifiedUser expectedUser)
        throws GpgException {
    try {//  w  w w  . j  a  v a  2 s .com
        PushCertificate cert = PushCertificateParser.fromString(certStr);
        PushCertificateChecker.Result result = pushCertCheckerFactory.create(expectedUser).setCheckNonce(false)
                .check(cert);
        PushCertificateInfo info = new PushCertificateInfo();
        info.certificate = certStr;
        info.key = GpgKeys.toJson(result.getPublicKey(), result.getCheckResult());
        return info;
    } catch (IOException e) {
        throw new GpgException(e);
    }
}