同事在Mac平台或者其他非Windows主机使用《国家税务总局全国增值税发票查验平台》的时候会出现使用问题,导致无法进行发票验真操作。其实,这是一个很容易解决的小问题。

2025.06 西安·喜来登酒店·1212

故障表现

登录国家税务总局全国增值税发票查验平台,之后发现证书是国家税务总局自签的证书,而且是从2015年到2036年的十年证书。除此之外,页面还有弹窗错误,这是由验证码功能无法正确连接后台导致的。

官方处理

官方的处理方式就是通过根证书安装引导界面来下载和部署安装国税总局的根证书和自签证书。但这种方式主要针对Windows平台,对于其他非Windows平台没有给出解决方案。

解决思路

原始文件

我们来拆解官方证书安装工具。将taxca.rar这个压缩包解压之后,可得到名为“一键安装.exe”的部署工具。然后继续解压缩就可以得到安装脚本和证书本体。其中证书分为两种,一种是p7b文件,另一种是两个cer文件。

1
2
3
4
5
6
7
8
9
10
11
12
    目录: C:\Users\root\Downloads\taxca


Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2016/12/5 9:33 taxcautl
-a---- 2016/1/16 11:14 2280 01.taxca.p7b
-a---- 2016/12/5 13:37 2068 fpcy_ca.bat
-a---- 2016/12/1 10:05 1608 root1.cer
-a---- 2016/12/1 10:06 1580 root2.cer
-a---- 2016/12/11 17:45 807399 一键安装.exe

安装脚本

这个脚本是十年前写的,是针对Windows XP环境的工具,我们可以从中看到p7b文件和cer文件其实是等价的。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
@echo off  
cls
rem write by liwei at 20161201
ver | find "5.0." > NUL && goto w2k
ver | find "5.1." > NUL && goto xp
ver | find "5.2." > NUL && goto xpl
ver | find "6.0." > NUL && goto xpl
ver | find "6.1." > NUL && goto xpl
ver | find "6.2." > NUL && goto xpl
ver | find "6.3." > NUL && goto xpl
ver | find "10.0." > NUL && goto xpl
ver | find "10.1." > NUL && goto xpl
ver | find "10.2." > NUL && goto xpl
ver | find "10.3." > NUL && goto xpl
:w2k
@echo ----------------------------------------
@echo 当前系统是:[ Windows2000 ],不支持根证书自动安装
@echo ----------------------------------------
goto end

:xp
@echo ----------------------------------------
@echo 当前系统是:[ WindowsXP ]
@echo ----------------------------------------

.\taxcautl\certutil.exe -addstore -f -enterprise -user root "root1.cer"
.\taxcautl\certutil.exe -addstore -f -enterprise -user root "root2.cer"
ping -n 2 127.0.0.1
.\taxcautl\\certutil.exe -viewstore -enterprise root
goto end

:xpl
@echo ----------------------------------------
@echo 当前系统是:[ 高于WindowsXP的系统 ]
@echo ----------------------------------------
certutil.exe -addstore -f -enterprise -user root "01.taxca.p7b"
ping -n 2 127.0.0.1
certutil.exe -viewstore -enterprise root
goto end

:end
@echo ----------------------------------------
@echo 根证书安装完成!!

for /f "delims=" %%t in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer" /v Version') do set str=%%t
rem echo %str%
rem set vvv=%str:~-19%

@echo off
set "sstr=REG_SZ"
SET stemp=%str%&SET pos=0
:loop
SET /a pos+=1
echo %stemp%|FINDSTR /b /c:"%sstr%" >NUL
IF ERRORLEVEL 1 (
SET stemp=%stemp:~1%
IF DEFINED stemp GOTO loop
SET pos=0
)
@echo on
set /a regpos= %pos%+5
call set vvv=%%str:~%regpos%%%

@echo ----------------------------------------
mshta vbscript:msgbox("您的微软IE浏览器内部版本号为:%vvv%,请确认IE浏览器版本大于等于8.0,否则请升级IE版本后再使用本系统!",1,"IE版本号确认")(window.close)

由于chrome并不支持导入p7b文件,所以我们导入两个cer文件即可解决问题。

P7B 文件是一个安全证书文件,其中包含用于验证个人或设备的安全数字证书。与 .cer 证书文件类似,可以使用“安装证书”选项通过文件上的右键单击选项来安装 P7B 文件。 P7B 使用与 CER 文件格式不同的格式选项。它包含一个或多个使用 base64 (ASCII) 编码的 X.509 数字证书文件。 P7B 文件作为 ZIP 文件接收或从证书颁发机构接收。

解决问题

  1. 寻找设置页面

  1. 打开设置

  1. 选择“隐私与安全”

  1. 选择 “安全” 页面

  1. 选择“管理证书”

  1. 选择 “由您安装” 自定义证书


7. 导入 自定义证书

  1. 检查结果

打完收工,现在虽然还有SSL证书的错误提示,但已经可以正常查验发票了。