Commit Graph

1212 Commits

Author SHA1 Message Date
Michael Greene
3f55a53255 fix this test 2022-11-23 16:23:15 -08:00
Michael Greene
696e24b800 fix warning formatting and try to get everything using the same kind of string formatting 2022-11-23 16:18:04 -08:00
Michael Greene
ef0ed5145a fix almost all the rest of the tests 2022-11-23 16:10:26 -08:00
Michael Greene
18bc63d856 - explicitly define which security issues can cause signature verify to fail
- improve implementation of SignatureVerify.bad_signatures
- improve implementation of SignatureVerify.good_signatures
- fix implementation of SignatureVerify.__bool__
2022-11-23 16:05:33 -08:00
Michael Greene
25d2c12718 fix this weirdness 2022-11-23 15:44:04 -08:00
Michael Greene
c10439f74b this fixes EdDSA 2022-11-23 15:43:51 -08:00
Michael Greene
3aa0acbce5 oops 2022-11-23 15:35:08 -08:00
Michael Greene
0f574f5ba8 fix expires_at 2022-11-23 15:34:30 -08:00
Michael Greene
eead880d09 - move FlagEnum and FlagEnumMeta back into types.py where they belong
- fix capitalization and spelling of SecurityIssues flag members
- pythonize the names of SAFE_CURVES and MINIMUM_ASYMMETRIC_KE?Y_LENGTHS
- move the functionality of is_hash_considered_secure into a HashAlgorithm property called is_considered_secure where it always should have been
- move the functionality of check_assymetric_algo_and_its_parameters into a PubKeyAlgorithm function called validate_params like it always should have been
2022-11-23 15:33:36 -08:00
Michael Greene
830bdab323 better 2022-11-23 11:42:57 -08:00
Michael Greene
74d5ec834f fix fingerprint test 2022-11-23 11:26:49 -08:00
Michael Greene
40464c5eb9 reimplement Fingerprint __pretty__ better 2022-11-23 11:12:02 -08:00
Michael Greene
5c029ba215 fix all these tests 2022-11-23 11:04:15 -08:00
Michael Greene
0965434d9d fix PGPUID.selfsig 2022-11-23 11:04:05 -08:00
Michael Greene
7d228ab7ee fix fingerprint comparisons 2022-11-23 10:48:56 -08:00
Michael Greene
937f36bd62 fix typo 2022-11-23 10:47:09 -08:00
Michael Greene
b3f1477089 remove spurious file 2022-11-23 09:57:10 -08:00
Michael Greene
0b6ff6e6c6 Merge pull request #412 from prebuilder/six
Got rid of `six`.
2022-11-23 09:52:10 -08:00
KOLANICH
a23dccef97 Got rid of six. 2022-11-11 17:39:38 +03:00
Michael Greene
23aac818e3 Merge pull request #410 from prebuilder/gpg_ver_conftest 2022-11-10 16:03:39 -08:00
Michael Greene
002e1d571e Merge pull request #312 from prebuilder/checks 2022-11-10 16:02:29 -08:00
KOLANICH
d0cea0a4e1 Fixed gpg_ver initialization in conftest.py.
It should be a global variable in order to be imported
2022-11-10 17:28:48 +03:00
KOLANICH
b8c28c5a46 Added some security checks: * a check of self-signatures (doesn't work - no self-signatures are detected on primary key (_signatures is empty), BouncyCastle detects them fine) * a check of cryptoprimitives used 2022-11-10 17:23:27 +03:00
Michael Greene
b5cc2f353b Merge pull request #415 from dkg/tz-aware-datetime 2022-11-09 14:50:16 -08:00
Michael Greene
d8a7289112 Merge pull request #414 from dkg/ignore-unknown-sig-versions 2022-11-09 14:49:21 -08:00
Daniel Kahn Gillmor
65613853fd Warn when the user passes a TZ-naive datetime object
TZ-naive datetime objects are looking for trouble.  We would prefer to
do all comparisons and work using TZ-aware datetime objects.
2022-11-09 07:52:45 -05:00
Daniel Kahn Gillmor
c880d72902 Generate and use TZ-aware datetime objects
pgpy has been using TZ-naive datetime objects, despite all OpenPGP
wire-format dates being essentially UTC.

Better to represent the datetime objects explicitly as UTC.

Closes: #401
2022-11-09 07:52:28 -05:00
Daniel Kahn Gillmor
82614f8019 Ignore unrecognized signature versions
As new versions of OpenPGP signatures are defined, implementations may
provide multiple signatures, one of an older version for legacy
clients and one of a new version for clients that can read the new
signature form.

PGPy should skip over any signature whose version is not recognized.
2022-11-09 07:49:01 -05:00
Michael Greene
473d3651e2 Merge pull request #313 from prebuilder/genExprs
Refactoring the generator expressions for better readability and possibility to add debug output
2022-11-02 21:36:08 -07:00
Michael Greene
ae2159e504 Merge pull request #311 from prebuilder/fingerprint_class
Fingerprint class
2022-11-02 21:31:47 -07:00
Michael Greene
d958cfe6a3 Merge pull request #309 from prebuilder/subkey_binding_signature
Added a subkey binding signature subpacket.
2022-11-02 21:28:35 -07:00
Michael Greene
f1a41ede87 Merge pull request #388 from dkg/passwords-as-bytes
Accept passphrases as bytes
2022-11-02 21:25:39 -07:00
Michael Greene
10f7d765e3 Merge pull request #394 from ignaloidas/default-to-3DES
Default to 3DES when preferred algorithms don't have any supporting algorithm
2022-11-02 21:24:56 -07:00
Michael Greene
0ba2bc5b15 Merge pull request #403 from hofrob/fix-removed-cryptography-utils-register-interface
fix removed cryptography.utils.register_interface
2022-11-02 21:23:56 -07:00
Michael Greene
c3d3afcbef Merge pull request #396 from bitfehler/bitfehler/is_ascii_regex
Allow tabs in regex for ASCII validity check
2022-11-02 21:23:38 -07:00
Michael Greene
4f133bbd15 Merge pull request #404 from kianmeng/fix-typos
Fix typos
2022-11-02 21:21:19 -07:00
Michael Greene
cd8dd43ddd Merge pull request #406 from eli-schwartz/testsuite-nointegration-regression
fix testsuite regression that immediately crashed without integration tests
2022-11-02 21:20:50 -07:00
Michael Greene
e0a4dcbe46 Merge pull request #407 from thesuperzapper/pin-cryptography-38
pin cryptography < 38.0.0 (fix pip install)
2022-11-02 21:14:56 -07:00
Mathew Wicks
ab706919d5 pin cryptography < 38.0.0 2022-11-01 16:32:00 +11:00
Eli Schwartz
383a3c9e64 fix testsuite regression that immediately crashed without integration tests
In commit 08a76fdda9, distutils was
dropped. Before then, gpg_ver was a global mutable class instance,
mutated inside a function and then used. After then, it's a global
string that is... also modified inside a function and then used.

Strings cannot be modified inside functions like that. It shadows the
variable in the local scope, which means the global variable is
inaccessible now. In fact the global variable exists solely to be used
inside this function, but now it cannot be.

So, because it can be bound inside the function, it *must* be, but only
if python-gpg was installed did this actually occur. If not, we skipped
the integration tests and then tried to log the version, assuming that
the global default value of "unknown" was still bound, which is no
longer true.
2022-10-26 20:57:16 -04:00
Kian-Meng Ang
6e5b685be3 Fix typos
Found via `codespell -L nd,wth,te,useg,bu,fpr,fo,clen,varius,unce`
2022-10-10 17:13:41 +08:00
Robert Hofer
d84597eb84 fix removed cryptography.utils.register_interface 2022-09-11 17:21:55 +02:00
Conrad Hoffmann
d2bd9e83b0 Allow tabs in regex for ASCII validity check
They can occur e.g. in armor headers.

Fixes: #395
2022-05-30 20:39:02 +02:00
Ignas Kiela
e0eb8fb4a5 Default to 3DES when preferred algorithms don't have any supporting algorithm
As per RFC 4880 13.2, "Since TripleDES is the MUST-implement algorithm,
if it is not explicitly in the list, it is tacitly at the end."

Some keys in the wild do not have it explicitly in the list, so put it
there as a default.
2022-04-20 17:53:29 +03:00
James Morris
02766befcd Merge pull request #387 from dkg/drop-distutils
tests: drop distutils
2022-02-02 13:08:45 -05:00
James Morris
85e5364a45 Bump Sphinx version 2022-02-02 12:51:08 -05:00
Daniel Kahn Gillmor
412540ad72 Accept passphrases as bytes
The OpenPGP specifications are ambiguous about the encoding of
passwords.

In practice, we expect most passphrases to be UTF-8-encoded, but if
the incoming passphrase is in fact a bytestring, we ought to be able
to handle it correctly.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2022-02-01 23:05:54 -05:00
Daniel Kahn Gillmor
08a76fdda9 tests: drop distutils
distutils is going away in python 3.12.  LooseVersion() wasn't really
being used for anything particularly useful.  The strings that were
returned by the openssl backend for the cryptography module, or the
GPGME "engine" version were both just being replayed later as strings
anyway.

So, keep them in string form.  If future work needs to do things like
compare them, apparently packaging.version contains classes that might
be better-maintained going forward.

Signed-off-by: Daniel Kahn Gillmor <dkg@fifthhorseman.net>
2022-01-31 19:51:12 -05:00
James Morris
1594e41c09 Use HTML4 writer on Sphinx 2.0 and later 2021-12-24 13:10:48 -05:00
James Morris
852e830c37 Update deprecated autodoc_default_flags to autodoc_default_options 2021-12-21 16:56:36 -05:00