Recent

Author Topic: extract contained file from p7m file  (Read 291 times)

nomorelogic

  • Full Member
  • ***
  • Posts: 111
extract contained file from p7m file
« on: March 13, 2019, 08:20:58 am »
hi all

I've some problem on extracting content from a p7m file using fpc ssl_openssl_lib unit.
I think I don't have necessary knowledges.

Follow my source: after d2iPKCS12bio, p is never assigned.
Some help?

thanks
nomorelogic


Code: Pascal  [Select]
  1.  
  2. uses
  3. ...
  4.   , ssl_openssl
  5.   , ssl_openssl_lib;
  6. ...
  7.  
  8.  
  9. procedure TForm1.Button1Click(Sender: TObject);
  10. var FBIO: PBIO;
  11.     sfile: AnsiString;
  12.     sl:TStringList;
  13.     i: integer;
  14.     p: SslPtr;
  15. begin
  16.    sl:=TStringList.Create;
  17.    sl.LoadFromFile(Edit1.Text);
  18.    sfile:=sl.Text;
  19.    sl.Free;
  20.  
  21.    fbio:=BioNew(BioSMem);
  22.    i:=BioRead(FBIO, sfile, Length(sfile));
  23.    p:= d2iPKCS12bio(FBIO,nil);
  24.  
  25.    BioFreeAll(FBIO);
  26.  
  27.  
  28. end;          
  29.