我有一个使用OpenPGP(通过BouncyCastle)加密银行文件的过程,并将该文件SFTP到银行进行财务处理.
他们给我发了一个公钥文件,我用以下命令检查了密钥(结果如下):
C:\Program Files (x86)\GNU\GnuPG>gpg2 --dry-run -vvvv --import \test\thekey.txt gpg: using character set `CP437' gpg: armor: BEGIN PGP PUBLIC KEY BLOCK gpg: armor header: Version: GnuPG v1.2.6 (GNU/Linux) :public key packet: version 4,algo 17,created 1232463981,expires 0 pkey[0]: [1024 bits] pkey[1]: [160 bits] pkey[2]: [1024 bits] pkey[3]: [1021 bits] keyid: C0B18494F5B25CB6 :user ID packet: "FTP Upload Key 3 <XXXX.XXXX@XXXXXXX.com>" :signature packet: algo 17,keyid C0B18494F5B25CB6 version 4,md5len 0,sigclass 0x13 digest algo 2,begin of digest 23 e8 hashed subpkt 2 len 4 (sig created 2009-01-20) hashed subpkt 27 len 1 (key flags: 03) hashed subpkt 11 len 5 (pref-sym-algos: 9 8 7 3 2) hashed subpkt 21 len 2 (pref-hash-algos: 2 3) hashed subpkt 22 len 2 (pref-zip-algos: 2 1) hashed subpkt 30 len 1 (features: 01) hashed subpkt 23 len 1 (key server preferences: 80) subpkt 16 len 8 (issuer key ID C0B18494F5B25CB6) data: [159 bits] data: [156 bits] :public sub key packet: version 4,algo 16,expires 0 pkey[0]: [1024 bits] pkey[1]: [4 bits] pkey[2]: [1024 bits] keyid: 358DC68F4A83D261 :signature packet: algo 17,sigclass 0x18 digest algo 2,begin of digest 28 08 hashed subpkt 2 len 4 (sig created 2009-01-20) hashed subpkt 27 len 1 (key flags: 0C) subpkt 16 len 8 (issuer key ID C0B18494F5B25CB6) data: [158 bits] data: [160 bits] gpg: pub 1024D/F5B25CB6 2009-01-20 FTP Upload Key 3 <XXXX.XXXX@XXXXXXX.com> gpg: writing to `C:/Users/jholovacs/AppData/Roaming/gnupg/pubring.gpg' gpg: using PGP trust model gpg: key 9166F91E: accepted as trusted key gpg: key DBA95ED9: accepted as trusted key gpg: key DF548FCC: accepted as trusted key gpg: key F5B25CB6: public key "[User ID not found]" imported gpg: Total number processed: 1 gpg: imported: 1
我拿了一个示例文本文件,并使用他们的公钥对其进行加密,然后用这个命令检查了结果文件(结果如下):
C:\Program Files (x86)\GNU\GnuPG>gpg2 --list-packets <\test\bankfile.pgp :compressed packet: algo=1 :pubkey enc packet: version 3,keyid 358DC68F4A83D261 data: [1019 bits] data: [1024 bits] :encrypted data packet: length: 620 gpg: encrypted with ELG key,ID 4A83D261 gpg: decryption Failed: No secret key
事情是这样的:当我将文件上传到我们的银行时,他们说文件与他们的私钥不匹配.我看到358DC68F4A83D261的密钥id与他们的公钥相匹配,所以我摸不着头……但我也看到ID为4A83D261的ElGamal密钥似乎没有反映在他们的公钥文件中.
我正在使用基于BouncyCastle库的自定义加密解决方案,因此加密时可能出现错误(我不能使用我自己的Pgp4Win版本复制错误).它们也可能存在问题.我的问题是,我不确定如何阅读这些反馈以确定问题所在.一些建议将不胜感激.