-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd79087
commit aa4029a
Showing
38 changed files
with
9,877 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
unit AsicContainer; | ||
|
||
interface | ||
|
||
uses | ||
Windows, | ||
SwelioEngine, | ||
Classes; | ||
|
||
type | ||
|
||
//ASIC file container allows to create and sign digital document containers | ||
TAsicContainer = class | ||
private | ||
FCertificateSelected : boolean; | ||
ctx : pointer; | ||
FReaderNumber : integer; | ||
public | ||
constructor Create; virtual; | ||
destructor Destroy; override; | ||
procedure Close; | ||
property ReaderNumber : integer read FReaderNumber write FReaderNumber; | ||
property CertificateSelected : boolean read FCertificateSelected; | ||
function Save(FileName : WideString) : boolean; | ||
function SelectCertificate(EID : boolean) : boolean; overload; | ||
function SelectCertificate(FileName : WideString; Password : WideString) : boolean; overload; | ||
function AddFile(FileName : AnsiString) : boolean; | ||
end; | ||
|
||
implementation | ||
|
||
{ TAsicContainer } | ||
|
||
function TAsicContainer.AddFile(FileName: AnsiString): boolean; | ||
begin | ||
result := AddFileToContainer(ctx, PAnsiChar(FileName)); | ||
end; | ||
|
||
procedure TAsicContainer.Close; | ||
begin | ||
if (ctx <> nil) then | ||
begin | ||
FreeContainer(ctx); | ||
ctx := nil; | ||
end; | ||
end; | ||
|
||
constructor TAsicContainer.Create; | ||
begin | ||
inherited Create; | ||
ctx := InitializeContainer; | ||
end; | ||
|
||
destructor TAsicContainer.Destroy; | ||
begin | ||
Close; | ||
inherited; | ||
end; | ||
|
||
function TAsicContainer.Save(FileName: WideString): boolean; | ||
begin | ||
result := false; | ||
if not FCertificateSelected then | ||
exit; | ||
if ctx <> nil then | ||
begin | ||
result := SaveContainer(ctx, PWideChar(FileName)); | ||
end; | ||
end; | ||
|
||
function TAsicContainer.SelectCertificate(EID: boolean): boolean; | ||
begin | ||
result := false; | ||
if ctx <> nil then | ||
begin | ||
if EID then | ||
result := ContainerEidCertificate(ctx, ReaderNumber) | ||
else | ||
result := ContainerPickCertificate(ctx); | ||
end; | ||
FCertificateSelected := result; | ||
end; | ||
|
||
function TAsicContainer.SelectCertificate(FileName, | ||
Password: WideString): boolean; | ||
begin | ||
result := false; | ||
if ctx <> nil then | ||
begin | ||
result := ContainerCertificate(ctx, PWideChar(FileName), PWideChar(password)); | ||
end; | ||
FCertificateSelected := result; | ||
end; | ||
|
||
end. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
//=============================================================================== | ||
//= Copyright (c) Serhiy Perevoznyk. All rights reserved. | ||
//= THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY | ||
//= OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT | ||
//= LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
//= FITNESS FOR A PARTICULAR PURPOSE. | ||
//=============================================================================== | ||
|
||
unit EidFormatter; | ||
|
||
interface | ||
|
||
uses | ||
Windows, SysUtils, SwelioEngine; | ||
|
||
type | ||
TEidFormatter = class | ||
public | ||
class function FormatDate(const Value : string) : string; | ||
class function FormatNationalNumber(const Value : string) : string; | ||
class function FormatCardNumber(const Value : string) : string; | ||
end; | ||
implementation | ||
|
||
{ TEidFormatter } | ||
|
||
class function TEidFormatter.FormatCardNumber(const Value: string): string; | ||
begin | ||
Result := SwelioEngine.FormatCardNumber(Value); | ||
end; | ||
|
||
class function TEidFormatter.FormatDate(const Value: string): string; | ||
begin | ||
Result := SwelioEngine.FormatEIDDate(Value); | ||
end; | ||
|
||
class function TEidFormatter.FormatNationalNumber(const Value: string): string; | ||
begin | ||
Result := SwelioEngine.FormatNationalNumber(Value); | ||
end; | ||
|
||
end. |
Binary file not shown.
Oops, something went wrong.