| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
* add support for aes256-gcm@openssh.com decryption for SSH keys
* review feedback
* skip when bcrypt isn't present
|
| |
|
|
|
| |
This is extra mega cursed, and strictly speaking unsound. It does, however, match the status quo ante, where someone mutating a buffer while its being used in cffi code will basically always be UB.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Rename Union type aliases to CamelCase
Many `typing.Union` type aliases were previously using `UPPER_SNAKE_CASE`, but Python's convention is `CamelCase` for these (e.g. https://docs.python.org/3/library/typing.html#type-aliases)
* Add utils.deprecated for the old non-underscore type aliases
* Added documentation for new type aliases & minor tweaks
* Use 'versionadded:: 40.0.0'
* Fix CertificatePublicKeyTypes vs CertificateIssuerPublicKeyTypes. Rename CertificatePrivateKeyTypes to CertificateIssuerPrivateKeyTypes
* Fix imports (ruff)
* Fix one more versionadded
* Tweak docs & Reorder: CertificateIssuerPublicKeyTypes before CertificateIssuerPrivateKeyTypes
* Fix test mypy errors using cast()
* Fix black, oops
* Revert "Fix black, oops"
This reverts commit 85344e231d697bdc0940e105f7aed729445f9743.
* Revert "Fix test mypy errors using cast()"
This reverts commit b272d8ca95fbbbc62060663f9e8930a139a7a43e.
* Revert type of SubjectKeyIdentifier.from_public_key arg
* Changelog tweak
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Enforce max number of SSH certificate principals
There is an undocumented limit for the maximum number of valid principals accepted by the openssh tooling, as seen at:
* https://github.com/openssh/openssh-portable/blob/27267642699342412964aa785b98afd69d952c88/sshkey.h#L108
* https://github.com/openssh/openssh-portable/blob/25c8a2bbcc10c493d27faea57c42a6bf13fa51f2/sshkey.c#L1801
* https://github.com/openssh/openssh-portable/blob/6180b0fa4f7996687678702806257e661fd5931e/ssh-keygen.c#L1833
This change enforces that same restriction as currently a SSH certificate can be generated that is invalid against the default sshd server. Consideration might be given for any non openssh servers that accept openssh certificates, if they exist and want to allow a greater number of principals.
Of note, the 256 limit is not found in the spec for SSH certificates as defined at https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.certkeys. It instead seems to be arbitrarily chosen by the project as some limit was needed.
* Address formatting error.
* Comment on valid_prinicpals size limit plus test added.
---------
Co-authored-by: Jake <jake@vaultish.com>
|
|
|
| |
we already didn't support signing (released in 39.0)
|
|
|
|
|
| |
* deprecate the rest of DSA support for SSH
* review comments
|
|
|
|
|
| |
* deprecate support for DSA in load_ssh_public_key
* try to prevent bad things a bit more
|
|
|
|
|
|
|
| |
* switch to using integers for valid_after/valid_before in SSH certs
* i know this, it's a unix timestamp
* one more review nit
|
|
|
|
|
|
|
|
|
|
|
| |
* SSHCertificateBuilder
This adds support for generating SSH certificates
* add deterministic signing tests and valid_for_all_principals
* test another edge
* one of these two fixes makes no sense
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* support SSH certificate parsing
DSA (deliberately) not supported
* make a unified API
* Update src/cryptography/hazmat/primitives/serialization/ssh.py
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
|
|
|
| |
this prevents duplicating this logic more times for ssh certs
|
| |
|
|
|
| |
It's more than 60x faster.
|
| |
|
|
|
|
|
| |
* Rewrite PKCS7 signature generation in Rust
* Update src/rust/src/pkcs7.rs
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* add unsafe_skip_rsa_key_validation
This allows users to skip RSA key validation when calling
load_pem_private_key, load_der_private_key, and
RSAPrivateNumbers.private_key. This is a significant performance
improvement but is **only safe if you know the key is valid**. If you
use this when the key is invalid OpenSSL makes no guarantees about what
might happen. Infinite loops, crashes, and all manner of terrible things
become possible if that occurs. Beware, beware, beware.
* Apply suggestions from code review
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
* remove unneeded variable
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* support setting more PKCS12 serialization encryption options
This is limited support, but makes it possible to set two different PBES
choices as well as set KDF rounds and MAC algorithm
* Apply suggestions from code review
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
* review feedback redux
* Update docs/hazmat/primitives/asymmetric/serialization.rst
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
|
| |
|
| |
|
|
|
|
| |
'serialize_ssh_private_key' (#7439)
|
|
|
|
|
| |
* serialize certs to pkcs7
* missed assert
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* PKCS12 serialization wrapper supports PKCS12Certificate cas
* Added code from Felix's gist to serialize_key_and_certificate_to_pkcs12. Doesn't break current behaviour/tests, need to write validate new behaviour, write tests, and format code.
* Simplified instance check
* Tried to write tests, but I cannot figure out how to read the friendlyName from parsed_more_certs.
* Fixed test function and renamed it.
* Fixed formatting.
* Commiting before trying black
* Formatted updates to make flake8 and black happy.
* Fixed first review comments.
* remove forgotten print statement
* use backend.openssl_assert instead of if ...
* Documented changes.
* Updated documentation.
|
| |
|
|
|
|
|
| |
* dont block pk12 serialization of ed pairs
* mimic test_ec curve skipping to satisfy alpine ci
|
|
|
| |
At some point it gained a default that was the same as what we were implementing.
|
|
|
| |
As someone who first with Python in 2.4 or so, this habit is going to be hard to break.
|
| |
|
| |
|
|
|
| |
If nothing else these are mypy friendly
|
|
|
|
|
| |
* More typing of the ssh module internals
* old python
|
| |
|
|
|
|
| |
this appears to be best practice and also makes the mypy type-coverage
analysis happier
|
|
|
|
| |
remove some unneeded type ignores. This work found a missing type and
added it as well.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Propose a new load_key_and_certificates_with_name API to return the PKCS12 'friendly name' as well.
* Extend load_key_and_certificates_with_name to return friendly names for all certificates; add serialize_key_and_certificates_with_names; add X509_alias_set1 to cffi; add basic tests for all these.
* Add changelog entry and documentation.
* Revert "Extend load_key_and_certificates_with_name to return friendly names for all certificates; add serialize_key_and_certificates_with_names; add X509_alias_set1 to cffi; add basic tests for all these."
This reverts commit 125935e8cf1d27028c5b593bb058e2716311fd72.
* Create new interface.
* Rename load_key_and_certificates_object -> load_pkcs12.
* Add constructor validation, improve repr tests.
* Mention '... or None'.
* Allow all private key types.
* Fix/improve tests.
* Ignore type errors when intentionally passing wrong types.
* Fix type; linting.
* Use correct ignore.
|
|
|
|
|
|
|
|
|
| |
Python 3.10 changed enum's object and string representation. PyCA
cryptography now uses a custom subclass of enum.Enum() will well-defined
__repr__ and __str__ from Python 3.9.
Related: https://bugs.python.org/issue40066
Fixes: https://github.com/pyca/cryptography/issues/5995
Signed-off-by: Christian Heimes <cheimes@redhat.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* backend typing for twofactor package and more otp work
* even more typing
* style fixes
* no generic typing for _get_backend
* remove unneeded typing
|
|
|
|
| |
fixes #5794
closes #5795
|
| |
|
| |
|
| |
|
|
|
| |
test changes themselves will be in a separate PR
|