pgp.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:meg-server 作者: Argonne-National-Laboratory 项目源码 文件源码
def store_revocation_cert(db, armored_key, RevocationKey):
    # First be able to ensure we can add an extra newline on the fly.
    ascii_data = get_pgp_key_data(armored_key)
    packets = list(ascii_data.packets())

    if len(packets) == 0:
        raise BadRevocationKeyException("No packets found")

    signature = get_revocation_signature_packet(ascii_data)

    created = signature.creation_time
    expires = signature.expiration_time
    length = signature.length
    key_id = signature.key_id.decode()[-8:]  # We just need the last 8 chars

    try:
        # XXX Can two keys have the same id? I mean can there be collision with
        # the last 8 digits?
        RevocationKey.query.filter(RevocationKey.pgp_keyid_for == key_id).one()
    except NoResultFound:
        revocation_key = RevocationKey(created, expires, length, armored_key, key_id)
        db.session.add(revocation_key)
        db.session.commit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号