The government of Kazakhstan, in order for citizens to use electronic government services (egov.kz), requires installing the NCALayer application on the computer for working with digital signatures. However, on its each launch, the application tries to install root certificates into the Windows' Trusted Root Certification Authorities store (see screenshot below).
Tutorials for using NCALayer state that users should click "Yes". If I click "Yes", the certificates are successfully added into certmgr.msc → Current User\Trusted Root Certification Authorities\Certificates. Also, some outdated user manuals (en, ru) warn that adding these root certificates to browsers is mandatory.
While studying PKI, I came across the fact that if the same organization both (1) issues a root certificate (and if that root certificate is marked as trusted in the OS or in the browser) and also (2) acts as a node in the data transmission path (for example, network equipment of an Internet service provider), this effectively enables it to conduct a MITM attack or a masquerade attack. In such a case, the browser will not warn the user that the traffic may be decrypted by a third party.
Given that Mozilla Firefox and Google Chrome have their own separate root certificate stores, it seems that web traffic coming from these browsers still cannot be decrypted by the government.
Logically, it appears that a MITM attack is possible. Many people in Kazakhstan use eGov and NCALayer. Yet in the Kazakh internet segment, the Russian-speaking segment, and the Internet in general, no one states that installing these root certificates is bad or unsafe. I was unable to find information on this other than a single GitHub repository. So should I be paranoid — and if not, then why not?
Kazakhstan is known for repeated attempts to conduct MITM attacks. Even putting that aside, in this case, wouldn’t an installed root certificate indeed allow interference with citizens' traffic?
Output for the first certificate, if needed (openssl x509 -noout -text -in "1.cer"):
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
54:b3:b7:40:d4:5b:91:70:7b:ed:4a:2b:e4:1b:7b:69:f8:f6:ba:50
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN = \D0\9D\D0\95\D0\93\D0\86\D0\97\D0\93\D0\86 \D0\9A\D0\A3\D3\98\D0\9B\D0\90\D0\9D\D0\94\D0\AB\D0\A0\D0\A3\D0\A8\D0\AB \D0\9E\D0\A0\D0\A2\D0\90\D0\9B\D0\AB\D2\9A (RSA), C = KZ
Validity
Not Before: Sep 8 10:04:54 2020 GMT
Not After : Sep 8 10:04:54 2045 GMT
Subject: CN = \D0\9D\D0\95\D0\93\D0\86\D0\97\D0\93\D0\86 \D0\9A\D0\A3\D3\98\D0\9B\D0\90\D0\9D\D0\94\D0\AB\D0\A0\D0\A3\D0\A8\D0\AB \D0\9E\D0\A0\D0\A2\D0\90\D0\9B\D0\AB\D2\9A (RSA), C = KZ
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (4096 bit)
Modulus:
00:a3:77:b2:60:eb:67:ed:8a:67:e3:65:ec:44:50:
4d:2c:a5:6f:7f:76:56:8c:92:cd:6d:42:7e:0c:4c:
d3:f3:c7:d5:e2:3c:76:47:08:d3:f0:3c:6b:65:e5:
3f:70:9f:0d:b3:4a:30:c8:41:ac:3f:e3:2a:a9:b2:
f8:e7:ef:2a:e3:26:d7:c6:4a:14:f6:87:3f:a4:2a:
87:14:e4:5a:ee:75:e0:c6:b6:13:86:78:1a:93:1d:
62:e0:1a:74:5b:03:a5:f1:4c:b5:02:c6:78:e3:33:
5a:19:e5:8b:5c:7b:d2:17:c3:1f:eb:76:b9:af:e0:
f5:69:96:22:b8:7a:e0:cb:7a:5d:0c:cc:a1:40:4a:
c9:90:89:f0:28:27:bf:d0:2e:2f:06:27:d1:98:a7:
f7:55:9b:1b:69:9b:72:ae:c9:c5:2d:b3:fb:7a:e3:
09:33:0f:d1:d0:ec:2e:c3:38:17:e2:55:63:52:1b:
45:cc:8c:84:d9:20:11:ac:fe:09:81:0d:22:23:5a:
30:ff:43:6c:0b:19:60:95:11:1f:0d:67:fd:dc:64:
66:96:d1:ff:86:17:be:dc:3b:00:8f:53:2d:08:f6:
0f:b4:9a:fc:ba:74:68:95:8d:a8:65:05:e0:5e:99:
41:01:89:45:af:1a:85:c5:60:a4:cc:6a:fc:64:23:
17:49:f9:59:f4:c8:c2:42:01:6a:fc:98:59:c2:a0:
ca:d4:06:88:f5:03:d0:ad:ab:f1:17:de:7c:ba:7b:
71:e4:aa:ad:8f:08:ec:14:80:64:ef:c7:b5:1a:46:
de:d4:f6:ed:b5:53:16:c1:bc:64:61:38:d6:71:c9:
1c:e3:01:f8:f9:a6:99:18:97:42:d1:91:e9:b8:62:
5d:a4:21:db:70:13:b7:8d:67:a2:bc:94:49:b1:11:
f9:43:21:dc:e6:95:6b:2a:83:d1:e5:3c:f3:3c:ad:
f0:f8:f8:93:1d:4e:d2:88:1b:b5:0b:f9:2d:eb:3a:
a5:67:14:9d:8b:0e:77:be:c6:e3:f3:3b:9f:ee:13:
d1:bf:72:be:a9:e1:aa:cd:b0:84:2c:27:34:4f:97:
6d:19:ef:1f:aa:dd:cf:54:76:63:bd:bd:63:c0:80:
ad:a8:1f:21:cf:e7:0e:be:8c:2d:96:41:8e:9f:f1:
90:44:ee:1a:cc:90:8e:28:e1:23:d7:fd:98:48:58:
f7:45:24:a2:82:ea:43:d3:83:93:38:65:fb:63:d0:
ff:22:04:9a:bb:3a:92:34:e5:08:7a:34:a7:ae:97:
54:b2:56:ca:ba:ed:0b:48:53:3b:9c:cc:9f:b7:a9:
84:87:d2:56:02:86:ad:18:f6:51:49:85:b7:a8:76:
b1:5e:a5
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints: critical
CA:TRUE
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
X509v3 Subject Key Identifier:
54:B3:B7:40:D4:5B:91:70:7B:ED:4A:2B:E4:1B:7B:69:F8:F6:BA:50
X509v3 Authority Key Identifier:
keyid:54:B3:B7:40:D4:5B:91:70:7B:ED:4A:2B:E4:1B:7B:69:F8:F6:BA:50
DirName:/CN=\xD0\x9D\xD0\x95\xD0\x93\xD0\x86\xD0\x97\xD0\x93\xD0\x86 \xD0\x9A\xD0\xA3\xD3\x98\xD0\x9B\xD0\x90\xD0\x9D\xD0\x94\xD0\xAB\xD0\xA0\xD0\xA3\xD0\xA8\xD0\xAB \xD0\x9E\xD0\xA0\xD0\xA2\xD0\x90\xD0\x9B\xD0\xAB\xD2\x9A (RSA)/C=KZ
serial:54:B3:B7:40:D4:5B:91:70:7B:ED:4A:2B:E4:1B:7B:69:F8:F6:BA:50
X509v3 Certificate Policies:
Policy: 1.2.398.3.1.2
CPS: http://root.gov.kz/cps
Signature Algorithm: sha256WithRSAEncryption
Signature Value:
5b:bc:6f:6c:26:22:6c:3a:9f:3d:bd:b2:be:f2:a1:ec:24:1d:
a7:3d:c0:2b:01:1b:ab:5d:e2:92:51:47:2f:99:ba:54:12:4c:
57:9a:2f:80:b2:00:c2:b3:f4:98:13:1f:ea:75:12:1e:15:0e:
af:dd:c8:9a:cc:38:20:b7:ec:47:d1:63:94:f5:7e:6f:a1:2c:
aa:d0:65:c1:b0:59:15:3e:46:68:0c:7a:1e:e8:d6:1c:bb:8e:
af:3f:17:1d:1b:34:67:bb:53:e8:36:31:93:92:40:b6:88:f0:
2e:e4:fd:bb:f8:0d:13:d5:9f:c9:73:bc:21:dd:19:f5:52:03:
7c:86:97:db:c3:d4:7f:dc:59:22:af:f7:41:f1:7a:e8:f9:e2:
07:c8:75:dd:af:23:84:04:04:34:ed:cb:19:d7:3c:a0:b3:05:
f5:1a:65:46:fb:e3:47:0f:5e:99:c1:c0:a8:d5:f9:da:88:80:
a5:ba:c9:4b:60:5d:7f:cc:bb:07:a8:4a:18:cf:f9:1b:97:13:
63:2c:a8:72:1f:39:ec:e6:96:64:58:87:b7:67:2d:1b:d7:d3:
b5:10:b6:78:40:3d:9a:10:a3:6e:ac:a2:7f:38:a4:2f:17:c1:
5c:1f:72:b0:f1:83:fa:47:44:16:b7:cc:e3:58:58:71:50:70:
3b:5e:b8:af:4a:48:95:e1:30:34:e4:ee:8f:b5:36:75:de:9e:
01:8f:fa:66:d7:59:5e:8b:31:cd:a5:2e:35:c8:5b:18:64:16:
22:08:cf:ea:e7:e7:63:20:77:6f:2a:7f:e1:e3:39:ff:fe:67:
91:7e:3a:b6:32:c2:c4:87:4b:09:eb:00:03:04:c5:c2:1e:5f:
af:29:c8:24:30:c9:0f:44:6e:b5:7e:ec:f0:42:f3:aa:bb:c1:
ef:fb:07:02:b7:d6:22:8e:cc:95:ec:bf:74:49:47:47:0f:5c:
3b:98:26:2d:bd:c5:90:e6:f6:aa:06:be:29:fe:38:2a:45:c4:
65:ed:9b:5d:f3:25:40:4b:70:21:a6:84:29:94:3c:f4:28:9a:
48:6b:5e:d9:45:08:00:04:fd:25:a0:47:cc:ec:c5:54:e3:02:
29:f0:ed:15:81:26:71:62:23:ab:0f:b4:96:23:51:aa:2f:99:
c5:aa:cc:23:e2:5b:d2:16:3a:14:3f:81:aa:5e:60:ce:0f:8c:
b6:42:d9:83:11:cf:b9:43:94:a5:3c:f8:ac:45:6a:4c:89:ef:
a4:49:aa:9c:36:3f:12:25:23:c2:c8:6a:40:12:b3:0a:a2:bc:
20:f5:1d:4b:fc:08:f7:11:3b:70:55:c6:aa:4a:43:47:c6:11:
72:74:37:24:44:8b:12:18
Output for the second certificate, if needed (openssl x509 -noout -text -in "2.cer"):
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
5c:ae:24:d7:49:b2:64:80:d2:de:37:23:3c:3e:a4:51:5d:b5:5a:c7
Signature Algorithm: sha256WithRSAEncryption
Issuer: CN = \D0\9D\D0\95\D0\93\D0\86\D0\97\D0\93\D0\86 \D0\9A\D0\A3\D3\98\D0\9B\D0\90\D0\9D\D0\94\D0\AB\D0\A0\D0\A3\D0\A8\D0\AB \D0\9E\D0\A0\D0\A2\D0\90\D0\9B\D0\AB\D2\9A (RSA), C = KZ
Validity
Not Before: Sep 22 10:38:15 2022 GMT
Not After : Sep 7 10:04:54 2045 GMT
Subject: CN = \D2\B0\D0\9B\D0\A2\D0\A2\D0\AB\D2\9A \D0\9A\D0\A3\D3\98\D0\9B\D0\90\D0\9D\D0\94\D0\AB\D0\A0\D0\A3\D0\A8\D0\AB \D0\9E\D0\A0\D0\A2\D0\90\D0\9B\D0\AB\D2\9A (RSA) 2022, C = KZ
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (4096 bit)
Modulus:
00:93:0f:57:cc:4f:2d:d1:43:52:38:50:de:bd:b2:
e8:be:34:30:c7:d4:36:0a:e6:d6:72:48:77:8d:20:
55:b4:c1:86:5b:45:4c:a9:3e:e3:ef:73:93:4c:20:
0a:8c:a3:25:e1:24:7f:d0:a4:f7:b8:1d:d0:0c:c8:
f6:94:ea:fb:b4:89:ee:5e:f9:03:b9:d3:80:01:98:
33:cb:d0:03:42:33:bc:40:0c:7f:15:0b:4e:8a:da:
99:d5:b9:c2:b8:8a:97:a7:52:d7:b7:85:cb:59:bf:
c2:4c:e0:5d:c8:ea:37:19:5e:1e:29:6b:ba:93:3a:
c1:a9:da:58:94:87:9a:38:98:e5:ca:6a:46:27:9d:
93:82:c8:32:27:a0:fc:f2:c8:14:6c:50:c3:09:a2:
09:07:fe:33:92:cd:0d:20:c3:1d:ba:ac:e1:9f:0b:
d5:25:98:d6:8a:c1:cf:e0:cb:8f:40:b1:f9:7b:b4:
50:a7:64:a1:60:62:eb:2d:d1:73:c1:ae:bf:70:8f:
72:6b:34:dc:36:1b:b1:ad:99:86:92:ee:92:37:4d:
16:8b:17:51:2b:0c:ec:fa:23:30:91:91:76:af:72:
58:4c:21:e0:b3:f1:1a:48:80:09:1a:0c:1e:41:22:
e3:7d:0a:fd:e4:0c:ce:28:5b:49:37:12:81:ab:0f:
b6:44:fa:29:00:c5:e1:d9:81:16:b4:b4:63:28:de:
5e:98:e8:6e:4b:3c:ea:9f:56:5a:ec:1d:e2:d0:66:
1f:cf:9f:96:dd:0b:13:4a:9a:c3:18:be:7a:c7:cb:
1d:d2:6c:11:e8:43:9b:e0:6b:ba:17:ad:ac:76:26:
56:54:f6:13:84:67:27:82:93:ec:9b:43:d8:6a:03:
28:40:56:50:c8:72:73:2b:7d:24:1a:b4:41:2d:72:
8a:c6:50:c1:d4:33:69:ee:46:d7:80:95:0e:f2:84:
6e:1a:6d:fc:83:1a:a6:30:80:29:ac:bc:0a:4a:10:
07:0a:95:77:05:b2:38:00:81:db:85:bd:96:fd:30:
45:27:2a:bd:73:0c:9c:bc:51:09:c6:79:f2:f3:a3:
0f:df:49:a4:4d:19:46:dd:a0:e8:f3:8e:90:61:cb:
4e:54:6d:5c:15:cc:2c:f8:0f:70:f5:62:70:93:90:
db:4d:53:8b:ca:ea:1c:59:70:a3:33:fb:f4:87:55:
8a:31:e7:f0:97:5e:6c:df:7d:f0:f0:33:ca:6a:2e:
99:fc:11:94:a0:86:f6:e9:6c:f2:d1:13:14:1f:ff:
cd:7b:cf:6f:ef:80:eb:bc:b2:50:0f:e6:be:89:f3:
7f:ba:3c:b3:0d:f1:83:28:4b:17:98:ca:c7:89:c9:
b4:c1:d1
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Basic Constraints: critical
CA:TRUE, pathlen:0
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
X509v3 CRL Distribution Points:
Full Name:
URI:http://crl.root.gov.kz/rsa2020.crl
X509v3 Subject Key Identifier:
DC:AE:24:D7:49:B2:64:80:D2:DE:37:23:3C:3E:A4:51:5D:B5:5A:C7
X509v3 Authority Key Identifier:
keyid:54:B3:B7:40:D4:5B:91:70:7B:ED:4A:2B:E4:1B:7B:69:F8:F6:BA:50
DirName:/CN=\xD0\x9D\xD0\x95\xD0\x93\xD0\x86\xD0\x97\xD0\x93\xD0\x86 \xD0\x9A\xD0\xA3\xD3\x98\xD0\x9B\xD0\x90\xD0\x9D\xD0\x94\xD0\xAB\xD0\xA0\xD0\xA3\xD0\xA8\xD0\xAB \xD0\x9E\xD0\xA0\xD0\xA2\xD0\x90\xD0\x9B\xD0\xAB\xD2\x9A (RSA)/C=KZ
serial:54:B3:B7:40:D4:5B:91:70:7B:ED:4A:2B:E4:1B:7B:69:F8:F6:BA:50
Authority Information Access:
CA Issuers - URI:http://root.gov.kz/cert/root_rsa_2020.cer
X509v3 Certificate Policies:
Policy: 1.2.398.3.3.2
CPS: http://pki.gov.kz/cps
Signature Algorithm: sha256WithRSAEncryption
Signature Value:
16:46:6c:59:62:72:c6:70:dd:be:33:15:06:8f:fd:f0:64:59:
55:a8:80:d5:39:be:dc:a3:3b:46:22:8b:86:47:04:27:cc:63:
23:3b:57:7c:26:7f:3a:3c:f7:b1:71:ef:bc:3a:c3:39:5f:51:
90:86:ca:45:6e:c2:55:b0:e0:e6:f9:ec:8f:e9:cb:aa:fb:85:
2d:60:bb:be:0f:4c:41:b1:dd:ba:f6:fb:8f:7a:fb:50:6e:73:
50:19:dd:de:19:39:86:05:36:bc:b6:31:e6:d6:dc:ab:ae:f2:
c8:bb:61:8e:b3:55:88:ab:26:d3:d8:00:60:d8:c4:7d:09:88:
0c:50:20:a8:28:49:68:be:d0:c9:8e:20:b6:f3:0f:9a:fa:b3:
96:9e:61:94:e4:60:53:b6:ca:ef:44:65:0e:9e:47:7b:7a:c9:
0a:ed:7e:50:a0:d7:16:0a:70:52:0a:27:3e:57:d9:94:8f:29:
56:90:db:f7:e0:f8:35:c4:eb:67:75:c1:e8:df:65:b8:29:34:
35:20:f0:09:b0:65:13:8b:0a:a7:0c:48:41:12:49:b7:bd:34:
b1:0f:06:51:94:34:aa:57:7b:d1:72:07:55:3f:cd:be:bd:df:
b5:d6:bf:67:55:2f:24:ad:be:68:20:19:8b:5f:64:4b:bf:8c:
cc:09:fc:cd:c2:cd:b0:5e:bc:37:9f:61:ee:bc:dd:91:aa:c5:
a8:4a:12:2b:15:49:c9:cb:38:82:36:b6:ca:c1:83:da:93:0c:
51:e2:f5:bd:4a:61:fa:83:94:af:79:50:20:cc:00:1d:9a:35:
60:cb:64:42:a5:0f:c8:7b:09:4e:e8:07:8a:32:b5:07:92:5b:
21:b8:e2:15:e4:64:2b:5e:72:ea:b0:1e:c6:97:5a:4e:a2:e2:
23:7a:06:60:e7:c9:0b:83:03:99:42:8e:f4:52:25:52:9c:3d:
79:67:ce:a9:9f:ca:03:da:e5:84:84:5a:ca:03:69:21:81:f0:
05:12:3f:69:d4:9a:12:18:96:af:c2:16:6b:66:13:52:fd:ef:
30:cc:8e:29:71:17:74:a5:7e:1b:6e:84:d8:20:55:44:6b:e6:
39:f4:c9:0c:44:ef:8b:11:bd:92:93:59:99:62:9e:fa:5f:cd:
74:79:90:42:fa:6c:05:2b:c9:99:29:78:da:66:fd:39:df:1a:
47:1e:b9:d4:14:f1:11:52:07:73:e5:06:ad:52:c1:1f:00:42:
a5:39:46:c8:40:e6:00:a4:0e:09:f1:ad:5f:d1:e1:ae:2d:61:
f0:fe:4f:95:ea:83:59:d1:30:ec:1b:d9:7f:54:27:f9:53:3c:
88:d5:35:ae:41:01:2b:bc
About NCALayer
NCALayer is a Java-based desktop application. After installation, it is unpacked into the directory C:\Users\<username>\AppData\Roaming\NCALayer. The directory structure looks as follows:
bundles\
jre\lib\...
jre\bin\...
ncalayer-cache\...
VisualElements\...
icon.png
ncalayer.der
NCALayer.exe
ncalayer.log
ncalayer.VisualElementsManifest.xml
settings.json
unins000.dat
unins000.exe
When launching NCALayer.exe, it starts the process jre\bin\javaw.exe (version of java.exe is openjdk version "1.8.0_422"). The javaw.exe executable is signed with certificate from "BELLSOFT", which was issued by "Sectigo Public Code Signing CA R36". The process does not create any firewall rules on Windows.
Each time NCALayer starts, it checks whether both of its root certificates are present in the Trusted Root Certification Authorities store. If either one is missing, pop-up dialogs appear one after another, asking the user to add the root certificates (see the screenshot at the beginning of the question).
Government websites such as egov.kz and knp.kgd.gov.kz check whether NCALayer is running when authenticating with a digital signature. NCALayer is also used for signing data when accessing electronic government services. However, for authentication and accessing services on egov.kz, neither of the two root certificates is required (tested the latest version, NCALayer v1.4); it is sufficient that NCALayer is running and a digital signature is provided. In contrast, authentication on knp.kgd.gov.kz requires at least one of the two root certificates to be installed.
The official documentation have instructions on how to install root certificates in Windows, macOS, Linux, and into Mozilla Firefox and Google Chrome (browser instructions are not available in English) and how to make browsers trust these certificates. However, in practice I have never needed to install the certificates into browsers. Some YouTube-videos show how to install root certificates on Windows and macOS.
The NCALayers installation script for Linux, written in Bash, uses certutil, but I never run the script.
In Kazakhstan, citizens can access certain government services in special service centers equipped with public computers. So, I have no complaints if such computers can have root certificates installed.
But many people use egov.kz and NCALayer from home. They don't know that they shouldn't install the certificates. And I didn't know this until I studied the PKI.




