EFR France
Export
The POS software shall provide a function for checking the integrity of the data registered. The easiest way is to supply a browser interface to http://localhost:5618/control
Alternatively, the functions above can be accessed by web API:
GET http://localhost:5618/control/export?from=...
GET http://localhost:5618/control/total
GET http://localhost:5618/control/audit
GET http://localhost:5618/control/verify?file=C:/path/to/export.xml
GET http://localhost:5618/control/proof.js
GET http://localhost:5618/control/fiscal.pem
In online systems (with cloud archive), the data export functions can be invoked in the efsta Cloud Portal.
Export of Local Journal Archive
Element | Description |
---|---|
Request | /control/jou |
Method | GET |
Query | RN optional client RN, default: def target optional target folder |
Compared to /control/export
, this can be performed for local EFR data only.
Depending on the data requested, the size of the download file may be several MB.
For functionality of the proof program contained, see Journal File Verification "proofjou.js".
see also EFR API Export.
Export of Audit Records (JET)
Element | Description |
---|---|
Request | /control/audit |
Method | GET |
Query | RN optional client RN, default: def target optional target folder |
Response Header | content-type: text/csv content-disposition: attachment;filename:audit.csv |
With "commence" you download an excerpt of the journal containing audit events as CSV file audit.csv
:
Data Archive
EFR serves as a permanent and instant archive with recording format as standard JSON, according to the fiscal regulations. Transactions are signed and chained, and so are the journal archive files .jou. Local data storage is monitored and data manipulations are detected and logged.
In online systems, cloud storage serves as a long term archive for 10 years.
If EFR runs in offline mode (configured in EFR Profile), periodic data backup (usually quarterly) onto an external device is required. See EFR Additional Functions Maintainance for details. In offline mode, no automatic data purge is performed during the retention period.
Proof Methods
Transaction data and derived totals have to be stored unalterably. Data origin and sequence of recording are documented by a chain of signatures. This chapter describes the methods for checking, which can be called via REST API or are accessible on web page http://localhost:5618/control
.
export.xml
Element | Description |
---|---|
Request | /control/export |
Method | GET |
Query | RN optional client RN, default: def from from date till optional till date target optional target folder |
Response Header | content-type: text/plain content-disposition: attachment;filename:export.xml |
The signed transactions are recorded in journal files (/EFR/rn/def/jou/*.jou
), along with the documentation of relevant events occurring while operating the cash register. In online mode, these records are sent immediately to the cloud archiving system. So the analysis of data can be performed locally or via cloud portal.
As for each Document Type DT, a separate signature chain is kept and you can filter per document type. With "commence" you download an excerpt of the journal containing the signature chains as XML file export.xml
.
<export>
<source format="export" name="EFR" version="1.6.3"/>
<issuer EFR="000005802CE" RN="def"/>
<time D="2018-01-18T08:56:09+01:00" TimeOffset="-178"/>
<cert alg="ES256" PublicKey="MFkwE…"/>
<cfg SQ="2" file="Loc" TL="001" Nam="Test Company" Adr="123, Long Road" City="Paris" Zip="75001"…/>
<cfg SQ="3" file="Trm" TT="1" SW="super-POS V3.4.5"/>
<fis SQ="4" DT="fiscal" Payload="2000:19500,19500,20180117102530,01/1/1451297,fiscal,O," Signature="lmBMgu…"/>
<fis SQ="5" DT="RECEIPT" Payload="2000:19500,19500,20180117102742,01/1/1,RECEIPT,O," Signature="YDsGp…"/>
<fis SQ="6" DT="CLO" Payload="2000:39000,39000,20180117103058,CLO:01/1/1,O," Signature="klKgD…"/>
<fis SQ="7" DT="RECEIPT" Payload="2000:19500,19500,20180117104841,01/1/2,RECEIPT,N,YDsGp…" Signature="UDO1f…"/>
<fis SQ="8" DT="RECEIPT" Payload="2000:19500,19500,20180117104859,01/1/3,RECEIPT,N,UDO1f…" Signature="3BVPa…"/>
<fis SQ="9" DT="CLO" Payload="2000:39000,39000,20180117104918,CLO:01/1/2,N,klKgD…" Signature="Ue7Yl…"/>
<fis SQ="13" DT="DUP" Payload="DUP:01/1/1,fiscal,2,99,20180117164611,001/1/0003,O," Signature="BL_I3…"/>
<fis SQ="14" DT="DUP" Payload="DUP:01/1/2,fiscal,2,99,20180117164624,001/1/0004,N,BL_I3…" Signature="_Pt8j…"/>
<fis SQ="15" DT="RECEIPT" Payload="2000:19500,19500,20180117170138,01/1/4,RECEIPT,N,3BVPa…" Signature="Tz8eh…"/>
<fis SQ="16" DT="fiscal" Payload="2000:19500,19500,20180117170342,01/1/1451297,fiscal,N,lmBMg…" Signature="xSBaY…"/>
<fis SQ="17" DT="audit" Payload="audit:01/1/1,190,01/1/1451290,20180117173129,,01/1,O," Signature="TLpdz…"/>
<signature Payload="sha256:KAWnH…" Signature="nwMjP…"/>
<readme info="to proof this file export.xml"/>
<readme info="1. download proof.js from localhost:5618/control/proof.js"/>
<readme info="2. download node.exe from nodejs.org"/>
<readme info="3. run: node.exe proof.js export.xml"/>
</export>
Record Types and Fields
Type | Field | Description |
---|---|---|
source | File created by... | |
format | export | |
name | Generator program name ("EFR" = efsta Fiscal Recorder) | |
version | Program version | |
issuer | System id | |
EFR | Unique EFR id | |
RN | Register Number (for multiclient EFR, "def" by default) | |
time | Time of generation | |
D | Date/Time | |
Time Offset | In Online mode offset to cloud time (ms) | |
cert | Local signing certificate | |
alg | JWT hash and signature algorithm according to RFC7519 ES256 required | |
Public Key | Signature public key | |
cfg | Sales header (see 2.1 Configuration) | |
fis | Fiscal record | |
SQ | Journal SeQuence number | |
DT | Document Type | |
Payload | Signature payload according to INFOCERT NF525 | |
Signature | Signature (base64url) | |
Per | For month/year grand totals | |
signature | File signature | |
Payload | File data hash up to this line (sha256 base64) canonicalization: all characters except \r and \n, plain ASCII | |
Signature | Signature (base64url) | |
readme | Textual description how to proof the file | |
info | Text line |
For structural proof of the export.xml file use proof.js or http://localhost:5618/control/verify
total.xml
Element | Description |
---|---|
Request | /control/total |
Method | GET |
Query | RN optional client RN, default: def target optional target folder |
Response Header | content-type: text/plain content-disposition: attachment;filename:total.xml |
proof.js
The program proof.js is used to verify download files like export.xml or total.xml. The file can be executed using:
Element | Description |
---|---|
Request | /control/verify |
Method | GET |
Query | File path to export.xml or total.xml |
Response Header | Content-type: text/plain |
Alternate steps
- Download http://localhost:5618/control/proof.js
- Download node.exe
- Open command line (i. e. command line in Windows)
- Copy node.exe and proof.js in the same folder
- Enter the file path where node.exe is stored in the command line
- Run
node proof.js 'filename'
(i. e.node.exe proof.js export.xml or node.exe proof.js C:\Users\user\downloads\exports\export.xml
)
Example Output
proof.js efsta export file proof utility 2018-06-12
file \temp\export_01_a.xml
source format:export name:EFR version:1.7.3
issuer EFR:000000002CE RN:01_A
time D:2018-01-18T08:56:09+01:00 TimeOffset:-178
records fiscal:3 RECEIPT:4 CLO:2 DUP:3 audit:1
summary OK
It verifies the content of data export files by
- Verifying signatures
- Checking the signature chain per DataType
- Checking the file hash
The program source is open and may be used in any way, including reimplementation.
Please be aware that source and program logic, as well as data export format may change with a new version of the EFR.
Error codes
Exitcode | Code | Severity | Description |
---|---|---|---|
3 | #OPEN | abort | Cannot open file specified |
2 | #FILENAME | abort | Filename to be specified as start parameter |
1 | #FORMAT | error | Line is not a valid XML element |
1 | #ERROR | error | Unexpected runtime error |
1 | #ES256 | error | Incompatible input file ("alg":"ES256" expected) |
1 | #EC | error | Incompatible curve (NIST P-256 expected) |
1 | #CHAIN | error | "Payload": predecessor signature mismatch |
1 | #CERTIFICATE | error | "_":"certificate" missing |
1 | #PAYLOAD | error | "Payload": missing in line |
1 | #SIGNATURE | error | "Signature": missing in line |
1 | #VERIFY | error | Line signature verification failed |
1 | #SIGN | error | "Signature": invalid length (base64url 86 bytes) |
0 | !CONTINUED | warning | First "Payload": with unknown predecessor signature |
Journal File Verification "proofjou.js"
This program is automatically contained in jou*.zip when an export of a local journal archive is performed.
Command Syntax: node proofjou.js [jouPath] [-expert]
Checks performed on.jou files:
- File checksum
- Structural integrity
- Completeness of sequence number SQ
- Signature chain per DT
- Signature verification against fiscal.cer
- In –expert mode analysis of transaction amounts
- And gaplessness of TN, DN per DT
Error codes and Warnings
Code | Name | Description |
---|---|---|
#LIC | File checksum error | May be caused by exception during operation or modification |
#PARSE | Data parsing error | May be caused by exception during operation |
#AUDIT | Audit message | Important selfcheck event |
!INCR | Number not incremental | Regarding SQ, TN or DN; possibly caused by operation exception |
!DIFF | Recalculation difference | Within transaction or against GT |
?CONTINUED | Chain continuation | Signature chain continued from previous transactions |
#CHAIN | Chain broken | Possibly transaction missing in signature chain |
#FORMAT | Format error | Cannot verify signature |
#VERIFY | Signature invalid | For payload given using fiscal.pem |
#HASH | File modified | File content has been modified resulting in a hash mismatch |