Ableitung von JWKs aus V-PKI-Zertifikat führt zu ungültigen Schlüsseln
Description of the bug:
Beim Entschlüssel von Einreichungen kommt folgende Fehlermeldung, die darauf hinweist, dass die Felder des privaten Schlüssels nicht den Anforderung entsprechen.
System.Security.Cryptography.CryptographicException: The specified RSA parameters are not valid. Exponent and Modulus are required. If D is present, it must have the same length as Modulus. If D is present, P, Q, DP, DQ, and InverseQ are required and must have half the length of Modulus, rounded up, otherwise they must be omitted.
Beim Kunden hat sich gezeigt, dass die Felder folgende Längen besitzen
- D: 683
- N: 683
- DP: 342
- DQ: 340 <---
- P: 342
- Q: 342
- QI: 342
In diesem Fall ist DQ um 2 Zeichen zu kurz. Die Schlüssel werden mit den FIT-Connect-Tools aus einem V-PKI erzeugt, daher lieggt die Vermutung nahe, dass hier der Fehler verursacht wird.
Current behavior:
Es kann vorkommen, dass ein aus einem V-PKI abgeleiteter JWK nicht den Vorgaben entspricht.
Expected behavior:
Das Skript pkcs12ToJwk.py aus dem FIT-Connect-Tools oder die entsprechenden Aufrufe eines SDKs sollten zuverlässig JWKs erzeugen.
Environments:
TEST, PROD: reproduzierbar
Additional Information:
- https://datatracker.ietf.org/doc/html/rfc7518#section-6.3
- https://github.com/dotnet/corefx/blob/aa72982dcb20c4e346e08d72dae5abbaf6bba4f9/src/Common/src/System/Security/Cryptography/RSACng.ImportExport.cs#L79
- https://bitbucket.org/connect2id/nimbus-jose-jwt/src/master/src/main/java/com/nimbusds/jose/jwk/
Dependency / relationship to other issues:
Responsible person / team:
Contact persons including contact details:
Screenshots / Logs / Requests:
Checklist:
-
Add Severity label -
Add team label -
Related/affected issues/stories/epics linked and explained in the bug issue -
Creation of an automated test -
Bugfix deployed on DEV -
Bugfix tested on DEV -
Bugfix deployed on TEST -
Bugfix tested on TEST (possibly also by the connection project itself) -
Successful fix reported to Team Operations (Teams channel) -
Bugfix deployed on STAGE -
Bugfix tested on STAGE if necessary -
Bugfix deployed on PROD -
Bugfix tested on PROD (possibly also by the connection project itself) -
Final communication by Team Operations if necessary -
Internal documentation was checked and updated if necessary -
External documentation has been checked and updated if necessary -
Updated changelog if necessary