This commit is contained in:
Michael Greene
2014-05-01 17:33:19 -07:00
parent 01bab25171
commit 0469ef515a
4 changed files with 6 additions and 7 deletions

View File

@@ -20,7 +20,6 @@ from .packet import PubKeyAlgo
from .util import bytes_to_int, int_to_bytes, modinv
class Managed(object):
def __init__(self, selection_required=False, pubonly=False, privonly=False):
self.required = selection_required
@@ -223,9 +222,10 @@ class PGPKeyring(object):
# set the signature header length stuff
##TODO: this probably shouldn't have to happen here
pktlen = len(sig.packets[0].__bytes__()) - len(sig.packets[0].header.__bytes__())
ltype = 0 if math.ceil(pktlen.bit_length() / 8.0) == 1 else \
1 if math.ceil(pktlen.bit_length() / 8.0) == 2 else \
2 if math.ceil(pktlen.bit_length() / 8.0) < 5 else 0
ltype = \
0 if math.ceil(pktlen.bit_length() / 8.0) == 1 else \
1 if math.ceil(pktlen.bit_length() / 8.0) == 2 else \
2 if math.ceil(pktlen.bit_length() / 8.0) < 5 else 3
sig.packets[0].header.length_type = ltype
sig.packets[0].header.length = pktlen
@@ -234,7 +234,6 @@ class PGPKeyring(object):
return sig
@managed(pubonly=True)
def verify(self, subject, signature):
##TODO: type-checking

View File

@@ -311,7 +311,6 @@ class PGPSignature(PGPBlock):
def __init__(self, sigf):
super(PGPSignature, self).__init__(sigf, Magic.Signature)
def hashdata(self, subject):
# from the Computing Signatures section of RFC 4880 (http://tools.ietf.org/html/rfc4880#section-5.2.4)
#

View File

@@ -5,6 +5,7 @@ utility functions for debutils.pgp
import binascii
import math
def bytes_to_int(b):
return int(binascii.hexlify(b), 16)

View File

@@ -50,4 +50,4 @@ setup(
"pgpy",
"pgpy.packet",
],
)
)