Vouch[ma]
Contact us

Guide · Law 43-20

Qualified electronic signature in Morocco — the Law 43-20 guide.

Soufiane Taouil · Founder, Vouch

Every e-invoice under Article 145-IX of the Moroccan Tax Code must carry a qualified electronic signature. This guide explains what a qualified signature means under Law 43-20, who can issue one, how to integrate it into your invoicing flow, and why it is the most legally sensitive link in your compliance chain.


01

What is a qualified electronic signature?

An electronic signature is a cryptographic mechanism that ties a document to its author's identity, guaranteeing that (a) the document has not been altered since signing, (b) the holder of the key actually signed, and (c) they cannot credibly deny doing so. Three combined properties: integrity, authenticity, non-repudiation.

Law 43-20 recognises three levels of electronic signature: simple, advanced, and qualified. The qualified level is the highest: it relies on a certificate issued by a trust service provider (PSCo) approved by the DGSSI, and the private key must be created and used inside a qualified hardware device (QSCD).

Under the Moroccan regime, a qualified signature carries the same legal effect as a handwritten one: it constitutes consent and a binding commitment by its author, and it is admissible in court without case-by-case proof of reliability.

02

The legal framework: Law 43-20 and decree 2-22-687

Law 43-20 on trust services for electronic transactions was promulgated by dahir 1-20-100 of 31 December 2020 and published in Bulletin Officiel n° 6970 of 18 March 2021. It repeals and replaces Law 53-05 on the electronic exchange of legal data, under which ANRT was the certification authority.

Decree 2-22-687 of 21 rabii II 1444 (16 November 2022), issued for the implementation of Law 43-20, was published in Bulletin Officiel n° 7162 of 19 January 2023. It sets the rules for each trust service, the regime for PSCo approval and declaration, and the data that qualified certificates must contain.

Under this new regime, the DGSSI (Direction Générale de la Sécurité des Systèmes d'Information) is designated as the national authority for trust services. It establishes the requirement frameworks, approves PSCos, publishes the list of approved PSCos (article 53 of the law), and may audit their compliance (article 55).

03

The three levels: simple, advanced, qualified

The simple level covers any electronic signature linked to an identifiable signer, created using data the signer keeps under their control, and bound to the document such that any subsequent modification is detectable. Admissible as evidence, but with no special probative weight.

The advanced level adds technical requirements: the signature must be created using means the signer can keep under sole control, must rely on a cryptographic certificate, and must be linked to the signed data so that any alteration is detectable. This is the equivalent of the European eIDAS "advanced electronic signature" — the model Law 43-20 is closely inspired by.

The qualified level additionally requires the use of a qualified device (QSCD) and a qualified certificate issued by a PSCo approved by the DGSSI. It is the only level that benefits from a presumed legal effect equivalent to a handwritten signature. For an e-invoice under Article 145-IX of the Moroccan Tax Code, this is the level required: no other is accepted by the national platform.

04

The actors: DGSSI, PSCo, QSCD

The DGSSI plays the role of national authority. It publishes the requirement frameworks applicable to PSCos (the general framework Ref_PSCo_AG, the qualified certificate delivery framework Ref_Deliv_Cert_Qual, the QSCD framework Ref_QSCD, the validation framework Ref_Valid_Qual, the registered envelope framework Ref_Env_reco_Qual). It processes approval requests and publishes the list of approved PSCos.

A PSCo (Prestataire de Services de Confiance) is a — typically private, specialised — entity that obtains DGSSI approval to deliver qualified trust services. As of this guide, Africtrust has been announced as the first PSCo approved by the DGSSI. The official list, updated as approvals are granted, is published on the DGSSI website.

The QSCD (Qualified Signature Creation Device) is the hardware device that holds the private key. Its defining property: the private key never leaves it in plaintext. Several forms: HSM hosted at a PSCo, smart card with reader, signing USB token, or the secure enclave of a phone (Secure Enclave on iOS, TEE on Android) when the PSCo offers a remote qualified mobile signing service.

05

How to choose a PSCo

First, verify that the provider is actually approved by the DGSSI for the trust service you need. Approval is not blanket: a PSCo may be approved to issue qualified signature certificates without being approved for electronic seals, timestamping, or registered delivery. The DGSSI list specifies the scope of each PSCo's approval.

Compare delivery modalities: some PSCos require an in-person identity check (visit to an enrolment centre), others accept remote verification via videoconference with an agent. Qualified mobile signing — where the key is created in your phone's secure element via biometric enrolment — reduces user friction but depends on the PSCo's offering.

Check the annual cost (an individual certificate is around MAD 1,200 per year), the validity period (typically 1 to 3 years), renewal terms, and available technical support. For an accounting firm managing several client portfolios, check whether the PSCo offers organisational certificates (electronic seal of the firm) alongside the individual certificates of signing staff.

06

The QSCD: why a hardware device?

The QSCD is the technical guarantee that only its holder can produce a signature with the key it stores. The founding principle: the private key is generated inside the device, never leaves it, and each signing operation requires authentication (PIN, biometrics). Without that, any copy of the key could produce signatures indistinguishable from the original.

Several form factors coexist. The HSM (Hardware Security Module) is a dedicated certified appliance, typically hosted at a PSCo and accessible remotely for server-side signing — practical for systems issuing many invoices. The smart card with USB reader and the signing USB token are the classic individual formats. The mobile secure enclave, introduced by PSCos offering qualified mobile signing, holds the key in the secure component of your smartphone.

The Ref_QSCD framework published by DGSSI specifies the technical requirements a device must meet to be recognised as qualified. In practice you won't choose the QSCD yourself: your PSCo provides the device compatible with their offering.

07

XAdES: wrapping the signature in a UBL invoice

For UBL 2.1 e-invoicing, the qualified signature is applied to the XML document itself via a signature profile called XAdES (XML Advanced Electronic Signatures), standardised by ETSI. The mechanism: the UBL document is canonicalised, its hash is computed, that hash is signed with the holder's private key, and the result (signature + certificate + validation metadata) is embedded in a dedicated XML node inside or around the UBL document.

Several XAdES profiles coexist: XAdES-B (basic, signature only), XAdES-T (with timestamp), XAdES-LT (long-term, embedding validation evidence), XAdES-LTA (long-term archive, with archive timestamp). The exact profile required for DGI e-invoicing will be specified by the technical reference framework published by the DGI or xHub. As a reasonable hypothesis, an XAdES-LT or XAdES-LTA profile is compatible with the 10-year archival requirement.

In practice, your invoicing software or your dematerialisation operator orchestrates the signing: it prepares the UBL document, requests the signing operation from your PSCo (sending the hash to be signed and receiving the signature), wraps the result in XAdES, and transmits to the DGI platform. You don't write XAdES code yourself.

08

Frequently asked questions

Is my existing ANRT-era certificate still valid under Law 43-20?
Certificates issued under the previous Law 53-05 regime keep their validity until expiry, but under the new regime new qualified certificates must be issued by a PSCo approved by the DGSSI. Check with your current provider whether they have obtained DGSSI approval for service continuity; otherwise, plan a migration to an approved PSCo.
How long does it take to obtain a qualified certificate?
Allow several weeks between request, identity verification by the PSCo (in-person or remote), and delivery of the QSCD device. The exact timing depends on the PSCo and the enrolment modality. Don't wait until the last minute: delivery cannot be expedited.
Several people in my company sign invoices. One certificate per signer?
Yes for personal signatures by each signer (e.g. an accountant signing their entries). For acts in the company's own name, you can use an organisational electronic seal — a distinct trust service from a natural-person signature, also covered by Law 43-20.
Does the QSCD have to be hardware, or can it be software-only?
For a signature to be qualified under Law 43-20, the device must be qualified per the Ref_QSCD framework published by the DGSSI. In practice this excludes pure software modules: the device must include a secure hardware component (HSM, smart card, mobile secure element). Qualified mobile signing works precisely because the phone's secure component is recognised as a qualified device.
What happens when my certificate expires?
On expiry, you can no longer produce new signatures with that certificate. Signatures already applied remain valid if they were properly timestamped (XAdES-T or higher), because validity at signing time can be established post-hoc. Renew your certificate with your PSCo before expiry.
Which XAdES profile will the DGI require for invoices?
The exact profile has not yet been published as of this guide — it will appear in the national platform's technical reference framework. As a reasonable hypothesis, an XAdES-LT or XAdES-LTA profile is compatible with the 10-year archival requirement. We will update this once the official spec is published.

09

Sources and references

About this guide

Soufiane Taouil

Founder, Vouch

Guide written by Soufiane Taouil, founder of Vouch. Updated whenever a new DGSSI requirement framework or PSCo approval is published. For any question or correction, write to contact@vouch.ma.

Vouch orchestrates qualified signing for you

Our platform integrates qualified XAdES signing via your PSCo: you sign, we wrap and submit to the DGI. Book a demo or browse the API documentation.