Hi folks, this is all fairly new to me only will be as clear as can be and thanks in advance.
Am using uniface 10.4.03, and have set up a USP as an API endpoint, using Okta as the OAuth 2.0/OIDC authorization server making calls to them via Postman.
So far so good and have successfully ...
Received an OAuth access token as a Bearer token.
Split the JWT into header, payload and signature.
Base64URL decoded the header and payload.
Extracted kid, alg, iss, aud, exp and scp.
Obtained the Okta discovery document.
Obtained the jwks_uri.
Retrieved the JWKS.
Found the JWK matching the JWT's kid and validated its kty, alg, use, n and e values.
Successfully verified the signature in uniface using:
$decode("RSASSA_PKCS1V15_SHA256", vMessage, vPublicKey, vSignature)
However, for testing I converted the JWK into an X.509 SubjectPublicKeyInfo PEM file externally using Python's cryptography library, which I loaded with uniface using: fileload "oktaPublicKey.pem", vPublicKey
So I finally get to my question, is there a native Uniface way to construct an X.509 SubjectPublicKeyInfo RSA public key, in PEM format, directly from the JWK n and e values?
Equivalent to:
-----BEGIN PUBLIC KEY-----
…
-----END PUBLIC KEY-----
which can then be passed to $decode(“RSASSA_PKCS1V15_SHA256”)?
I need to do this dynamically because the authorization server can rotate its signing keys, so I'd rather not have to generate and deploy a new PEM file whenever the JWKS changes.
From what I gather this is where the veterans hang out so hoping for some luck!