Gerar Token Delphi

Exemplos > Gerar Token Delphi

Token:

 

O Token é gerado a partir da criptografia em SHA1, ele é a chave que permite a Integração. A chave é fornecida pela APISUL junto com a data e hora(ddMMyyyyHHmm).

Para a geração do token, a data e a hora devem estar atualizadas e seu padrão no formato UTC

 

Clique aqui para baixar o DLL

 

 

Exemplo:

 

 

unit Unit1;

 

interface

 

uses

 Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,

 Vcl.Controls, Vcl.Forms, Vcl.Dialogs;

 

type

 TForm1 = class(TForm)

   procedure FormCreate(Sender: TObject);

 private

   { Private declarations }

 public

   { Public declarations }

 end;

 

var

 Form1: TForm1;

 

implementation

 

{$R *.dfm}

 

procedure TForm1.FormCreate(Sender: TObject);

Type

   TGera = function (chave: PAnsiChar) : PAnsiChar; stdcall;

var x: PAnsiChar;

 dllHandle: THandle;

 GeraToken: TGera;

begin

   dllHandle := LoadLibrary(PChar('ApisulToken.dll'));

   if dllHandle <> 0 then

   begin

     @GeraToken := GetProcAddress(dllHandle, 'GeraToken');

 

     if Assigned (@GeraToken) then

         x:=  GeraToken('testfgdgdghdghe');  //call the function

 

     FreeLibrary(dllHandle) ;

   end

   else

   begin

     ShowMessage('dll not found ') ;

   end;

end;

 

end.

 

 

Volta ao topo