gpg在xp系统使用,用java调用指令对文件加密解密

本文介绍了如何在Windows XP系统下利用gpg4win进行文件加解密,并通过JAVA程序调用命令行来实现。在无法运行 kleopatra.exe 的情况下,作者详细阐述了手动生成密钥、设置参数、加密和解密文件的步骤,以及如何通过JAVA代码调用这些命令。
摘要由CSDN通过智能技术生成

由于项目要求,要使用gpg加解密技术,于是下载了gpg4win-2.1.0.exe,可是安装后kleopatra.exe怎么也运行不了,然后在网上查资料,大家都说控制面板修改语言为英语(美国),可是我试过以后依然不行,但还是可以用指令去加解密文件,然后找到了一篇好文章,解决了我的大部分疑惑。

生成密钥:

C:\Documents and Settings\admin>gpg --gen-key   //输入此命令
gpg (GnuPG) 2.0.17; Copyright (C) 2011 Free Software Foundation, Inc
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Please select what kind of key you want:
   (1) RSA and RSA (default)
   (2) DSA and Elgamal
   (3) DSA (sign only)
   (4) RSA (sign only)
Your selection? 1    //只有1可以用于加密,其它用于签名
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048)  // 选择密码的位数,位数越大越安全,但速度慢
Requested keysize is 2048 bits
Please specify how long the key should be valid.
         0 = key does not expire
      <n>  = key expires in n days
      <n>w = key expires in n weeks
      <n>m = key expires in n months
      <n>y = key expires in n years
Key is valid for? (0) 0   //根据实际情况选择密钥时限 0表示永久


Key does not expire at all
Is this correct? (y/N) y //确认

GnuPG needs to construct a user ID to identify your key.

Real name: myname   //请输入真实姓名,以后会用到
Email address: myemail@server.com  //输入邮箱,不能重复
Comment: comment    //可以为空
You selected this USER-ID:
    "raolin (use for GPG Encrypt) <myrl1023@126.com>"

Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o //输入o确认
You need a Passphrase to protect your secret key.  //输入两次密码

We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime generation; this gives the random number
generator a better chance to gain enough entropy.
We need to generate a lot of random bytes. It is a good idea to perform
some other action (type on the keyboard, move the mouse, utilize the
disks) during the prime gener

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值