protected AbstractResource determineJsonWebKeystoreResource() throws Exception {
        val file = SpringExpressionLanguageValueResolver.getInstance()
            .resolve(oidcProperties.getJwks().getFileSystem().getJwksFile());
        try {
            val jsonKeys = new JsonWebKeySet(file).toJson(JsonWebKey.OutputControlLevel.INCLUDE_PRIVATE);
            return new ByteArrayResource(jsonKeys.getBytes(StandardCharsets.UTF_8), "OpenID Connect Keystore");
        } catch (final Exception e) {
            LOGGER.debug("Given resource [{}] cannot be parsed as a raw JSON web keystore", file);
            LOGGER.trace(e.getMessage(), e);
            val resource = ResourceUtils.getRawResourceFrom(file);
            if (ResourceUtils.doesResourceExist(file)) {
                try (val is = resource.getInputStream()) {
                    val jwks = IOUtils.toString(is, StandardCharsets.UTF_8);
                    if (CasConfigurationJasyptCipherExecutor.isValueEncrypted(jwks)) {
                        val cipher = new CasConfigurationJasyptCipherExecutor(applicationContext.getEnvironment());
                        return new ByteArrayResource(cipher.decryptValue(jwks).getBytes(StandardCharsets.UTF_8));
                    }
                }
            }
            return resource;
        }
    }
This is {@link OidcDefaultJsonWebKeystoreGeneratorService}.

@author Misagh Moayyed
@since 5.1.0
support/cas-server-support-oidc-core-api/src/main/java/org/apereo/cas/oidc/jwks/generator/OidcDefaultJsonWebKeystoreGeneratorService.java