Skip to content

X.509 signatures and verification#6727

Open
kaylendog wants to merge 13 commits into
mainfrom
kaylendog/x509/impl
Open

X.509 signatures and verification#6727
kaylendog wants to merge 13 commits into
mainfrom
kaylendog/x509/impl

Conversation

@kaylendog

@kaylendog kaylendog commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

This PR implements X.509 signatures and verification, and is a refactored/linear version of the changes in andyrich/x509.

This is a big PR, so I have compressed the original changes into several discrete commits, each of which should be independently reviewable:

  • The X509Signature struct, and the two core traits, X509Signer and X509Verifier.
  • A Rust-native implementations of the above two traits, threaded through the existing crypto store.
  • Signing and verifying the master signing key (MSK) using X.509.
  • FFI boilerplate, since some X.509 functionality needs to be implemented natively.
  • Integration tests

rsa vulnerability

The crate we use for constructing signature definitions, rsa, has a vulnerability in its padding algorithm (see RustCrypto/RSA#626). However, this only affects RSA private key operations, which we don't perform at all. Thus, we should be able to safely ignore the attached CI failures.

PR Checklist

  • I've documented the public API changes in the appropriate changelog files (see Writing changelog entries).
  • This PR was made with the help of AI.

Signed-off-by:

@kaylendog kaylendog self-assigned this Jul 6, 2026
@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.17371% with 94 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.95%. Comparing base (7bf142a) to head (99bc3da).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...s/matrix-sdk-crypto/src/x509/raw_x509_signature.rs 82.44% 15 Missing and 28 partials ⚠️
crates/matrix-sdk-crypto/src/x509/x509_verify.rs 94.47% 11 Missing and 1 partial ⚠️
...trix-sdk-crypto/src/x509/rust_raw_x509_verifier.rs 83.07% 8 Missing and 3 partials ⚠️
crates/matrix-sdk-crypto/src/x509/x509_signer.rs 83.67% 6 Missing and 2 partials ⚠️
...matrix-sdk-crypto/src/x509/rust_raw_x509_signer.rs 81.08% 3 Missing and 4 partials ⚠️
crates/matrix-sdk-crypto/src/olm/account.rs 72.72% 1 Missing and 2 partials ⚠️
crates/matrix-sdk-crypto/src/machine/mod.rs 95.00% 0 Missing and 2 partials ⚠️
crates/matrix-sdk-crypto/src/olm/signing/mod.rs 95.65% 0 Missing and 2 partials ⚠️
...-sdk-crypto/src/types/signatures/x509_signature.rs 92.59% 0 Missing and 2 partials ⚠️
crates/matrix-sdk-base/src/client.rs 95.00% 0 Missing and 1 partial ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6727      +/-   ##
==========================================
+ Coverage   89.92%   89.95%   +0.03%     
==========================================
  Files         398      405       +7     
  Lines      111157   112187    +1030     
  Branches   111157   112187    +1030     
==========================================
+ Hits        99954   100921     +967     
- Misses       7400     7427      +27     
- Partials     3803     3839      +36     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@codspeed-hq

codspeed-hq Bot commented Jul 6, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 50 untouched benchmarks


Comparing kaylendog/x509/impl (99bc3da) with main (7bf142a)

Open in CodSpeed

@kaylendog kaylendog force-pushed the kaylendog/x509/impl branch 3 times, most recently from 312322a to 6efd9e6 Compare July 7, 2026 12:10
kaylendog and others added 3 commits July 7, 2026 14:38
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
@kaylendog kaylendog force-pushed the kaylendog/x509/impl branch 2 times, most recently from af3a99e to 0acbdac Compare July 7, 2026 14:23
kaylendog and others added 9 commits July 7, 2026 15:32
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
@kaylendog kaylendog force-pushed the kaylendog/x509/impl branch from 0acbdac to 6521e26 Compare July 7, 2026 14:32
Co-Authored-By: Richard van der Hoff <richard@matrix.org>
Co-Authored-By: Andy Balaam <andy.balaam@matrix.org>
Co-Authored-By: Hubert Chathi <hubertc@matrix.org>
Signed-off-by: Skye Elliot <actuallyori@gmail.com>
@kaylendog kaylendog force-pushed the kaylendog/x509/impl branch from 6521e26 to 99bc3da Compare July 7, 2026 15:24
@kaylendog kaylendog marked this pull request as ready for review July 8, 2026 08:35
@kaylendog kaylendog requested review from a team as code owners July 8, 2026 08:35
@kaylendog kaylendog requested review from poljar and removed request for a team July 8, 2026 08:35
@kaylendog kaylendog changed the title [WIP] X.509 signatures and verification X.509 signatures and verification Jul 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant