PEP 8
This commit is contained in:
@@ -20,7 +20,6 @@ from .packet import PubKeyAlgo
|
|||||||
from .util import bytes_to_int, int_to_bytes, modinv
|
from .util import bytes_to_int, int_to_bytes, modinv
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Managed(object):
|
class Managed(object):
|
||||||
def __init__(self, selection_required=False, pubonly=False, privonly=False):
|
def __init__(self, selection_required=False, pubonly=False, privonly=False):
|
||||||
self.required = selection_required
|
self.required = selection_required
|
||||||
@@ -223,9 +222,10 @@ class PGPKeyring(object):
|
|||||||
# set the signature header length stuff
|
# set the signature header length stuff
|
||||||
##TODO: this probably shouldn't have to happen here
|
##TODO: this probably shouldn't have to happen here
|
||||||
pktlen = len(sig.packets[0].__bytes__()) - len(sig.packets[0].header.__bytes__())
|
pktlen = len(sig.packets[0].__bytes__()) - len(sig.packets[0].header.__bytes__())
|
||||||
ltype = 0 if math.ceil(pktlen.bit_length() / 8.0) == 1 else \
|
ltype = \
|
||||||
1 if math.ceil(pktlen.bit_length() / 8.0) == 2 else \
|
0 if math.ceil(pktlen.bit_length() / 8.0) == 1 else \
|
||||||
2 if math.ceil(pktlen.bit_length() / 8.0) < 5 else 0
|
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_type = ltype
|
||||||
sig.packets[0].header.length = pktlen
|
sig.packets[0].header.length = pktlen
|
||||||
@@ -234,7 +234,6 @@ class PGPKeyring(object):
|
|||||||
|
|
||||||
return sig
|
return sig
|
||||||
|
|
||||||
|
|
||||||
@managed(pubonly=True)
|
@managed(pubonly=True)
|
||||||
def verify(self, subject, signature):
|
def verify(self, subject, signature):
|
||||||
##TODO: type-checking
|
##TODO: type-checking
|
||||||
|
|||||||
@@ -311,7 +311,6 @@ class PGPSignature(PGPBlock):
|
|||||||
def __init__(self, sigf):
|
def __init__(self, sigf):
|
||||||
super(PGPSignature, self).__init__(sigf, Magic.Signature)
|
super(PGPSignature, self).__init__(sigf, Magic.Signature)
|
||||||
|
|
||||||
|
|
||||||
def hashdata(self, subject):
|
def hashdata(self, subject):
|
||||||
# from the Computing Signatures section of RFC 4880 (http://tools.ietf.org/html/rfc4880#section-5.2.4)
|
# from the Computing Signatures section of RFC 4880 (http://tools.ietf.org/html/rfc4880#section-5.2.4)
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ utility functions for debutils.pgp
|
|||||||
import binascii
|
import binascii
|
||||||
import math
|
import math
|
||||||
|
|
||||||
|
|
||||||
def bytes_to_int(b):
|
def bytes_to_int(b):
|
||||||
return int(binascii.hexlify(b), 16)
|
return int(binascii.hexlify(b), 16)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user