我正在使用一个不包括EncryptStorage或EncryptCommunication标志的公开密钥(参见RFC4880中的标志引用)。
我的问题是,使用这个密钥加密安全/合适吗?
$ curl https://members.exacttarget.com/Content/Subscribers/SubsLists/publickey.txt > salesforce_publickey.txt
$ pgpdump salesforce_publickey.txt | grep Flag
# Notice: The encrypt message and encrypt storage flags are not setGPG在加密这个密钥方面没有问题,我被迫使用PGPy (一个纯粹的python实现),这个实现显然更加谨慎,并且无法使用根和任何子密钥进行加密:
import pgpy
publickey = pgpy.PGPKey.from_blob(bytearray(open('salesforce_publickey.txt').read(), 'utf-8'))[0]
publickey.encrypt('secret message', user=publickey.userids[0].email)
>>> PGPError: Key 64C4D5362A88CF19 does not have the required usage flag EncryptStorage, EncryptCommunications由于根只能Certify,而子项上没有设置标志,所以AFAICT。
完整的pgpdump输出如下:
$ pgpdump salesforce_publickey.txt
Old: Public Key Packet(tag 6)(418 bytes)
Ver 4 - new
Public key creation time - Tue Jul 22 08:08:31 MST 2003
Pub alg - DSA Digital Signature Algorithm(pub 17)
DSA p(1024 bits) - ...
DSA q(160 bits) - ...
DSA g(1022 bits) - ...
DSA y(1023 bits) - ...
Old: User ID Packet(tag 13)(54 bytes)
User ID - ExactTarget, LLC. (We mail it.)
Old: Signature Packet(tag 2)(91 bytes)
Ver 4 - new
Sig type - Positive certification of a User ID and Public Key packet(0x13).
Pub alg - DSA Digital Signature Algorithm(pub 17)
Hash alg - SHA1(hash 2)
Hashed Sub: signature creation time(sub 2)(4 bytes)
Time - Tue Jul 22 08:08:31 MST 2003
Hashed Sub: preferred symmetric algorithms(sub 11)(5 bytes)
Sym alg - AES with 256-bit key(sym 9)
Sym alg - AES with 192-bit key(sym 8)
Sym alg - AES with 128-bit key(sym 7)
Sym alg - CAST5(sym 3)
Sym alg - Triple-DES(sym 2)
Hashed Sub: preferred hash algorithms(sub 21)(2 bytes)
Hash alg - SHA1(hash 2)
Hash alg - RIPEMD160(hash 3)
Hashed Sub: preferred compression algorithms(sub 22)(2 bytes)
Comp alg - ZLIB (comp 2)
Comp alg - ZIP (comp 1)
Hashed Sub: features(sub 30)(1 bytes)
Flag - Modification detection (packets 18 and 19)
Hashed Sub: key server preferences(sub 23)(1 bytes)
Flag - No-modify
Sub: issuer key ID(sub 16)(8 bytes)
Key ID - 0x64C4D5362A88CF19
Hash left 2 bytes - c6 d4
DSA r(159 bits) - ...
DSA s(159 bits) - ...
-> hash(DSA q bits)
Old: Public Subkey Packet(tag 14)(525 bytes)
Ver 4 - new
Public key creation time - Tue Jul 22 08:08:42 MST 2003
Pub alg - ElGamal Encrypt-Only(pub 16)
ElGamal p(2048 bits) - ...
ElGamal g(3 bits) - ...
ElGamal y(2047 bits) - ...
Old: Signature Packet(tag 2)(70 bytes)
Ver 4 - new
Sig type - Subkey Binding Signature(0x18).
Pub alg - DSA Digital Signature Algorithm(pub 17)
Hash alg - SHA1(hash 2)
Hashed Sub: signature creation time(sub 2)(4 bytes)
Time - Tue Jul 22 08:08:42 MST 2003
Sub: issuer key ID(sub 16)(8 bytes)
Key ID - 0x64C4D5362A88CF19
Hash left 2 bytes - e4 a9
DSA r(157 bits) - ...
DSA s(159 bits) - ...
-> hash(DSA q bits)发布于 2019-06-17 18:42:55
用DSA密钥加密--就像主密钥一样--是没有意义的。似乎有人忽略了在Elgamal加密子密钥上放置加密用法标志,这显然是要使用的。
https://crypto.stackexchange.com/questions/71398
复制相似问题