Skip to main content

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

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

ElementDescription
Request/control/jou
MethodGET
QueryRN 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)

ElementDescription
Request/control/audit
MethodGET
QueryRN optional client RN, default: def
target optional target folder
Response Headercontent-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:

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

ElementDescription
Request/control/export
MethodGET
QueryRN optional client RN, default: def
from from date
till optional till date
target optional target folder
Response Headercontent-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
TypeFieldDescription
sourceFile created by...
formatexport
nameGenerator program name ("EFR" = efsta Fiscal Recorder)
versionProgram version
issuerSystem id
EFRUnique EFR id
RNRegister Number
(for multiclient EFR, "def" by default)
timeTime of generation
DDate/Time
Time OffsetIn Online mode offset to cloud time (ms)
certLocal signing certificate
algJWT hash and signature algorithm according to RFC7519
ES256 required
Public KeySignature public key
cfgSales header (see 2.1 Configuration)
fisFiscal record
SQJournal SeQuence number
DTDocument Type
PayloadSignature payload according to INFOCERT NF525
SignatureSignature (base64url)
PerFor month/year grand totals
signatureFile signature
PayloadFile data hash up to this line (sha256 base64)
canonicalization: all characters except \r and \n, plain ASCII
SignatureSignature (base64url)
readmeTextual description how to proof the file
infoText line

For structural proof of the export.xml file use proof.js or http://localhost:5618/control/verify

total.xml

ElementDescription
Request/control/total
MethodGET
QueryRN optional client RN, default: def
target optional target folder
Response Headercontent-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:

ElementDescription
Request/control/verify
MethodGET
QueryFile path to export.xml or total.xml
Response HeaderContent-type: text/plain
Alternate steps
  1. Download http://localhost:5618/control/proof.js
  2. Download node.exe
  3. Open command line (i. e. command line in Windows)
  4. Copy node.exe and proof.js in the same folder
  5. Enter the file path where node.exe is stored in the command line
  6. 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
Good to know

The program source is open and may be used in any way, including reimplementation.

warning

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
ExitcodeCodeSeverityDescription
3#OPENabortCannot open file specified
2#FILENAMEabortFilename to be specified as start parameter
1#FORMATerrorLine is not a valid XML element
1#ERRORerrorUnexpected runtime error
1#ES256errorIncompatible input file ("alg":"ES256" expected)
1#ECerrorIncompatible curve (NIST P-256 expected)
1#CHAINerror"Payload": predecessor signature mismatch
1#CERTIFICATEerror"_":"certificate" missing
1#PAYLOADerror"Payload": missing in line
1#SIGNATUREerror"Signature": missing in line
1#VERIFYerrorLine signature verification failed
1#SIGNerror"Signature": invalid length (base64url 86 bytes)
0!CONTINUEDwarningFirst "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
CodeNameDescription
#LICFile checksum errorMay be caused by exception during operation or modification
#PARSEData parsing errorMay be caused by exception during operation
#AUDITAudit messageImportant selfcheck event
!INCRNumber not incrementalRegarding SQ, TN or DN; possibly caused by operation exception
!DIFFRecalculation differenceWithin transaction or against GT
?CONTINUEDChain continuationSignature chain continued from previous transactions
#CHAINChain brokenPossibly transaction missing in signature chain
#FORMATFormat errorCannot verify signature
#VERIFYSignature invalidFor payload given using fiscal.pem
#HASHFile modifiedFile content has been modified resulting in a hash mismatch