English 中文(简体)
我如何获得德尔菲斯根证书当局的窗口?
原标题:How can I access windows root certificate authorities certificates with Delphi?

涉及Lazaross或Delphi的问题。 是否有办法在视窗获得可信赖的根基验证局证书。 我知道,Windows称作毫米c.exe ,有基于GUI的工具,但我需要使用目标Pascal syntax获得证明文件(如:crt或cer或.pem等)。 谁能帮助我?

最佳回答

作为替代物,有CAPICOM。 您可以简单地作为活跃的X型图书馆进口,但也有平原旧的WindowsCryptography/60/a。

举个例子: 每一年 地雷试验项目(我最近试过)。 页: 1 WinCrypt or JwaWinCrypt unit with the relevant AP translations which should be available on JEDI :

program lstore;

{$APPTYPE CONSOLE}

uses
  Windows,
  SysUtils,
  WinCrypt;

var
  StoreName: array[0..255] of Char;
  hStore: HCERTSTORE;
  CertContext: PCertContext;
  CertPropId: DWORD;
  Data: array[0..511] of Char;
  DataLen: DWORD;
  i: Integer;

procedure DisplayCertContext(Cert: PCertContext);
var
  CertName: array[0..255] of Char;
begin
  if CertGetNameString(CertContext, CERT_NAME_EMAIL_TYPE, 0, nil,
    CertName, 256) = 0 then
    RaiseLastWin32Error;
  Writeln( Subject CERT_NAME_EMAIL_TYPE:  , CertName);
  if CertGetNameString(CertContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, nil,
    CertName, 256) = 0 then
    RaiseLastWin32Error;
  Writeln( Subject CERT_NAME_SIMPLE_DISPLAY_TYPE:  , CertName);
  if CertGetNameString(CertContext, CERT_NAME_FRIENDLY_DISPLAY_TYPE, 0, nil,
    CertName, 256) = 0 then
    RaiseLastWin32Error;
  Writeln( Subject CERT_NAME_FRIENDLY_DISPLAY_TYPE:  , CertName);

  if CertGetNameString(CertContext, CERT_NAME_EMAIL_TYPE, CERT_NAME_ISSUER_FLAG, nil,
    CertName, 256) = 0 then
    RaiseLastWin32Error;
  Writeln( Issuer CERT_NAME_EMAIL_TYPE:  , CertName);
  if CertGetNameString(CertContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, CERT_NAME_ISSUER_FLAG, nil,
    CertName, 256) = 0 then
    RaiseLastWin32Error;
  Writeln( Issuer CERT_NAME_SIMPLE_DISPLAY_TYPE:  , CertName);
  if CertGetNameString(CertContext, CERT_NAME_FRIENDLY_DISPLAY_TYPE, CERT_NAME_ISSUER_FLAG, nil,
    CertName, 256) = 0 then
    RaiseLastWin32Error;
  Writeln( Issuer CERT_NAME_FRIENDLY_DISPLAY_TYPE:  , CertName);
end;

begin
  try
    Write( Enter name of store to be listed:  );
    Readln(StoreName);
    hStore := CertOpenSystemStore(0, StoreName);
    if hStore = nil then
      RaiseLastWin32Error;
    try
      CertContext := CertEnumCertificatesInStore(hStore, nil);
      while CertContext <> nil do
      begin
        DisplayCertContext(CertContext);
        CertPropId := CertEnumCertificateContextProperties(CertContext, 0);
        while CertPropId <> 0 do
        begin
          DataLen := 512;
  //        Writeln(Format( CertPropId: %d , [CertPropId]));
          case CertPropId of
          CERT_KEY_PROV_HANDLE_PROP_ID:
          begin
            CertGetCertificateContextProperty(CertContext, CertPropId,
              @Data[0], DataLen);
            Writeln(Format( KEY_PROV_HANDLE: $%.8x , [PDWORD(@Data[0])^]));
          end;
          CERT_KEY_PROV_INFO_PROP_ID:
          begin
            CertGetCertificateContextProperty(CertContext, CertPropId,
              @Data[0], DataLen);
            with PCryptKeyProvInfo(@Data[0])^ do
            begin
              Writeln(Format( pwszContainerName = %s , [pwszContainerName]));
              Writeln(Format( pwszProvName = %s , [pwszProvName]));
              Writeln(Format( dwFlags = %d , [dwFlags]));
              Writeln(Format( cProvParams = %d , [cProvParams]));
              //Writeln(Format( rgProvParam , [rgProvParam]));
              Writeln(Format( dwKeySpec = %d , [dwKeySpec]));
            end;
            Writeln(Format( KEY_PROV_INFO: %d , [@Data[0]]));
          end;
          CERT_FRIENDLY_NAME_PROP_ID:
          begin
            CertGetCertificateContextProperty(CertContext, CertPropId,
              @Data[0], DataLen);
            Writeln(Format( FRIENDLY_NAME: %s , [PChar(@Data[0])]));
          end;
          CERT_KEY_IDENTIFIER_PROP_ID:
          begin
            CertGetCertificateContextProperty(CertContext, CertPropId,
              @Data[0], DataLen);
            Write( KEY_IDENTIFIER:  );
            for i := 1 to DataLen do
              Write(Format( %.2x  , [PBYTE(@Data[i - 1])^]));
            Writeln;
          end;
          CERT_SHA1_HASH_PROP_ID:
          begin
            CertGetCertificateContextProperty(CertContext, CertPropId,
              @Data[0], DataLen);
            Write( SHA1_HASH:  );
            for i := 1 to DataLen do
              Write(Format( %.2x  , [PBYTE(@Data[i - 1])^]));
            Writeln;
          end;
          CERT_MD5_HASH_PROP_ID:
          begin
            CertGetCertificateContextProperty(CertContext, CertPropId,
              @Data[0], DataLen);
            Write( MD5_HASH:  );
            for i := 1 to DataLen do
              Write(Format( %.2x  , [PBYTE(@Data[i - 1])^]));
            Writeln;
          end;
          else
          end;
          CertPropId := CertEnumCertificateContextProperties(CertContext,
            CertPropId);
        end;
        CertContext := CertEnumCertificatesInStore(hStore, CertContext);
      end;
//      if GetLastError <> CRYPT_E_NOT_FOUND then
//        RaiseLastWin32Error;
    finally
      CertCloseStore(hStore, 0);
    end;
  except
    on E: Exception do
    begin
      ExitCode := 1;
      Writeln(Format( [%s] %s , [E.ClassName, E.Message]));
    end;
  end;
end.
问题回答

http://www.eldos.com/sbb/“rel=“nofollow” Eldos SafetyBlackBox,但有自由的选择。

你们也可以使用开放式特别图书馆。 你们需要一个完整的开放式特别港口,因为开放式特别船的船长不完整。 您还需要汇编一份证书当局公开证书的数据库,因为其中不包括。

有了开放式特别服务公司,你就能够直接进入Windows证书仓库。 您可以从Windows或Land进口证书。

Eldos SafetyBlack 方框提供使用Windows证书储存的途径,包括核实签署方案代码的方法。

您可以包括配有你的视窗产品的开放式特别服务网望远镜,而开放式特别服务网已经安装,并可在Maceau上查阅。 因此,开放式特别安全局对消防队或拉萨卢斯来说是可行的。

开放式特别安全局文件记录得很好,你可以在线找到许多例子,虽然大多在C或C++。 我有幸执行了我所需要的一切。 它有许多职能可以读写给总统妇女事务办公室的档案。

SecureBlackBox does not yet have a FireMonkey version, but they say they will have one next year (per their forum). They do have an fpc (free pascal) version.





相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签