GPG生成密钥对(Windows)及应用

安装Gpg4win,下载链接:https://download.csdn.net/download/zyhlwzy/11099228

1、生成密钥对

C:\WINDOWS\system32>gpg --gen-key
gpg (GnuPG) 2.0.30; Copyright (C) 2015 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  #选择密钥类型(这里我们选择加密算法是RSA、数字签名算法也是RSA)
RSA keys may be between 1024 and 4096 bits long.
What keysize do you want? (2048) 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  #设置密钥有效期(永不过期)
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: Ron   #输入姓名
Name must be at least 5 characters long  #姓名至少为5个字符
Real name: ron.zheng   #输入姓名
Email address: ron.zheng@tfschange.com  #输入邮箱地址
Comment: tfs #输入备注
You selected this USER-ID:"ron.zheng (tfs) <ron.zheng@tfschange.com>"Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o  #选择OK
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 generation; this gives the random number
generator a better chance to gain enough entropy.
gpg: key 0452FE75 marked as ultimately trusted
public and secret key created and signed.gpg: checking the trustdb
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   2  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 2u
pub   2048R/0452FE75 2019-03-28Key fingerprint = 65B4 846F 7E63 A32B 34E3  A9FB C99D B8B9 0452 FE75
uid       [ultimate] ron.zheng (tfs) <ron.zheng@tfschange.com>
sub   2048R/488F27D2 2019-03-28

2、查看刚才生成的公钥

C:\WINDOWS\system32>gpg --export --armor 488F27D2
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2mQENBFyceJkBCAC9m2UeEevNgTjUG+N+6AMkBiM5B75PpcT6WJoJUuxdzXIKYDuw
zuYfVUJ59maSyAZ3rD2hHlgCjV4EycjOrrr27Ke726ZccsKGg1FG1G1PEuHL6aDa
ONRdcLbFdUpv9EwQZrfPGQnATw4p83gxZ8HwXemH+wybenSbuXQQuWY5X7lmJ0sy
8Kzmz5SGL1VLByYCyJAuLGCs8rFitW/w/JpQTQZR4BoezOecAF0DZR24SaWrkBQu
vpCh8nHaVSRE7R0xi+sLKohDfgr3MLjDAopEMmUaImUaeRwyVThwvT2tq9/Qn4GI
2b3R+Tw3afs9eyWkhK+oWSfMv/0zuBWD0axRABEBAAG0KXJvbi56aGVuZyAodGZz
KSA8cm9uLnpoZW5nQHRmc2NoYW5nZS5jb20+iQE5BBMBCAAjBQJcnHiZAhsDBwsJ
CAcDAgEGFQgCCQoLBBYCAwECHgECF4AACgkQyZ24uQRS/nWFywgAmLvoaYfAy5zV
ZMM4zpbw3kf7HpIemlDUPVzJKTOM9cu62/O3eLb592jQCVcs9U0wLlkrkRGe4geC
n72M5hR/psWoLfKOAXDrT9C+a0vW991tYtPbUfnNdDfoQPn/T0Z/jsB26WkZ5X76
8jwwVB6Q8EFD2nFv2HzC4UZl/4qylp+dzEskRtp1lL54LECEyIQDWZCCO+iddile
JpxScQz/GEXzB46o1dDCraqL1Neyyp8MHmhTaxCspKZ9eGSWjXTN+8kmTdqN+6R3
ssAecvWEwqXrGBCTWg9NvmfcYWZBImzDplnuOqkP7ZeTUhSihM+uov5ALyokrLTT
QQFQ0Hs4fbkBDQRcnHiZAQgA4XpvgCB4+ElQo5hRPZcklgZwzdLElmfjDE4F5ist
AH+ndxoTWfagvThPgZh855k4/bdXBPohkuECwGESr6RrfajMozLvfeHyYSxtQmhD
fACuYuYjfAfL7OoDTmFYiNBwWNx8fzE3i2EjUJWuJpz10zb3O8ly2X+gFe5Rv4Yj
CS0nY38aGaiKypJ54nrP3pkIusFux4rMEYzVRpDx5jWFWtPWHnKZtw8LYPQOJjES
l0Z1j0ANwJjnxFf123HvgiaAZK3H1BWUcXlnDRR2w84ZUMGJTuguYd5BjqAIrfv/
8xkZwJgqOs21Idt+KBYkksDjVZ/xDg6ycv1ZUcJgZltQfQARAQABiQEfBBgBCAAJ
BQJcnHiZAhsMAAoJEMmduLkEUv51YsgH/3nfVb4Yq+hWEsLPb2v8JoMJZcyx/mS+
Yqba4SZD/9Eg6SM+bArBfG4p4jee92EJVKIzHOp6n0YPMcF8WWrIXoy+SHReHT7V
KyS6zpxUtQk3eQC4Yutmk5NNI87gzrK16uBwG110jkHh3IlglEcLxui2bASbsL6s
waePqRHmq69rUKh/za/toVbKWAnNK0hfEizFIvMdHPVx4/Hjo02EM+CBbzKD/LZg
RuAtKiEWnFH3ljnmXHxIxnV+IzUzKGkaPUrmOoDMLEtnw/vPpMbLov3bEyHROci0
FZhUNi+4EADxXbk+FwHTSLMHgpNPhUQsgLrnWFulLbCWGm98L0WqVXU=
=GFn+
-----END PGP PUBLIC KEY BLOCK-----

3、列出密钥

C:\WINDOWS\system32>gpg --list-keys
#显示公钥文件名
C:/Users/user/AppData/Roaming/gnupg/pubring.gpg
-----------------------------------------------#显示公钥特征
pub   2048R/0452FE75 2019-03-28
#显示用户ID
uid       [ultimate] ron.zheng (tfs) <ron.zheng@tfschange.com>
#显示私钥特征
sub   2048R/488F27D2 2019-03-28

4、将公钥导入到文件

公钥文件(.gnupg/pubring.gpg)以二进制形式储存,armor 参数可以将其转换为 ASCII 码显示。

gpg --armor --output "输出文件名" --export "用户ID"gpg --armor --output C:/data/cert/test-public-key.asc --export  ron.zheng

在这里插入图片描述

打开查看公钥内容如下:

-----BEGIN PGP PUBLIC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sJYab3wvRapVdQ==
=CruP
-----END PGP PUBLIC KEY BLOCK-----

5、导出私钥

export-secret-keys 参数可以导出私钥。

gpg --armor --output C:/data/cert/tfs-private-key.asc --export-secret-keys

在这里插入图片描述

打开可看到私钥信息如下:

-----BEGIN PGP PRIVATE KEY BLOCK-----
Version: GnuPG v2lQO+BFx8sxMBCADZfybJzhFVAkd59woEwoEM4Dg/vdqYAQIGLnrpAONTmTWYB2ni
M+iAcGAMf7KqearffKu1cS6U8EYlG3IHHMgMm7bt1DU4Gb4ZaxScHOXkDm1b86fR
senDmYA1OlKoSVckZ63tap2Q9pj4waWWIfXt5jt+uE+fxbPkzydw0OhtjjGlAFe5
3v5CLhWTLZW2Jxeeuwhcxxt8txxxOh/U/i8E1VSM8p97uzb4cJgFqHa96zD7KWTh
XOsWvObbj0tgRqpE/RJkeZVtW3qqS39g4y3KRUxma2025ZR8d53Tw9ebcMxjjT+h
GxNEotuCeIhbQOxVNw5qmUkTbnfVjr6ZngUlABEBAAH+AwMCtWtkRUfUh5/Cs84J
/Jo0zGAKhYeNCvwJDLB2n36GVo1Filox6KTxagOVbPknc7gef2Aa03YpMsjFlwPP
SmlTAaBnHP+YXj1ka0Ai/Pbm1lfcvoaYkK46ToJfF83nhrVza/aD5TnlQDfdqze1
JWJeMBDXMT1hazPo3N4eOD4Hu9EAMgvR2Mcjy0LzDHT7mxMPqbF6GQglYgYqkBJn
LmGlM+RAm9x2hxPSS1JF1DOUbVMbXcDfUCcZjeCPvfONpiJK/ysKUzP8rATH+Wf5
Ql8y08yic6T+fAD5AFYmZaA7vHNkovipC7/YZ1xUc3dWhaFv/stzA4IbqoHwDlC7
xdZOOm2WDRot6DpNJT3s5IGbKnvaOrdipgWNqIWDB3s10ozMCSscfndWlccrvvt0
IGGD78kiN3TzQkcNPMhBzYs0X2mnbEmc7r5NvZGgim/3d8GLfyeTrxbab11aHomV
JSmYiLNwwfF77WBaz/eeaR8IrEShDEDsP0pG5kNk9ibuCpctO3EcCFMigVO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KQqVXPK44ML0eEZWdxbL2gWC7xljM
3iXYkcGw8nGFqx2Q4wOvyu2/Of/WSZl/ARmB393Wew9iT5IKTHAJt79msq5hkGh+
Te6iA1Fu7a2KSE3FbKH15v5Rn4vHQaYRewlJQJKS6Aw9zMUL9ekog2ve2M1zvXUk
QijGz1k706ij1YaclfSXFrCbQVbNB83xF2A8eISXXY67q+MpZUaawh7Co7eiQUZb
xljWK+PU69U9PeC+GINu8QHYPGHuHn2yTR3eQubMk32kUqgmOCSKXi5KdPAqiQEf
BBgBCAAJBQJcnHiZAhsMAAoJEMmduLkEUv51YsgH/3nfVb4Yq+hWEsLPb2v8JoMJ
Zcyx/mS+Yqba4SZD/9Eg6SM+bArBfG4p4jee92EJVKIzHOp6n0YPMcF8WWrIXoy+
SHReHT7VKyS6zpxUtQk3eQC4Yutmk5NNI87gzrK16uBwG110jkHh3IlglEcLxui2
bASbsL6swaePqRHmq69rUKh/za/toVbKWAnNK0hfEizFIvMdHPVx4/Hjo02EM+CB
bzKD/LZgRuAtKiEWnFH3ljnmXHxIxnV+IzUzKGkaPUrmOoDMLEtnw/vPpMbLov3b
EyHROci0FZhUNi+4EADxXbk+FwHTSLMHgpNPhUQsgLrnWFulLbCWGm98L0WqVXU=
=Jwdu
-----END PGP PRIVATE KEY BLOCK-----

6、删除密钥,在命令行输入如下命令

必须先删除私钥,然后才能删除公钥。

在命令行输入如下命令:

gpg --delete-secret-keys 标识名
gpg --delete-keys 标识名

7、PGP加解密帮助类(Java)

/**
* <p>Title: PGPUtils</p>  
* <p>Description: PGP加解密帮助类</p>  
* @author Ron  
* @date 2019年3月4日*/
public class PGPUtils {/*** 添加提供者*/static{Security.addProvider(new CryptixCrypto());Security.addProvider(new CryptixOpenPGP() );}/*** 构建 LiteralMessage 对象* @param message		* @return* @throws MessageException*/private static LiteralMessage buildLiteralMessage(byte[] message) throws MessageException{LiteralMessageBuilder lmb = null;try {lmb = LiteralMessageBuilder.getInstance("OpenPGP");} catch (NoSuchAlgorithmException e) {e.printStackTrace();}lmb.init(message);LiteralMessage literal = (LiteralMessage)lmb.build();return literal;}/*** 使用多个公钥对明文加密* @param plain			明文* @param recipientKeys	公钥集合* @return				加密后的明文* @throws MessageException*/public static byte[] encrypt(byte[] plain,List<KeyBundle> recipientKeys) throws MessageException{LiteralMessage literal = buildLiteralMessage(plain);EncryptedMessageBuilder emb = null;try {emb = EncryptedMessageBuilder.getInstance("OpenPGP");} catch (NoSuchAlgorithmException e) {e.printStackTrace();}emb.init(literal);//添加接受者for(KeyBundle key : recipientKeys){emb.addRecipient(key);}//压缩emb.setAttribute("compressed", "true");//得到加密信息Message msg = emb.build();PGPArmouredMessage pgpMsg = new PGPArmouredMessage(msg);return pgpMsg.getEncoded();}/*** 使用单张公钥加密* @param plain		明文	* @param publicKey	公钥* @return	返回加密后的密文* @throws MessageException*/public static byte[] encrypt(byte[] plain,KeyBundle publicKey) throws MessageException{List<KeyBundle> list = new ArrayList<KeyBundle>();list.add(publicKey);return encrypt(plain, list);}/*** 使用单张公钥加密* @param plain		明文	* @param publicKey	公钥路径* @return	返回加密后的密文* @throws MessageException*/public static byte[] encrypt(byte[] plain,String publicKeyPath) throws MessageException, IOException{InputStream priInputStream  = new FileInputStream(new File(publicKeyPath));KeyBundle publicKeyBundle = PGPUtils.streamToKeyBundle(priInputStream);return PGPUtils.encrypt(plain, publicKeyBundle);}/*** 使用私钥和密码对明文签名* @param plain			明文* @param privateKey	私钥* @param keypass		私钥密码* @return				签名后的明文* @throws MessageException* @throws UnrecoverableKeyException*/public static byte[] sign(byte[] plain,KeyBundle privateKey,String keypass)throws MessageException,UnrecoverableKeyException{SignedMessageBuilder smb = null;try {smb = SignedMessageBuilder.getInstance("OpenPGP");} catch (NoSuchAlgorithmException e) {e.printStackTrace();}LiteralMessage literal = buildLiteralMessage(plain);smb.init(literal);smb.addSigner(privateKey, keypass.toCharArray());Message msg = smb.build();PGPArmouredMessage armoured = new PGPArmouredMessage(msg);return armoured.getEncoded();}/*** 使用私钥和密码对明文签名* @param plain			明文* @param privateKey	私钥路径* @param keypass		私钥密码* @return				签名后的明文* @throws MessageException* @throws UnrecoverableKeyException*/public static byte[] sign(byte[] plain,String privateKeyPath,String keypass)throws MessageException,UnrecoverableKeyException, IOException{InputStream priInputStream  = new FileInputStream(new File(privateKeyPath));KeyBundle privateKeyBundle = PGPUtils.streamToKeyBundle(priInputStream);return PGPUtils.sign(plain, privateKeyBundle, keypass);}/*** 使用私钥和密码解密加密后的数据* @param encrypted		PGP加密过的数据* @param privateKey	私钥* @param keypass		私钥密码* @return				解密后的明文* @throws MessageException* @throws IOException* @throws UnrecoverableKeyException* @throws NotEncryptedToParameterException*/public static byte[] decrypt(byte[] encrypted,KeyBundle privateKey,String keypass) throws MessageException, IOException, UnrecoverableKeyException, NotEncryptedToParameterException{MessageFactory mf = null;try {mf = MessageFactory.getInstance("OpenPGP");} catch (NoSuchAlgorithmException e) {e.printStackTrace();}Collection msgs = mf.generateMessages(new ByteArrayInputStream(encrypted));//得到集合中的EncryptedMessage对象Message message = (Message)msgs.iterator().next();if (!(message instanceof EncryptedMessage)) {throw new MessageException("Not a encrypted message.");}EncryptedMessage em = (EncryptedMessage)message;Message msg = em.decrypt(privateKey,keypass.toCharArray());return ((LiteralMessage)msg).getBinaryData();}/*** 使用私钥和密码解密加密后的数据* @param encrypted		PGP加密过的数据* @param privateKey	私钥路径* @param keypass		私钥密码* @return				解密后的明文* @throws MessageException* @throws IOException* @throws UnrecoverableKeyException* @throws NotEncryptedToParameterException*/public static byte[] decrypt(byte[] encrypted,String privateKeyPath,String keypass) throws MessageException, IOException, UnrecoverableKeyException, NotEncryptedToParameterException{InputStream priInputStream  = new FileInputStream(new File(privateKeyPath));KeyBundle privateKeyBundle = PGPUtils.streamToKeyBundle(priInputStream);return PGPUtils.decrypt(encrypted,privateKeyBundle,keypass);}/*** 解密验签* @param encrypted		密文	* @param privateKey	私钥* @param keypass		私钥密码* @param publicKey		公钥* @return				返回明文* @throws UnrecoverableKeyException* @throws MessageException* @throws IOException* @throws NotEncryptedToParameterException*/public static byte[] decryptVerify(byte[] encrypted,KeyBundle privateKey,String keypass,KeyBundle publicKey) throws UnrecoverableKeyException, MessageException, IOException, NotEncryptedToParameterException{return PGPUtils.verify(PGPUtils.decrypt(encrypted, privateKey, keypass), publicKey);}/*** 解密验签* @param encrypted		密文	* @param privateKey	私钥路径* @param keypass		私钥密码* @param publicKey		公钥路径* @return				返回明文* @throws UnrecoverableKeyException* @throws MessageException* @throws IOException* @throws NotEncryptedToParameterException*/public static byte[] decryptVerify(byte[] encrypted,String privateKeyPath,String keypass,String publicKeyPath) throws UnrecoverableKeyException, MessageException, IOException, NotEncryptedToParameterException{InputStream priInputStream  = new FileInputStream(new File(privateKeyPath));KeyBundle privateKeyBundle = PGPUtils.streamToKeyBundle(priInputStream);InputStream pubInputStream = new FileInputStream(new File(publicKeyPath));KeyBundle pubKeyBundle = PGPUtils.streamToKeyBundle(pubInputStream);return PGPUtils.decryptVerify(encrypted,privateKeyBundle,keypass,pubKeyBundle);}/*** 验证Message* @param signed	验证的内容* @param publickey	公钥* @return			返回验证后的内容* @throws MessageException* @throws IOException*/public static byte[] verify(byte[] signed,KeyBundle publickey) throws MessageException, IOException{MessageFactory mf = null;try {mf = MessageFactory.getInstance("OpenPGP");} catch (NoSuchAlgorithmException e) {e.printStackTrace();}Message msg = (Message)mf.generateMessages(new ByteArrayInputStream(signed)).iterator().next();if (!(msg instanceof SignedMessage)) {throw new MessageException(" Not a signed message.");}SignedMessage sm = (SignedMessage)msg;if (sm.verify(publickey)) {} else {throw new MessageException(" Signature verify fail. ");}if (!(sm.getContents() instanceof LiteralMessage)){throw new MessageException(" Not a signed message.");}LiteralMessage lm = (LiteralMessage)sm.getContents();return lm.getBinaryData();}/*** 流转换为PGP KeuBundle 对象* @param inputStream 	Key* @return	转换后的 KeuBundle* @throws MessageException* @throws IOException*/public static KeyBundle streamToKeyBundle(InputStream inputStream) throws MessageException, IOException {MessageFactory messageFactory = null;try {messageFactory = MessageFactory.getInstance("OpenPGP");} catch (NoSuchAlgorithmException e) {e.printStackTrace();}Collection msgs = messageFactory.generateMessages(inputStream);KeyBundleMessage keybm = (KeyBundleMessage)msgs.iterator().next();return keybm.getKeyBundle();}/*** 签名加密* @param plain			明文	* @param privateKey	私钥	* @param keypass		私钥密码* @param recipientKeys	公钥* @return				返回签名加密后的数据* @throws UnrecoverableKeyException* @throws MessageException*/public static byte [] signAndEncrypt(byte[] plain,KeyBundle privateKey,String keypass,List<KeyBundle> recipientKeys) throws UnrecoverableKeyException, MessageException{return PGPUtils.encrypt(PGPUtils.sign(plain, privateKey, keypass),recipientKeys);}/*** 签名加密* @param plain			明文	* @param privateKey	私钥	* @param keypass		私钥密码* @param recipientKeys	公钥* @return				返回签名加密后的数据* @throws UnrecoverableKeyException* @throws MessageException*/public static byte [] signAndEncrypt(byte[] plain,KeyBundle privateKey,String keypass,KeyBundle publicKey) throws UnrecoverableKeyException, MessageException{return PGPUtils.encrypt(PGPUtils.sign(plain, privateKey, keypass),publicKey);}/*** @author Ron* <p>Title: signAndEncrypt</p>  * <p>Description: </p>  * @param plain                 明文* @param privateKeyPath        私钥路径* @param keypass               私钥密码* @param publicKeyPath         公钥* @return                      返回签名加密后的数据* @throws UnrecoverableKeyException* @throws MessageException* @throws IOException */public static byte [] signAndEncrypt(byte[] plain,String privateKeyPath,String keypass,String publicKeyPath) throws UnrecoverableKeyException, MessageException, IOException{InputStream priInputStream  = new FileInputStream(new File(privateKeyPath));KeyBundle privateKeyBundle = PGPUtils.streamToKeyBundle(priInputStream);InputStream pubInputStream = new FileInputStream(new File(publicKeyPath));KeyBundle pubKeyBundle = PGPUtils.streamToKeyBundle(pubInputStream);return PGPUtils.signAndEncrypt(plain,privateKeyBundle,keypass,pubKeyBundle);}public static void main(String[] args) throws MessageException, IOException, UnrecoverableKeyException, NotEncryptedToParameterException {String data = "{\"platId\": \"***\",\"authorizeCode\": \"EPORT0000102\",\"msgType\": \"VLD001\",\"format\": \"json\",\"signature\": \"signature\",\"userName\": \"test\",\"password\": \"***\",\"data\": {\"entryId\": \"E20170000003131789\",\"ownerCode\": \"**********\",\"ownerName\": \"广东鱼珠木材电子商务有限公司\",\"cnsnTradeCode\": \"********\",\"consignorCname\": \"广东广物木材产业股份有限公司\",\"consignorEname\": \"En*******************\",\"agentCode\": \"**********\",\"agentName\": \"广东省电子口岸管理有限公司\",\"ciqDespCtryCode\": \"NZL\",\"ciqDespCtryCodeName\": \"新西兰\",\"despPortCode\": \"991201\",\"despPortCodeName\": \"天津出口加工区\",\"cusTradeNationCode\": \"AFG\",\"cusTradeNationCodeName\": \"阿富汗\",\"districtCode\": \"11013\",\"districtCodeName\": \"中关村国家自主创新示范区(东城园)\",\"packNo\": \"100\",\"grossWt\": \"100\",\"netWt\": \"100\",\"supvModeCdde\": \"1039\",\"supvModeCddeName\": \"市场采购\",\"decMergeListVo\": [{\"gNo\": \"1\",\"contrItem\": \"1\",\"codeTs\": \"1001110001\",\"gName\": \"种用硬粒小麦\",\"gModel\": \"0|2|冰袋|100%涤纶|无牌 款号:AC04S1238\", \"declTotal\": \"60\",\"tradeCurr\": \"美元\",\"gQty\":\"10\"},{\"gNo\": \"1\",\"contrItem\": \"1\",\"codeTs\": \"1001110001\",\"gName\": \"种用硬粒小麦\",\"gModel\": \"0|2|冰袋|100%涤纶|无牌 款号:AC04S1238\", \"declTotal\": \"60\",\"tradeCurr\": \"美元\",\"gQty\":\"10\"}]}}";String privateKey = "D:/Work/WorkSpace/trunk_remote_dev/tfs-china-eport-api/src/main/resources/cert/test-private-key.txt";String keypass = "tfs12345678";String publicKey = "D:/Work/WorkSpace/trunk_remote_dev/tfs-china-eport-api/src/main/resources/cert/test-public-key.txt";byte[] dataEn = PGPUtils.signAndEncrypt(data.getBytes(),privateKey,keypass,publicKey);String dateByEn = new String(dataEn);System.out.println(dateByEn);byte[] dataDe = PGPUtils.decryptVerify(dataEn, privateKey,keypass,publicKey);String dateByDe = new String(dataDe);System.out.println(dateByDe);System.out.println("--------------------------------------分割线--------------------------------------");dataEn = PGPUtils.encrypt(data.getBytes(), publicKey);dateByEn = new String(dataEn);System.out.println(dateByEn);dataDe = PGPUtils.decrypt(dataEn, privateKey, keypass);dateByDe = new String(dataDe);System.out.println(dateByDe);}
}

测试:

public class PGPTest {@Testpublic void testPGP() throws MessageException, IOException, UnrecoverableKeyException, NotEncryptedToParameterException{String orgData = "Ron:广州天孚世佳信息科技有限公司";byte[] data = PGPUtils.encrypt(orgData.getBytes(), "公钥文件地址");String jsonData = new String(Base64.encodeBase64(data)); //解密byte[] baseBytes = Base64.decodeBase64(jsonData.getBytes());//解密byte[] jsonByte = PGPUtils.decrypt(baseBytes,"私钥文件地址","私钥密钥");String plainData = new String(jsonByte);System.out.println(plainData);}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/71325.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

密钥类型详解大全

0x01 生成随机密钥 随机密钥可以大大增加密钥的安全性&#xff0c;生成随机密钥这里要用到随机数生成器&#xff08;RNG&#xff09;&#xff0c;是一个用于生成随机数的程序或硬件 随机数在密码学的很多算法中都是必不可少的&#xff0c;如果某些算法的密钥不能采用随机生成的…

hutool国密sm2算法使用, 正确的秘钥生成签名及验签,签名为64字节

hutool工具类&#xff1a; 在糊涂提供的国密算法&#xff0c;需要通过椭圆曲线生成秘钥&#xff0c;且当前业内私钥长度为固定32字节&#xff0c;公用固定长度为64字节。在参考hutool官方文档中的国密算法的例子&#xff0c;发现生成的秘钥非常长&#xff0c;远大于32字节和64…

通信加密和解密,公钥,私钥,CA

监听模式&#xff1a;打开&#xff49;&#xff50;和端口&#xff1d;套接字 等待别人来连接 为众所周知的服务&#xff0d;&#xff0d;固定的端口&#xff1c;&#xff11;&#xff10;&#xff12;&#xff14; 客户端程序都是打开一个大于&#xff14;&#xff10;&#…

如何用Rdkit计算MACCS密钥以及每个指纹位点代表什么

1.MACCS密钥是什么 MACCS&#xff08;分子访问系统&#xff09;键是最常用的结构键之一&#xff0c;有时也被称为 MDL 密钥&#xff0c;MDL来源于开发它的公司的名称&#xff08;MDL 信息系统&#xff0c;现为 BIOVIA&#xff09;。 虽然有两组 MACCS 密钥&#xff08;一组包含…

5分钟让你知道什么是PKI 密钥

译者博客 原文出处 前言 Public Key Infrastructure&#xff08;PKI)&#xff0c;中文叫做公开密钥基础设施&#xff0c;也就是利用公开密钥机制建立起来的基础设施。但是如果这么解释起来&#xff0c;到底是个什么东西&#xff0c;大家想必是没办法理解的。 现在大家的很多重要…

公钥、密钥和数字证书

转自 我理解的数字证书-1-公钥&#xff0c;私钥和数字证书 英文原文地址&#xff1a; http://www.youdzone.com/signature.html 若下文有任何错误&#xff0c;请告知我&#xff0c;谢谢。79996286qq.com 主角介绍&#xff1a;Bob and Alice 提起RSA加密算法&#xff0c;公…

一文看懂公钥、私钥、数字签名、数字证书

好文章&#xff0c;记录下来&#xff01;源文地址&#xff1a;What is a Digital Signature? (youdzone.com) 1. 鲍勃有两把钥匙&#xff0c;一把是公钥&#xff0c;另一把是私钥。 2. 鲍勃把公钥送给他的朋友们----帕蒂、道格、苏珊----每人一把。 3. 苏珊要给鲍勃写一封保密…

密钥对,密钥,公钥,私钥的 区分!!!

密钥对&#xff0c;密钥&#xff0c;公钥&#xff0c;私钥的区分&#xff1a; 一、概念 1、密钥对&#xff1a;在非对称加密技术中&#xff0c;有两种密钥&#xff0c;分为公钥和私钥。 公钥是密钥对所有者持有&#xff0c;公布给他人的&#xff1b;私钥也是密钥对所有者持有…

数字签名是什么?公钥和私钥是什么

数字签名是什么&#xff1f;公钥和私钥是什么 数字签名 这里参考阮一峰的数字签名解释&#xff0c;详细 请看: 数字签名是什么&#xff1f; - 阮一峰的网络日志 1.鲍勃有两把钥匙&#xff0c;一把是公钥&#xff0c;另一把是私钥。 2.鲍勃把公钥送给他的朋友们----帕蒂、道格…

公钥,私钥和数字签名这样最好理解

一、公钥加密 假设一下&#xff0c;我找了两个数字&#xff0c;一个是1&#xff0c;一个是2。我喜欢2这个数字&#xff0c;就保留起来&#xff0c;不告诉你们(私钥&#xff09;&#xff0c;然后我告诉大家&#xff0c;1是我的公钥。 我有一个文件&#xff0c;不能让别人看&…

告别晦涩难懂的物理,《张朝阳的物理课》了解一下

马斯克的飞船和我国神舟十二号的速度和运行状态是怎样的&#xff1f;如何用能量守恒定律解释台球撞击问题&#xff1f;朝霞晚霞的颜色又是怎么回事&#xff1f;细究这些日常&#xff0c;大多数人心里充满大大的问号。可能在高中学过这些知识&#xff0c;但现在都还给了老师&…

张朝阳:走出焦虑,不再焦虑

在前不久的乌镇互联网大会上&#xff0c;张朝阳和丁磊坐在步步莲花咖啡馆外有一个长聊&#xff0c;其间&#xff0c;马云、周鸿祎和张平安也有加入&#xff0c;他们聊了大学的时光、金庸的江湖、永生的2029&#xff0c;也有互联网行业。跟正襟危坐的沙龙不同&#xff0c;大佬们…

张朝阳的物理课:他现在真的很快乐

我是卢松松&#xff0c;点点上面的头像&#xff0c;欢迎关注我哦&#xff01; 没想到我这辈子还能听到麻省理工大学毕业的博士的课。张朝阳这快60岁了&#xff0c;还能把物理课程记得这么清楚&#xff0c;不愧是麻省理工的博士。 最近看到搜狐的张朝阳在讲顶尖的物理课&#…

Android Studio源码学习记录_01

一、HashMap<String, String> /* * HashMap:是基于哈希表的Map接口实现。 * 哈希表的作用是用来保证键的唯一性的。 * * HashMap<String,String> * 键&#xff1a;String * 值&#xff1a;String */ package cn.itcast_02;import java.util.HashMap; impor…

张朝阳不再狂妄,搜狐的艰难复苏路

来源&#xff5c;连线Insight 作者&#xff5c;王古锋 编辑&#xff5c;子夜 “我曾经什么都拥有&#xff0c;当时站在世界的中心&#xff0c;有名有钱很狂妄。现在已经没有在舞台中心的感觉了。现在我要做一个好的管理者&#xff0c;把一个企业做扎实。”近期&#xff0c;搜狐…

谁是下一个向海龙?

https://www.toutiao.com/a6693147614591844876/ 2019-05-21 00:31:07 5月17日&#xff0c;百度发布了2019Q1财报&#xff0c;百度自2005年上市以来出现首个季度亏损&#xff0c;这也让百度重臣向海龙的离职和百度前COO陆奇的离开一样&#xff0c;具有欲说还休的悲壮色彩。 19…

世界互联网大会前夜:丁磊马云雷军周鸿祎张朝阳等亮相,将会探讨什么?

关注网易智能&#xff0c;聚焦AI大事件&#xff0c;读懂下一个大时代&#xff01; 11月6日晚间&#xff0c;小桥流水&#xff0c;华灯初上&#xff0c;丁磊、马云、雷军、程维、张一鸣、张朝阳、周鸿祎等大佬纷纷亮相乌镇。在众多媒体的关注下&#xff0c;各位大佬悉数到场&…

张朝阳留不住的人

文|熔财经 作者|Alex Chiang &#xff08;封面图&#xff09; 张朝阳&#xff0c;再一次站上了风口浪尖。 “我每天只睡四个小时&#xff0c;并且已经坚持三年多了”&#xff0c;张朝阳在接受一次采访时如是说道&#xff0c;这番与时代多少有些格格不入的话语&#xff0c;在…

颠覆者-读周鸿祎新书

周鸿祎一直是我喜欢的偶像&#xff0c;他身上所体现出来的程序员改变世界、产品经理的执着与见解&#xff0c;还有对互联网的热爱和折腾一直给予我力量。之前读过一本老周的书《我的互联网方法论》&#xff0c;里面讲述了他对互联网的一些核心思想&#xff0c;还有常见的一些方…

破圈的《张朝阳的物理课》,开启“知识突围”的搜狐视频

在互联网耕耘二十多年的搜狐&#xff0c;正在焕发出新的活力。 从搜狐最近公布的2022年第三季度财报来看&#xff0c;营收1.85亿美元&#xff0c;其中在线游戏业务实现收入1.49亿美元&#xff0c;广告收入环比增长3%达到2600万美元。同时&#xff0c;净亏损好于此前预期。 对…