use of org.jreleaser.util.signing.GpgCommandSigner in project jreleaser by jreleaser.
the class Signer method verify.
private static boolean verify(JReleaserContext context, FilePair filePair) throws SigningException {
context.getLogger().setPrefix("verify");
try {
context.getLogger().debug("{}", context.relativizeToBasedir(filePair.signatureFile));
GpgCommandSigner commandSigner = initCommandSigner(context);
return commandSigner.verify(filePair.signatureFile, filePair.inputFile);
} catch (CommandException e) {
throw new SigningException(RB.$("ERROR_signing_verify_signature", context.relativizeToBasedir(filePair.inputFile)), e);
} finally {
context.getLogger().restorePrefix();
}
}
use of org.jreleaser.util.signing.GpgCommandSigner in project jreleaser by jreleaser.
the class Signer method sign.
private static void sign(JReleaserContext context, List<FilePair> files) throws SigningException {
Path signaturesDirectory = context.getSignaturesDirectory();
try {
Files.createDirectories(signaturesDirectory);
} catch (IOException e) {
throw new SigningException(RB.$("ERROR_signing_create_signature_dir"), e);
}
context.getLogger().debug(RB.$("signing.signing.files"), files.size(), context.relativizeToBasedir(signaturesDirectory));
GpgCommandSigner commandSigner = initCommandSigner(context);
for (FilePair pair : files) {
sign(context, commandSigner, pair.inputFile, pair.signatureFile);
}
}
use of org.jreleaser.util.signing.GpgCommandSigner in project jreleaser by jreleaser.
the class Signer method initCommandSigner.
private static GpgCommandSigner initCommandSigner(JReleaserContext context) {
GpgCommandSigner cmd = new GpgCommandSigner(context.getLogger());
Signing signing = context.getModel().getSigning();
cmd.setExecutable(signing.getCommand().getExecutable());
cmd.setPassphrase(signing.getResolvedPassphrase());
cmd.setHomeDir(signing.getCommand().getHomeDir());
cmd.setKeyName(signing.getCommand().getKeyName());
cmd.setPublicKeyring(signing.getCommand().getPublicKeyring());
cmd.setDefaultKeyring(signing.getCommand().isDefaultKeyring());
cmd.setArgs(signing.getCommand().getArgs());
return cmd;
}
Aggregations