Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04, macos-10.15]
python-version: [3.6, 3.7, 3.8, 3.9, '3.10']
os: ["ubuntu-22.04", "macOS-14"]
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14"]

steps:
- uses: actions/checkout@v2
Expand All @@ -30,13 +30,13 @@ jobs:

# do some tests with LC_ALL=C to check for locale variance
c-locale-test:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.6
python-version: "3.10"
- name: Install requirements
run: |
sed -i -e 's/^/#/' tests/gnupghome/gpg-agent.conf
Expand All @@ -55,20 +55,20 @@ jobs:

# test setup.py using each tested version
test-setup:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- python-version: 3.6
env: py36-setup
- python-version: 3.7
env: py37-setup
- python-version: 3.8
env: py38-setup
- python-version: 3.9
env: py39-setup
- python-version: '3.10'
- python-version: "3.10"
env: py310-setup
- python-version: "3.11"
env: py311-setup
- python-version: "3.12"
env: py312-setup
- python-version: "3.13"
env: py313-setup
- python-version: "3.14"
env: py314-setup

steps:
- uses: actions/checkout@v2
Expand All @@ -83,13 +83,13 @@ jobs:

# add a pep8 test
pep8:
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04
continue-on-error: true # pep8 failures shouldn't be considered fatal
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.6
python-version: "3.10"
- name: Install tox
run: pip install tox
- name: Run tox
Expand All @@ -98,12 +98,12 @@ jobs:
# report coverage to coveralls, but only for pytest runs
finish-coveralls:
needs: [ unit-tests, c-locale-test ]
runs-on: ubuntu-18.04
runs-on: ubuntu-22.04

steps:
- uses: actions/setup-python@v2
with:
python-version: 3.6
python-version: "3.10"
- name: Finish Coveralls
run: |
pip install coveralls
Expand Down
13 changes: 13 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2

build:
os: ubuntu-24.04
tools:
python: "3.12"

sphinx:
configuration: docs/source/conf.py

python:
install:
- requirements: requirements-rtd.txt
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Requirements

- Python >= 3.6

Tested with: 3.10, 3.9, 3.8, 3.7, 3.6
Tested with: 3.14, 3.13, 3.12, 3.11, 3.10

- `Cryptography <https://pypi.python.org/pypi/cryptography>`_

Expand Down
2 changes: 1 addition & 1 deletion install_dependencies.osx.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash

brew unlink python@3.9 && brew link --overwrite python@3.9
brew unlink python@3.13 && brew link --overwrite python@3.13
brew bundle install
5 changes: 5 additions & 0 deletions pgpy/_curves.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,31 @@ class Ed25519(object):
class BrainpoolP256R1(ec.EllipticCurve):
name = 'brainpoolP256r1'
key_size = 256
group_order = 0xa9fb57dba1eea9bc3e660a909d838d718c397aa3b561a6f7901e0e82974856a7


class BrainpoolP384R1(ec.EllipticCurve): # noqa: E303
name = 'brainpoolP384r1'
key_size = 384
group_order = 0x8cb91e82a3386d280f5d6f7e50e641df152f7109ed5456b31f166e6cac0425a7cf3ab6af6b7fc3103b883202e9046565


class BrainpoolP512R1(ec.EllipticCurve): # noqa: E303
name = 'brainpoolP512r1'
key_size = 512
group_order = 0xaadd9db8dbe9c48b3fd4e6ae33c9fc07cb308db3b3c9d20ed6639cca70330870553e5c414ca92619418661197fac10471db1d381085ddaddb58796829ca90069


class X25519(ec.EllipticCurve): # noqa: E303
name = 'X25519'
key_size = 256
group_order = 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed


class Ed25519(ec.EllipticCurve): # noqa: E303
name = 'ed25519'
key_size = 256
group_order = 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed


# add these curves to the _CURVE_TYPES list
Expand Down
4 changes: 1 addition & 3 deletions pgpy/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
import bz2
import hashlib
import imghdr
import os
import zlib
import warnings
Expand Down Expand Up @@ -429,8 +428,7 @@ class ImageEncoding(IntEnum):

@classmethod
def encodingof(cls, imagebytes):
type = imghdr.what(None, h=imagebytes)
if type == 'jpeg':
if imagebytes[6:10] in (b'JFIF', b'Exif') or imagebytes[:4] == b'\xff\xd8\xff\xdb':
return ImageEncoding.JPEG
return ImageEncoding.Unknown # pragma: no cover

Expand Down
5 changes: 3 additions & 2 deletions requirements-rtd.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-r requirements.txt
Sphinx~=4.3.2
sphinx-better-theme
Sphinx==5.0.2
sphinx-better-theme==0.1.5
sphinxcontrib.applehelp==1.0.8
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ classifiers =
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.14
Programming Language :: Python :: 3.13
Programming Language :: Python :: 3.12
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.7
Expand Down
11 changes: 7 additions & 4 deletions tests/test_10_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ def targette_pub():

@pytest.fixture(scope='module')
def temp_subkey():
return PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 512)
return PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 1024)


@pytest.fixture(scope='module')
def temp_key():
u = PGPUID.new('User')
k = PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 512)
k = PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 1024)
k.add_uid(u, usage={KeyFlags.Certify, KeyFlags.Sign}, hashes=[HashAlgorithm.SHA1])

sk = PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 512)
sk = PGPKey.new(PubKeyAlgorithm.RSAEncryptOrSign, 1024)
k.add_subkey(sk, usage={KeyFlags.EncryptCommunications})

return k
Expand Down Expand Up @@ -300,7 +300,10 @@ def test_new_key_unimplemented_alg(self, key_alg_unim):

@pytest.mark.parametrize('key_alg_rsa_depr', key_algs_rsa_depr, ids=[alg.name for alg in key_algs_rsa_depr])
def test_new_key_deprecated_rsa_alg(self, key_alg_rsa_depr, recwarn):
k = PGPKey.new(key_alg_rsa_depr, 512)
try:
k = PGPKey.new(key_alg_rsa_depr, 512)
except ValueError:
return

w = recwarn.pop()
assert str(w.message) == '{:s} is deprecated - generating key using RSAEncryptOrSign'.format(key_alg_rsa_depr.name)
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py{36,37,38,39,310}{,-setup}, pypy3, pep8
envlist = py{310,311,312,313,314}{,-setup}, pypy3, pep8
skipsdist = True

[pytest]
Expand Down Expand Up @@ -38,7 +38,7 @@ install_command = pip install {opts} --no-cache-dir {packages}
commands =
py.test --cov pgpy --cov-report term-missing tests/

[testenv:py{36,37,38,39,310}-setup]
[testenv:py{310,311,312,313,314}-setup]
recreate = True
allowlist_externals =
/usr/bin/rm
Expand All @@ -49,7 +49,7 @@ commands =
rm -rf PGPy.egg-info

[testenv:pep8]
basepython = python3.6
basepython = python3.10
deps =
flake8
pep8-naming
Expand Down