求助 关于sslhttpserver通讯的问题。

freechy2008 2012-01-12 08:50:45
服务器端代码为:
Context.SslCertFile := FCertFile;
Context.SslPassPhrase := FPassPharse;
Context.SslPrivKeyFile := FPrivateKey;
Context.SslCAFile := FCAFile;
Context.SslCAPath := FCAPath;
Context.SslVerifyPeer := FVerifyPeer ;
if FbShowCertInfo then
begin
ShowInfo('CertFile : [' + FCertFile + ']', clTeal);
ShowInfo('TagPhrase : [' + FPassPharse + ']', clTeal);
ShowInfo('PrivKeyFile : [' + FPrivateKey + ']', clTeal);
ShowInfo('CAFile : [' + FCAFile + ']', clTeal);
ShowInfo('CAPath : [' + FCAPath + ']', clTeal);
end;

HTTPServer.DocDir := Trim(FDocDir);
HTTPServer.DefaultDoc := Trim(FIndex);
HTTPServer.Port := Trim(EHttpsPort.Text);
HTTPServer.ClientClass := TMyHttpConnection;
HTTPServer.SetAcceptableHostsList(FAcceptHosts);
try
HTTPServer.Start;
ShowInfo(Format(LListen.Caption, ['HTTPS', HTTPServer.Port]), clBlue);
except
ShowInfo(Format(LFail.Caption, ['HTTPS', HTTPServer.Port]), clRed);
end;

客户端代码为:
Context.SslCertFile := gszCertFile;
Context.SslPassPhrase := gszPassPharse;
Context.SslPrivKeyFile := gszPrivateKey;
Context.SslCAFile := gszCAFile;
Context.SslCAPath := gszCAPath;
Context.SslVerifyPeer := gbVerifyPeer ;
Context.SslVersionMethod := sslV23_CLIENT;

if Pos(gszAspxName, gszURL) > 0 then
HttpClient.URL := Trim(gszURL)
else begin
szTmpStr := Trim(gszURL);
if RightStr(szTmpStr, 1) <> '/' then
HttpClient.URL := Trim(gszURL) + '/' + gszAspxName
else
HttpClient.URL := Trim(gszURL) + gszAspxName;
end;

HttpClient.AcceptLanguage := 'en, cn';
HttpClient.Connection := 'Keep-Alive';
HttpClient.SendStream := TMemoryStream.Create;
HttpClient.SendStream.Write(szInfo[1], Length(szInfo));
HttpClient.SendStream.Seek(0, 0);
HttpClient.RcvdStream := TMemoryStream.Create;
HttpClient.PostAsync;

通讯不成功,想知道问题出在那里。 认证文件是用openssl 生成的 pem格式文件。这样的文件是否需要注册?如需要请问怎么注册呢?
分不多,请见谅。
...全文
93 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

1,593

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 网络通信/分布式开发
社区管理员
  • 网络通信/分布式开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧