如何在 Java 中使用 pgp 加密来加密 .tar 文件

问题描述

我尝试使用 .pgp 加密技术加密 .tar,我有密钥值(这又不是文件),我必须用它来加密 .tar 文件。键值是一个字符串(即 keyval="xxxxx")。我从下面的 URL 中获取引用,该 URL 位于 github 中,并被许多用户引用。

https://github.com/matthewmccullough/encryption-jvm-bootcamp/blob/master/bc-pgp/src/main/java/com/ambientideas/cryptography/KeyBasedFileProcessorUtil.java

这个例子我想加密我在该位置的 .tar 文件

../myTarLocation 在我的代码

function randomNum() {
  const getRandomNum = () => Math.floor(Math.random() * 100 + 1);
  let latestRandom = getRandomNum(); 
    return {
    refresh: () => latestRandom = getRandomNum(),random: () => {
            return latestRandom;
        },sameRandom: () => {
            return latestRandom;
        },};
}
const s = randomNum();
s.random(); // 62
s.sameRandom(); //62
s.refresh(); // 85

但我不明白我将在哪里使用我拥有的 keyval,以及我将如何将 .tar 文件加密为 .tar.pgp 文件。任何人都可以帮助我。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)