| 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
|
| |
|
| |
|
| |
|
|
|
|
|
| |
* support equality checks on all public asymmetric key types
* review feedback
|
| |
|
| |
|
| |
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* WIP: Add raw export alias method for x25519 keys
* Ditto for x448, ed448, ed25519
* Document new private_bytes_raw public_bytes_raw methods
* docs: Populate versionadded to be 40
* docs: Fix PublicFormat -> PrivateFormat where applicable
* formatting
* Update tests for test_pub_priv_bytes_raw in x25519, x448, ed448 (TODO: ed25519)
* Add test_pub_priv_bytes_raw test for Ed25519
|
|
|
|
|
|
|
|
|
|
|
| |
* fixes #8316 -- correct docstring
* Update src/cryptography/hazmat/primitives/asymmetric/x448.py
Co-authored-by: Paul Kehrer <paul.l.kehrer@gmail.com>
---------
Co-authored-by: Paul Kehrer <paul.l.kehrer@gmail.com>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
algorithms (#8187)
* add support for bytes-like objects in data and associated_data in aead algorithms
* flake
* flake again
* rework AESSIV _check_params
* flake and 80char columns
* associated_data cannot be None in _check_params, set to [] in calling function
* Update src/cryptography/hazmat/primitives/ciphers/aead.py
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
* flake fix
---------
Co-authored-by: mat gas <none@none.com>
Co-authored-by: Alex Gaynor <alex.gaynor@gmail.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
|
| |
|
| |
|
|
|
|
| |
Deprecated since version 3.3, see
https://docs.python.org/3/library/abc.html#abc.abstractproperty
|
| |
|
|
|
| |
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>
|
| |
|
|
|
|
|
|
|
|
| |
* use fixed pool to improve perf of aead ChaCha20Poly1305
~35-45% speedup on benchmarks when reusing the same key for multiple
operations
* remove unneeded call
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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>
|
|
|
|
|
|
|
|
|
|
|
| |
These let developers be more explicit about the allowable key lengths
for an AES key and make auditing the codebase a bit easier.
But that's not really why we're adding them. In some upcoming
serialization features we need to be able to specify AES 128 vs AES 256
and the current class doesn't work for that since it computes key
length from the key you provide it when instantiating the class.
That's incompatible with serialization where the key is derived
later in the process. C'est la vie.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* KBKDF: add CounterLocation.MiddleFixed
* tests_kbkdf: add new tests
- Test CounterLocation.MiddleFixed and blocation=
* test_kbkdf_vectors: make use of MIDDLE_FIXED
* docs: document KBKDF CounterLocation.MiddleFixed
* s/blocation/break_location/g
* CHANGELOG: document KBKDF{HMAC,CMAC} CounterLocation.MiddleFixed #7489
* kbkdf: fixed is static across n iterations, only the counter changes
* kbkdf: check break_location is 0..len(fixed)
- Update tests to assert exception is raised when
break_location < 0 or > len(fixed)
- When asserting for "break_location is ignored when MiddleFixed",
use break_location=0 instead of =10,
to ensure we don't raise because of break_location > len(fixed)
- Assert that the right error messages are returned to the user.
* kbkdf: keyword-only break_location
* docs: document kw-only KBKDF{HMAC,CMAC}
|
| |
|
|
|
|
| |
'serialize_ssh_private_key' (#7439)
|