Chilkat 和 Delphi 7 - 将 pdf 文件发布到智能卡身份验证站点

问题描述 投票:0回答:1

使用 Delphi 7 和 chilkat 库,我尝试使用智能卡对站点进行身份验证并发布 pdf 文件以获得上传索引。我迷失在 chilkat 所提供的一切中,而且我对这部分编程(使用智能卡、SSL/TLS、证书、REST 等)有点陌生。我该怎么做?

这是我的代码的一部分,我被困在帖子部分。

http := CkHttp_Create();

cert := CkCert_Create();
success := CkCert_LoadFromSmartcard(cert, '');
if (success = False) then
  begin
    Memo1.Lines.Add(CkCert__lastErrorText(cert));
    Memo1.Lines.Add('Certificate not loaded.');
    Exit;
  end;

if (CkCert_HasPrivateKey(cert) <> True) then
  begin
    Memo1.Lines.Add('A private key is needed for TLS client authentication.');
    Memo1.Lines.Add('This certificate has no private key.');
    Exit;
  end;

sock := CkSocket_Create();

success := CkSocket_SetSslClientCert(sock, cert);
if (success <> True) then
  begin
    Memo1.Lines.Add(CkSocket__lastErrorText(sock));
    Exit;
  end;

bTls := True;
port := 443;
maxWaitMs := 5000;
success := CkSocket_Connect(sock, mysite, port, bTls, maxWaitMs);
if (success <> True) then
  begin
    Memo1.Lines.Add('Connect Failure Error Code: ' + IntToStr(CkSocket_getConnectFailReason(sock)));
    Memo1.Lines.Add(CkSocket__lastErrorText(sock));
    Exit;
  end;

rest := CkRest_Create();

success := CkRest_UseConnection(rest, socket, bAutoReconnect);
if (success <> True) then
  begin
    Memo1.Lines.Add(CkRest__lastErrorText(rest));
    Exit;
  end;

这里我需要使用POST上传文件。

我尝试使用

httprequest
,但失败了,因为我需要使用智能卡进行身份验证。

delphi http-post delphi-7 smartcard chilkat
1个回答
0
投票

使用 Delphi 7、Chilkat 库以及集成智能卡身份验证、SSL/TLS、证书和 REST 可能是一项多方面的任务。以下是指导您完成此过程的高级大纲: 设置 Chilkat 库: 智能卡身份验证: SSL/TLS 和证书: REST API 集成: PDF 文件上传: 处理上传索引: 解析来自服务器的响应以提取上传索引或任何相关信息。 根据应用程序的需要实现逻辑使用此信息

© www.soinside.com 2019 - 2024. All rights reserved.