首页 \ 问答 \ ACE SSL错误:对等方没有返回证书(ACE SSL Error: peer did not return a certificate)

ACE SSL错误:对等方没有返回证书(ACE SSL Error: peer did not return a certificate)

我正在为应用程序制作服务器和客户端,并使用带有OpenSSL的ACE库。 我试图让相互认证工作,◦服务器将只接受来自可信客户端的连接。

我生成了一个CA密钥和证书,并用它来签署一个服务器证书和一个客户证书(每个证书都有自己的密钥)。 我似乎正确地加载了可信存储,但在握手过程中,我一直收到错误“peer没有返回证书”。

服务器端代码:

ACE_SSL_Context *context = ACE_SSL_Context::instance();

context->set_mode(ACE_SSL_Context::SSLv23_server);
context->certificate("../ACE-server/server_cert.pem", SSL_FILETYPE_PEM);
context->private_key("../ACE-server/server_key.pem", SSL_FILETYPE_PEM);

if (context->load_trusted_ca("../ACE-server/trusted.pem", 0, false) == -1) {
    ACE_ERROR_RETURN((LM_ERROR, "%p\n", "load_trusted_ca"), -1);
}

if (context->have_trusted_ca() <= 0) {
    ACE_ERROR_RETURN((LM_ERROR, "%p\n", "have_trusted_ca"), -1);
}

客户端代码:

ACE_SSL_Context *context = ACE_SSL_Context::instance();
context->set_mode(ACE_SSL_Context::SSLv23_client);
context->certificate("../ACE-client/client_cert.pem", SSL_FILETYPE_PEM);
context->private_key("../ACE-client/client_key.pem", SSL_FILETYPE_PEM);

我按照以下说明生成证书: https//blog.codeship.com/how-to-set-up-mutual-tls-authentication/

并且在线检查时,我发现如果.crt和.key文件可读,它们应该已经是.pem格式,并且不需要转换它们。 所以我只是改变了扩展名并在这里使用它们。

任何帮助表示赞赏!


I am making both server and client for an application, using the ACE library with OpenSSL. I am trying to get mutual authentication to work, o the server will only accept connections from trusted clients.

I have generated a CA key and cert, and used it to sign a server cert and a client cert (each with their own keys also). I seem to be loading the trusted store correctly, but I keep getting the error "peer did not return a certificate" during handshake.

Server side code:

ACE_SSL_Context *context = ACE_SSL_Context::instance();

context->set_mode(ACE_SSL_Context::SSLv23_server);
context->certificate("../ACE-server/server_cert.pem", SSL_FILETYPE_PEM);
context->private_key("../ACE-server/server_key.pem", SSL_FILETYPE_PEM);

if (context->load_trusted_ca("../ACE-server/trusted.pem", 0, false) == -1) {
    ACE_ERROR_RETURN((LM_ERROR, "%p\n", "load_trusted_ca"), -1);
}

if (context->have_trusted_ca() <= 0) {
    ACE_ERROR_RETURN((LM_ERROR, "%p\n", "have_trusted_ca"), -1);
}

Client side code:

ACE_SSL_Context *context = ACE_SSL_Context::instance();
context->set_mode(ACE_SSL_Context::SSLv23_client);
context->certificate("../ACE-client/client_cert.pem", SSL_FILETYPE_PEM);
context->private_key("../ACE-client/client_key.pem", SSL_FILETYPE_PEM);

I generated the certificates following these instructions: https://blog.codeship.com/how-to-set-up-mutual-tls-authentication/

And checking online, I found that if the .crt and .key files are readable, they should already be in .pem format and there is no need to convert them. So I just changed the extension and used them here.

Any help is appreciated!


原文:https://stackoverflow.com/questions/46247485
更新时间:2022-09-04 21:09

最满意答案

您可以等待文档就绪事件。 如果你正在使用jquery,它可能就像

$(document).ready(function () {
    Module.foo();
});


var Module = (function () {
    //Definition for Module
})();

文档就绪功能将等待加载文档以调用您的功能。 所以它会在执行之前解析所有的javascript。


You could wait for the document ready event. If you're using jquery it could be something like

$(document).ready(function () {
    Module.foo();
});


var Module = (function () {
    //Definition for Module
})();

The document ready function will wait for the document to be loaded to call your function. So it will parse all the javascript before it executes.

相关问答

更多
  • 您可以等待文档就绪事件。 如果你正在使用jquery,它可能就像 $(document).ready(function () { Module.foo(); }); var Module = (function () { //Definition for Module })(); 文档就绪功能将等待加载文档以调用您的功能。 所以它会在执行之前解析所有的javascript。 You could wait for the document ready event. If you're u ...
  • 你需要使用getter和setter: return { getA: function(){ return _a }, setA: function(x){ _a = x }, //... } 实际上, .A字段不像其他OO语言那样是私有变量的继承者。 它只是一个哈希表字段,最初指向当前存储的_a 。 如果你之后改变了_a或.A ,那么就不会干扰另一个。 一个更简单的选择是将这些字段公开,而不是包含一些内部变量: function make_pager(){ return { ...
  • validthis有一个名为validthis的选项 ,其中: [...]在严格模式下禁止对代码运行严重违规的警告,并且您在非构造函数[...]中使用this ,当您确信您的使用在严格模式下有效时。 在JSHint抱怨的功能中使用它,在这种情况下,它将如下所示: function privFn() { /*jshint validthis: true */ return this.test; // -> No Strict violation! } function pubFn() { ...
  • “最好”的方式来声明一个模块 由于角度在全局范围本身,模块被保存到其变量中,您可以通过angular.module('mymod')访问模块: // one file // NOTE: the immediately invoked function expression // is used to exemplify different files and is not required (function(){ // declaring the module in one file / anon ...
  • 当bar调用foo()时,它调用的函数不是任何对象的成员,该函数中的“this”关键字指的是窗口对象。 这可行: function bar() { this.foo(); } 编辑 对于试图了解范围的人来说,您的代码很容易被误解。 请记住,当您调用mo.foo()和mo.bar()以及this.foo()(在bar函数内)时,您指的是您在原型上声明的属性,而不是函数的名称你已经在模块中声明了。 巧合的是,他们碰巧是同一个名字。 下面的代码会更好地说明它: var MyObject = (funct ...
  • 为什么我们在揭示模块模式中使用自执行功能? JavaScript具有一流的功能并且没有块范围界定,所以函数被用来引入新的范围。 在下面的场景中,在SocialMedia函数()中可以包装函数Init,也就是嵌入函数......我们可以将一个属性值赋给一个自动执行的代码块,这不奇怪吗? 在JavaScript中,函数只是响应()和new操作符的对象。 像其他对象一样,您可以在定义它时使用它,或者将它存储在变量或属性中供以后使用。 自执行函数似乎是JS中一个非常独特的构造 这不是JavaScript独有的。 具 ...
  • JS模块可以自动维护正确的文件加载顺序。 如果'编译脚本'只是Gulp concat,那么这就是一个挑战,需要明确指定文件顺序。 如果文件按字母顺序加载,则无效。 我建议坚持使用适当的工具(Webpack / Browserify)。 JS模块不能替代Angular模块,而是对它们进行补充。 如果应用程序非常模块化(每个文件/单元一个模块)并且angular.module('...')被禁止使用,那么即使对于连接构建,问题也不复存在。 这种方法非常有利于OOP设计和“每个文件一类”的约定。 JS modul ...
  • 您可以创建“类”视图并将事件绑定添加到其原型中。 之后,您可以在多个表上使用它。 如果要访问表中的元素,可以向它们添加类,并在defineDOM方法中找到它们: View.js var task = window.task || {}; task.View = function (table) { this.$table = $(table); this.init(); }; task.View.prototype ={ init: function () { th ...
  • 是的,模块是单身人士。 一辆汽车只有一个发动机。 创建第二个根本没有意义(除非你从根本上改变整个设计,增加任何struts可以承担的负载等)。 第二种模式是“类”模式,其中有许多行为相似的实例(想想一堆汽车)。 Yes, modules are singletons. A car has just one engine. Creating a second one simply doesn't make sense (unless you radically change the whole design, ...
  • 我的假设是只使用后一种方法,因为由于闭包能够使用私有变量..? 我对么? 是。 如果你需要私有变量。 第一种方法不使用闭包,因此位于全局内存范围内,不能拥有私有成员。 但请注意,即使在第二个示例中, s变量也是不必要的全局变量。 那么为什么CSS Tricks和其他人使用第一种方法作为例子,当它似乎没有任何真正的目的? 为简单起见。 当你没有局部变量时(因为你不需要它们,或者你把私有事物建模为属性),或者当作者不关心时。 或者没有费心写下隐含的IEFE 。 其次,我很好奇模块模式如何处理同一类型的多个对象? ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)