Source:
private org.eclipse.jgit.transport.PushCertificate newSignedCert ( java.lang.String nonce , com.google.gerrit.server.git.gpg.TestKey signingKey ) throws java.lang.Exception { org.eclipse.jgit.transport.PushCertificateIdent ident = new org.eclipse.jgit.transport.PushCertificateIdent ( signingKey.getFirstUserId ( ) , java.lang.System.currentTimeMillis ( ) , ( ( - 7 ) * 60 ) ) ; java.lang.String payload = ( ( ( ( ( ( ( ( ( ( "certificate version 0.1\n" + "pusher " ) + ( ident.getRaw ( ) ) ) + "\n" ) + "pushee test://localhost/repo.git\n" ) + "nonce " ) + nonce ) + "\n" ) + "\n" ) + "0000000000000000000000000000000000000000" ) + " deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ) + " refs/heads/master\n" ; org.bouncycastle.openpgp.PGPSignatureGenerator gen = new org.bouncycastle.openpgp.PGPSignatureGenerator ( new org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder ( signingKey.getPublicKey ( ) . getAlgorithm ( ) , org.bouncycastle.openpgp.PGPUtil.SHA1 ) ) ; gen.init ( PGPSignature.BINARY_DOCUMENT , signingKey.getPrivateKey ( ) ) ; gen.update ( payload.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; org.bouncycastle.openpgp.PGPSignature sig = gen.generate ( ) ; java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream ( ) ; try ( org.bouncycastle.bcpg.BCPGOutputStream out = new org.bouncycastle.bcpg.BCPGOutputStream ( new org.bouncycastle.bcpg.ArmoredOutputStream ( bout ) ) ) { sig.encode ( out ) ; } java.lang.String cert = payload + ( new java.lang.String ( bout.toByteArray ( ) , java.nio.charset.StandardCharsets.UTF_8 ) ) ; java.io.Reader reader = new java.io.InputStreamReader ( new java.io.ByteArrayInputStream ( cert.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ) ; org.eclipse.jgit.transport.PushCertificateParser parser = new org.eclipse.jgit.transport.PushCertificateParser ( tr.getRepository ( ) , signedPushConfig ) ; return parser.parse ( reader ) ; }

Target:
private org.eclipse.jgit.transport.PushCertificate newSignedCert ( java.lang.String nonce , com.google.gerrit.gpg.testutil.TestKey signingKey ) throws java.lang.Exception { org.eclipse.jgit.transport.PushCertificateIdent ident = new org.eclipse.jgit.transport.PushCertificateIdent ( signingKey.getFirstUserId ( ) , java.lang.System.currentTimeMillis ( ) , ( ( - 7 ) * 60 ) ) ; java.lang.String payload = ( ( ( ( ( ( ( ( ( ( "certificate version 0.1\n" + "pusher " ) + ( ident.getRaw ( ) ) ) + "\n" ) + "pushee test://localhost/repo.git\n" ) + "nonce " ) + nonce ) + "\n" ) + "\n" ) + "0000000000000000000000000000000000000000" ) + " deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ) + " refs/heads/master\n" ; org.bouncycastle.openpgp.PGPSignatureGenerator gen = new org.bouncycastle.openpgp.PGPSignatureGenerator ( new org.bouncycastle.openpgp.operator.bc.BcPGPContentSignerBuilder ( signingKey.getPublicKey ( ) . getAlgorithm ( ) , org.bouncycastle.openpgp.PGPUtil.SHA1 ) ) ; gen.init ( PGPSignature.BINARY_DOCUMENT , signingKey.getPrivateKey ( ) ) ; gen.update ( payload.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; org.bouncycastle.openpgp.PGPSignature sig = gen.generate ( ) ; java.io.ByteArrayOutputStream bout = new java.io.ByteArrayOutputStream ( ) ; try ( org.bouncycastle.bcpg.BCPGOutputStream out = new org.bouncycastle.bcpg.BCPGOutputStream ( new org.bouncycastle.bcpg.ArmoredOutputStream ( bout ) ) ) { sig.encode ( out ) ; } java.lang.String cert = payload + ( new java.lang.String ( bout.toByteArray ( ) , java.nio.charset.StandardCharsets.UTF_8 ) ) ; java.io.Reader reader = new java.io.InputStreamReader ( new java.io.ByteArrayInputStream ( cert.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ) ; org.eclipse.jgit.transport.PushCertificateParser parser = new org.eclipse.jgit.transport.PushCertificateParser ( tr.getRepository ( ) , signedPushConfig ) ; return parser.parse ( reader ) ; }