问题描述
我有一个.gpg文件和RSA私钥.如何在不使用操作系统的情况下以编程方式对其进行解密?例如而不使用Runtime.getRuntime().exec("gpg -decrypt.....");
I have a .gpg file and a RSA private key. How can I programatically decrypt it without using operating system? e.g. without using something like Runtime.getRuntime().exec("gpg -decrypt.....");
我发现所有库都运行操作系统.像 GnuPG 或 gnugpg-for-java .
Libraries I've found all run operating system. Like GnuPG or gnugpg-for-java.
推荐答案
Bouncy Castle 该库提供(除其他功能外)OpenPGP实现.软件包org.bouncycastle.openpgp.examples
包含几个用法示例,其中一个示例演示如何使用公共/秘密密钥对加密/解密文件(您可以在 GrepCode 或在项目的Github镜子).
The Bouncy Castle library provides (among other features) an OpenPGP implementation. The package org.bouncycastle.openpgp.examples
contains several usage examples, one of them showing how to encrypt/decrypt a file using a public/secret key pair (you can have a look at the examples on GrepCode or on the project's Github mirror).
这篇关于不使用Java.Runtime解密Java中的gpg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!