fpopenssl: please uncomment DEFINE DUMPCERT
Summary
DEFINE DUMPCERT should be .$DEFINE DUMPCERT in fpopenssl.'
System Information
All supported platforms.
Steps to reproduce
Example Project
// creates valid key pairs
program testcert;
{$mode objfpc}{$I-}{$H+}
uses
sysutils, base64, classes, sslbase, openssl, fpopenssl;
var
X509:TOpenSSLX509Certificate;
certkey:TCertAndKey;
pk,cr:TBytes;
e:ansistring;
i:integer;
begin
X509:=TOpenSSLX509Certificate.Create;
try
certkey:=X509.CreateCertificateAndKey;
cr:=certkey.certificate;
pk:=certkey.privatekey;
setstring(e,Pchar(certkey.Certificate),length(certkey.Certificate));
e:=EncodeStringBase64(e);
writeln('-----BEGIN CERTIFICATE-----');
for i :=1 to length(e) do
begin
write(e[i]);
if (i mod 64 = 0) or (i >=length(e)) then writeln;
end;
writeln('-----END CERTIFICATE-----');
writeln;
setstring(e,PAnsiChar(certkey.PrivateKey),length(certkey.PrivateKey));
e:=EncodeStringBase64(e);
writeln('-----BEGIN RSA PRIVATE KEY-----');
for i :=1 to length(e) do
begin
write(e[i]);
if (i mod 64 = 0) or (i >=length(e)) then writeln;
end;
writeln('-----END RSA PRIVATE KEY-----');
finally
X509.Free;
end;
end.
What is the current bug behavior?
Writes a file in temp.
What is the expected (correct) behavior?
Should not write a file.
Possible fixes
{.$DEFINE DUMPCERT} // note the dot. Feel free to add my example here to fcl-net
Edited by Thaddy de Koning