Checking a Moroccan identity card (CNIE): 4 checkpoints

Check the authenticity of a Moroccan identity card (CNIE) 4 checkpoints

The Moroccan National Identity Card (CNIE) is an official document that allows any Moroccan citizen to prove his identity and, as long as it is valid, his Moroccan nationality.

It is compulsory for all citizens over the age of 16, but it can be obtained at any age.

The aim of this card is to strengthen security and facilitate identification in electronic transactions, while reducing the risk of forgery.

So, how do you check a Moroccan identity card and make sure that the document presented is authentic? Find out in this article!


Individuals, do you occasionally need to verify one or more identity documents? Discover eligible documents in the store !

Small businesses, do you need to verify one or more identity documents via a web application? Discover the identity web suite!

Professionals, do you need to integrate proof of identity validation into one of your business processes, including all European identity cards and global passports? Discover our API with web application to validate the authenticity of an identity document in less than 10s!


Control 1: Verify a Moroccan identity card based on its general appearance

The first step in verifying a Moroccan identity card when you can access the original document is the overall appearance of the document: it must not show any trace of cutting, peeling, modification/rectification of any kind.

Pay particular attention to the level and around the photo.

The new electronic identity card is in ID-1 format, the size of a bank card.

Control 2: Verification of a Moroccan identity card by cross-checking information

The second step in verifying a Moroccan identity card online is to check the consistency of the information on the document.

Document number

The document number can be found in two different places: on the upper part of the back, and in the first line of the MRZ strip.

Both must be identical:

Verify the authenticity of a Moroccan electronic identity card document number

Personal number

The holder’s personal number can be found in two separate places: in the middle of the front of the card, and at the beginning of the second MRZ line in YYMMDD format:

Verify the authenticity of a Moroccan electronic identity card with a personal number on the front

Verify the authenticity of a Moroccan electronic identity card on the back of your personal number

Date of birth

Here again, the cardholder’s date of birth can be found in two distinct places: in the middle of the front of the card, and at the beginning of the second MRZ line in YYMMDD format:

Verify the authenticity of a Moroccan electronic identity card with a single-fold date of birth

Verify the authenticity of a Moroccan electronic identity card on the back of the date of birth

Last name and first name(s)

The same goes for the first and last names, which can be found on the front of the card and in the third line of the MRZ stripe:

Verify the authenticity of a Moroccan electronic identity card with both names

Verify the authenticity of a Moroccan electronic identity card on the back of the name

Card expiry date

Finally, the last element present in duplicate on the card: the expiration date, which can be found on the front as well as in the second line MRZ in YYMMDD format:

Verify the authenticity of a Moroccan electronic identity card with a front expiry date

Verify the authenticity of a Moroccan electronic identity card back expiry date

Control 3: Verify a Moroccan identity card with its MRZ strip

The lower part of the new Moroccan identity card is made up of three lines that contain the information on the card, with validation keys that avoid misreadings or forgeries.

Constitution of the MRZ strip of the Moroccan identity card

First line

Verify the authenticity of a Moroccan electronic identity card line 1

  1. Document Type : 2 characters, code indicating the type of document, represented by the letters “I< ” or “ID”.
  2. Issuing Country : 3 characters, the ISO 3166-1 alpha-3 code of the issuing country.
  3. Card number : 9 characters, unique card number.
  4. Control key: 1 character, control key for the card’s unique number.
  5. Personal number : 8 characters, personal number of the cardholder.
  6. End of line : chevrons ” ” < to complete the line.

Second row

Verify the authenticity of a Moroccan electronic identity card line 2

  1. Date of birth : 6 characters, year, month and day of birth in YYMMDD format.
  2. Control key: 1 character, control key for date of birth.
  3. Gender : 1 character, “M” or “F”.
  4. Expiry date: 6 digits, card expiry date in YYMMDD format.
  5. Control key: 1 character, expiry date control key.
  6. Country code : 3 characters, ISO 3166-1 alpha-3 code of the holder’s nationality.
  7. Separation : 11 chevrons “<“.
  8. Control key : 1 character, character concatenation control key line 1 6-15, line 2 1-7, line 2 9-15.

Third row

Verify the authenticity of a Moroccan electronic identity card line 3

  1. Holder’s name and first names : the holder’s first and last names, starting with the last name followed by the first name. The surname and the first name are separated by two characters <. In the case of a compound surname, a compound given name, or multiple given names, they are separated by the character <. Spaces and apostrophes are replaced by the character < and the name is truncated to 30 characters if necessary, and any accents on the letters are removed. The line is then completed by the character <.

Verify a Moroccan ID card with MRZ line security keys

A Moroccan identity card has 4 control keys (or security keys) that allow you to validate the information that precedes them.

They help avoid transcription errors or changes, whether intentional or not.

How does the algorithm work?

The algorithm used to create and validate the control keys is common to all identity documents: the characters have a weight, which is multiplied by a factor according to their position in the chain (7, 3 and 1).

The numbers have their own value (“0” is 0, “1” is 1 etc up to “9” which is 9), the chevron “<” also has a value of 0 while the weight of the letters starts at 10 for the letter “A”, 11 for the letter “B” up to 35 for the letter “Z”.

Example

Let’s take the specimen’s date of birth control key above as an example.

The string to be validated is “831205”.

To calculate the control key, we will proceed as follows:

– “8” has a weight of 8 and is placed in the first position, so it must be multiplied by 7: 8 * 7 = 56

– “3” has a weight of 3 and is placed in second position, so we must multiply it by 3: 3 * 3 = 9, which we add to the previous 56, i.e. 9 + 56 = 65.

– 1 has a weight of 1 and is located in third position, so we must multiply it by 1: 1 * 1 = 1, which we add to the previous 65, i.e. 1 + 65 = 66.

– 2 * 7 = 14 and 14 + 66 = 80

– 0 * 3 = 0 and 0 + 80 = 80

– 5 * 1 = 5 and 5 + 80 = 85

We therefore obtain a total of 85, from which we will extract the modulo 10 (the remainder of the Euclidean division by 10), which is equivalent to keeping only the last digit, i.e. “5”.

Our control key is therefore valid because it is indeed 5 that appears on the document!

Control 4: Verify a Moroccan identity card with its physical security features

An identity document has various elements to validate its authenticity.

This is the last step to verify a Moroccan identity card online, as it is the longest.

Front protection devices

There are various new generation security features to protect the front of the card.

Verify the authenticity of a Moroccan electronic identity card CNIE recto protections

Back protection devices

The same applies to the back of the card:

Verify the authenticity of a Moroccan electronic identity card CNIE verso protections

Conclusion

You now have all the keys to verify a Moroccan identity card online and make sure it is authentic!

No need for specialized equipment: a little vigilance, time and you will be able to avoid most of the fraud that can be encountered on a daily basis!

Finally, if you want to carry out all these verifications in a few seconds, discover our product to verify a Moroccan identity card (CNIE) online!

Shopping Cart
Scroll to Top