IdentityPython / pysaml2

Python implementation of SAML2
Apache License 2.0
555 stars 422 forks source link

feat: configurable encryption algorithm types #924

Open xpavlic opened 1 year ago

xpavlic commented 1 year ago

Description

The feature or problem addressed by this PR

Encrypt assertion session key and transport key algorithms were hardcoded.

closes: #821

What your changes do and why you chose this solution

Added encrypt_assertion_session_key_algs and encrypt_assertion_cert_key_algs configuration options to specify algorithms which can be used for encrypting assertions. Both of them are lists and index represents algorithm priority (first one has highest priority).

When there is not cert prvided in parameters program will try to find one in metadata. Keys in metadata are prioritized in following order.

If key has EncryptionMethods program will make intersect with configuration options and will take algorithms by its priority. If intersect is empty or there is not EncryptionMethod program will use first ones from config options.

Added paramters and their propagation to Server.create_authn_response specifying session key and transport key algorithms for encrypt_cert_advice and encrypt_cert_assertion. If they are not provided program will use first ones from new config options.

For support http://www.w3.org/2009/xmlenc11#rsa-oaep transport key alg with MGF1 xmlsec version>=1.3.0 is required.

Checklist

melanger commented 8 months ago

@c00kiemon5ter Hi, there already was a "next-release", would you consider merging this?