在node.js服务器和jQuery客户端之间建立安全连接

时间:2016-04-09 18:25:01

标签: jquery node.js ssl encryption

这是一个例子。以下是node.js https服务器的框架代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter_1
{
    public class Class1
    {
        public string output = String.Empty;
        static Class1 var = new Class1();

        public void guideLine()
        {
            one();
        }

        private void one()
        {
            var.output = "Once upon a time, in the realm of Sehrli..." +
                Environment.NewLine + "...there was a... a... what, actually? From which race are you?" +
                Environment.NewLine + "1) Human" +
                Environment.NewLine + "2) Elf" +
                Environment.NewLine + "3) Dwarf" +
                Environment.NewLine + "4) Guardian" +
                Environment.NewLine + "5) Angel" +
                Environment.NewLine + "6) Qanadli" +
                Environment.NewLine + "(Type the number of the option you want to select, or type 'info' and a number to get more info (e.g. info 3))";
        }
    }
}

假设运行服务器的网站有SSL证书,我可以简单地使用jQuery get和getJSON函数发出请求,并将其传递给https网址吗?这是否足以加密请求,以便没有第三方可以拦截请求或响应?

1 个答案:

答案 0 :(得分:1)

我不知道/使用node.js但我知道jquery和javascript。对你的问题的简短回答是肯定的。

只要服务器配置为HTTPS,您的javascript代码的调用就会被浏览器加密。与响应标头/数据相同。

相关问题