Nueva sugerencia para el componente:
Obtener fechas de caducidad de los certificados.
Para ello, bastaría con hacer una pequeña modificación en la función loadCertificados y en el tipo TCertificados.
Código Delphi
[-]
function loadCertificados(aList, aFechas:TStringList):integer;
var
hStore: HCERTSTORE;
PrevContext, CurContext: PCERT_CONTEXT;
cbSize: DWORD;
SysTime: TSystemTime;
sNombre: String;
begin
aList.Clear;
aFechas.Clear;
Result := 0;
hStore := CertOpenSystemStore(0, PChar('MY'));
if hStore <> nil then begin
PrevContext := nil;
CurContext := CertEnumCertificatesInStore(hStore, PrevContext);
while CurContext <> nil do begin
sNombre := '';
cbSize := CertGetNameString(CurContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, nil, nil, 0);
if cbSize > 0 then
begin
SetLength(sNombre, cbSize-1);
CertGetNameString(CurContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0, nil, PChar(sNombre), cbSize);
aList.Add(sNombre);
if FileTimeToSystemTime(CurContext^.pCertInfo^.NotAfter, SysTime) then
begin
AFechas.Add(datetimetostr(SystemTimeToDateTime(SysTime)));
end;
end;
PrevContext := CurContext;
CurContext := CertEnumCertificatesInStore(hStore, PrevContext);
end;
end;
result:=aList.count;
end;