微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决如何在 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 举报,一经查实,本站将立刻删除。