diff --git a/model/signing_server.py b/model/signing_server.py index 1fe15e433b..587df1601c 100644 --- a/model/signing_server.py +++ b/model/signing_server.py @@ -15,6 +15,18 @@ class SigningAlgorithm(enum.StrEnum): RSASSA_PSS = 'rsassa-pss' RSASSA_PKCS1_V1_5 = 'rsassa-pkcs1-v1_5' + @staticmethod + def as_rfc_standard(algorithm: 'SigningAlgorithm') -> str: + # parses the algorithm to the standard format described in + # https://datatracker.ietf.org/doc/html/rfc3447 + algorithm = SigningAlgorithm(algorithm.lower()) + if algorithm is SigningAlgorithm.RSASSA_PSS: + return 'RSASSA-PSS' + elif algorithm is SigningAlgorithm.RSASSA_PKCS1_V1_5: + return 'RSASSA-PKCS1-v1_5' + else: + raise NotImplementedError(algorithm) + class SigningServerEndpoint(NamedModelElement): def url(self) -> str: