首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我应该使用仅用于Certify的公开密钥来加密PGP吗?

我应该使用仅用于Certify的公开密钥来加密PGP吗?
EN

Cryptography用户
提问于 2019-06-17 17:32:54
回答 1查看 906关注 0票数 2

我正在使用一个不包括EncryptStorage或EncryptCommunication标志的公开密钥(参见RFC4880中的标志引用)。

我的问题是,使用这个密钥加密安全/合适吗?

代码语言:javascript
复制
$ 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 set

GPG在加密这个密钥方面没有问题,我被迫使用PGPy (一个纯粹的python实现),这个实现显然更加谨慎,并且无法使用根和任何子密钥进行加密:

代码语言:javascript
复制
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输出如下:

代码语言:javascript
复制
$ 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)
EN

回答 1

Cryptography用户

回答已采纳

发布于 2019-06-17 18:42:55

用DSA密钥加密--就像主密钥一样--是没有意义的。似乎有人忽略了在Elgamal加密子密钥上放置加密用法标志,这显然是要使用的。

票数 1
EN
页面原文内容由Cryptography提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://crypto.stackexchange.com/questions/71398

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档