作为替代物,有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.