Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP - NOT READY] Support DSA and ECDSA signing keys #683

Conversation

johnnyshields
Copy link
Collaborator

@johnnyshields johnnyshields commented Jul 7, 2024

Fixes #661

Currently RubySaml supports only RSA keys. The SAML standard can also support ECDSA and DSA keys. This PR adds support for both:

  1. Validating IdP EC/DSA sigs AND
  2. Using SP EC/DSA signing keys.

It includes the following changes, which are all done in a backward compatible manner:

  • When generating SP metadata/requests, settings.security[:signature_method] now ignores the "rsa" component of its user-set value and automatically uses whatever type of SP signing public key you actually set (e.g. a DSA key) plus the "sha" component of the value.
    • (Previously, only RSA was supported, so this doesn't break anything.)
  • settings.security[:signature_method] supports shortcut values :sha1, :sha256, etc.
    • Shortcuts :rsa_sha256, :dsa_sha256 etc. also work, but as per above the "rsa"/"dsa" are ignored in favor of the SP public key type.
  • Similar to above settings.security[:digest_method] supports shortcut values sha1, sha256, etc.
  • New module XMLSecurity::Crypto is extracted from XMLSecurity::Document
  • Cleaned-up code, including related to canonicalization

Things this PR does NOT do:

  • I haven't yet looked at encryption. Probably, DSA/EC keys won't work with encryption (I'm unsure whether they actually should work, given that DSA is supposedly for signing-only.) To use the functionality in this PR, you must either:

TODO:

  • Ensure existing tests pass
  • Test SP EC keys on metadata
  • Test SP EC keys on messages
  • Test SP DSA keys on metadata
  • Test SP DSA keys on messages
  • Test IdP EC keys on metadata
  • Test IdP EC keys on messages
  • Test IdP DSA keys on metadata
  • Test IdP DSA keys on messages
  • Investigate encryption

@johnnyshields johnnyshields changed the title Support DSA and ECDSA signing keys Support DSA and ECDSA signing keys (WIP) Jul 7, 2024
@johnnyshields
Copy link
Collaborator Author

I'll rebase this on v2.0 branch once other PRs are merged.

@johnnyshields johnnyshields changed the title Support DSA and ECDSA signing keys (WIP) [WIP - NOT READY] Support DSA and ECDSA signing keys Jul 8, 2024
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.

Using ECDSA private key causes OpenSSL::PKey::RSAError
1 participant