ok, después de mover varias cosas en
OpenSSLUtils.pas, la clase
TX509Certificate me quedó así, primero re-privatizé
fCertificate, osea, la dejé como estaba :
Código Delphi
[-]
TX509Certificate = class
private
fCertificate: pX509;
function getDN(pDn: pX509_NAME): String;
function getTime(asn1_time: pASN1_TIME): TDateTime;
...
con
fCertificate re-privatizada, añadí a la clase:
Código Delphi
[-]
public
procedure assignCertificate(certificate : pX509);
que solamente asigna el apuntador:
Código Delphi
[-]
procedure TX509Certificate.assignCertificate(certificate: pX509);
begin
fCertificate := certificate;
end;
eso y los cambios de
Char a
AnsiChar fueron algunas de las cosas le hice a
OpenSSLUtils.pas, luego en mi programa, la función quedó:
Código Delphi
[-]
function GetCertInfo(const AFileName:String) : CertificadoX509;
var
bp: pBIO;
fn: PAnsiChar;
x: pX509;
x509: pX509;
Cert: TX509Certificate;
begin
InitOpenSSL;
Cert := TX509Certificate.Create;
try
fn := PAnsiChar(AnsiString(AFileName));
bp := BIO_new(BIO_s_file());
BIO_read_filename(bp, PChar(fn));
x := X509_new;
x509 := PEM_read_bio_X509(bp, x, nil, nil);
Cert.assignCertificate(@x);
Result.Issuer:=Cert.Issuer;
X509_free(x509);
finally
BIO_free(bp);
Cert.Free;
EVP_cleanup;
end;
end;
Aquí, como pueden ver, solo puedo acceder a
Cert.Issuer, si descomento cualquier otra, me marca
Access violation.
Creo que no estoy pudiendo asignar bien el apuntador al
fCertificate.
Por cierto, usando uno de los certificados de ejemplo que te da el SAT me devolvió:
NO X509_NAME
Seguiré moviendole a ver si me sale
Saludos