presto-proxy/src/main/java/io/prestosql/proxy/JsonWebTokenHandler.java/JsonWebTokenHandler/setupJwtSigner
class JsonWebTokenHandler:    private static Optional<Consumer<JwtBuilder>> setupJwtSigner(File file, String password)
    {
        if (file == null) {
            return Optional.empty();
        }

        try {
            PrivateKey key = PemReader.loadPrivateKey(file, Optional.ofNullable(password));
            if (!(key instanceof RSAPrivateKey)) {
                throw new IOException("Only RSA private keys are supported");
            }
            return Optional.of(jwt -> jwt.signWith(SignatureAlgorithm.RS256, key));
        }
        catch (IOException e) {
            throw new RuntimeException("Failed to load key file: " + file, e);
        }
        catch (GeneralSecurityException ignored) {
        }

        try {
            byte[] base64Key = readAllBytes(file.toPath());
            byte[] key = Base64.getMimeDecoder().decode(base64Key);
            return Optional.of(jwt -> jwt.signWith(SignatureAlgorithm.HS256, key));
        }
        catch (IOException | IllegalArgumentException e) {
            throw new RuntimeException("Failed to load key file: " + file, e);
        }
    }