- added SECP256K1 curve to EllipticCurveOID because GnuPG supports it

- marked some regression tests as such
 - minor organization stuff
[skip ci]
This commit is contained in:
Michael Greene
2016-04-21 18:46:28 -07:00
parent dc83611b9a
commit 848c8afe28
5 changed files with 13 additions and 2 deletions

View File

@@ -61,6 +61,7 @@ class EllipticCurveOID(Enum):
Brainpool_P256 = ('1.3.36.3.3.2.8.1.1.7', )
Brainpool_P384 = ('1.3.36.3.3.2.8.1.1.11', )
Brainpool_P512 = ('1.3.36.3.3.2.8.1.1.13', )
SECP256K1 = ('1.3.132.0.10', ec.SECP256K1)
def __new__(cls, oid, curve=None):
# preprocessing stage for enum members:

View File

@@ -94,8 +94,9 @@ class FlagList(Signature):
return self._flags
@flags.register(list)
@flags.register(tuple)
def flags_list(self, val):
self._flags = val
self._flags = list(val)
@flags.register(int)
@flags.register(CompressionAlgorithm)

View File

@@ -28,6 +28,11 @@ _requires = [
'singledispatch',
]
_doc_requires = [
'sphinx',
'sphinx-better-theme'
]
if sys.version_info[:2] <= (3, 4):
# only depend on enum34 if Python is older than 3.4
_requires += ['enum34']

View File

@@ -70,11 +70,14 @@ class TestPGPObject(object):
'test_text_to_bytes': [ k for k, _ in sorted(text.items()) ],
'test_text_to_bytes_encodings': [ k for k, _ in sorted(encoded_text.items()) ],
}
@pytest.mark.regression(issue=154)
def test_text_to_bytes(self, text):
pgpo = FakePGPObject.new(text)
assert pgpo.__bytearray__() == bytearray(b'_fake_') + bytearray(text, 'utf-8')
@pytest.mark.regression(issue=154)
def test_text_to_bytes_encodings(self, encoded_text):
pgpo = FakePGPObject.new(encoded_text)
# this should fail

View File

@@ -100,6 +100,7 @@ class TestPGPMessage(object):
with write_clean('tests/testdata/csmsg.asc', 'w', str(msg)):
assert gpg_print('csmsg.asc') == "This is a sensitive message!"
@pytest.mark.regression(issue=154)
def test_new_non_unicode(self, write_clean, gpg_print):
# this message text comes from http://www.columbia.edu/~fdc/utf8/
text = u'色は匂へど 散りぬるを\n' \
@@ -111,6 +112,7 @@ class TestPGPMessage(object):
assert msg.type == 'literal'
assert msg.message == text.encode('jisx0213')
@pytest.mark.regression(issue=154)
def test_new_non_unicode_cleartext(self, write_clean, gpg_print):
# this message text comes from http://www.columbia.edu/~fdc/utf8/
text = u'色は匂へど 散りぬるを\n' \
@@ -517,7 +519,6 @@ class TestPGPKey(object):
assert emsg._sessionkeys[0].decrypt_sk(k._key)[0] == SymmetricKeyAlgorithm.Camellia128
assert k.decrypt(emsg).message == 'This message is about to be encrypted'
def test_sign_timestamp(self, sec):
with self.assert_warnings():
sig = sec.sign(None)