本篇讲解如何使用CmAct私钥来解析RAU和DYN文件
本来,我也想用RAU文件作为例子的,但是RAU文件对应的wbc文件还差一个系统特征没有对上,导致我没有办法获得CmAct证书的私钥,也就没有办法去解析RAU文件。
实际的机器也不在我手上,没有办法通过调试来查找原因,所以先用DYN文件作为例子,这个问题有空再解决。
DYN文件最容易获得,所以本文将以DYN文件为例。
DYN文件在每次导入LIC文件时都会产生一份新的,所以可以在虚拟机环境下也可以获取。
DYN文件和RAU文件的结构类似,所以解析DYN文件的过程同样能用于RAU文件。
本节从头演示在虚拟机中导入LIF、生成wbc和DYN文件、获取私钥的过程:
当前环境一览:
如果在虚拟机里导入LIF,则最好清除一遍中间文件,这样不会把新生成的中间文件和之前的弄混。
注意,如果在实体机上操作,不要清除中间文件,否则你的之前授权将无法正常工作。
备份好wbc文件后,就可以尝试获取私钥。
在test.py中填入wbc路径,然后运行即可,完整代码见github。
wbc.py将尝试获取系统特征并与item节匹配,一旦wbc文件里的所有item节匹配成功,则可以输出私钥。
CmAct证书的私钥可以通过Q=dG来验证其有效性,其中Q为公钥,G为基点。
验证可以使用wibu_asn1.py的check_CmAct_key函数,但使用check_CmAct_key函数之前,需要调用解析rac_proc函数来处理RAC文件,rac_proc会解析RAC文件中的所有证书并添加到证书链中。
以下代码首先解析了RAC文件并将结果打印出来,接着调用check_CmAct_key函数来验证私钥是否与CmAct证书对应。
现在已经获得CmAct密钥并且验证了其正确性。
DYN文件是一段envelope数据,满足PKCS#7的标准。
其中contentEncryptionAlgorithm为2.16.840.1.101.3.4.1.2,这表示接下来的encryptedContent是一段aes128-CBC加密的数据。
而aes的密钥则使用CmAct证书的公钥加密并存放于encryptedKey中,解密需要用到CmAct证书的私钥。
更加具体的过程见wibu_asn1.py的dyn_proc函数。
实际上,直接调用dyn_proc函数并传入私钥即可解密DYN文件(RAU文件同理),效果如下:
实际上,DYN文件并不大,所以解析后感兴趣的数据并不是特别多。
也许RAU文件中的有用的数据会更多,存在条件的读者可以尝试解析一下RAU文件,本人也很好奇RAU文件的内容是怎么样的?
> uname
-
a
Linux ubuntu
5.4
.
0
-
132
-
generic
> cmu
-
v
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
Operating System:
Name: Ubuntu
18.04
.
6
LTS (Kernel
5.4
.
0
-
132
-
generic)
Architecture: x86_64
Current system user:
username: mjs
domain:
RunTime version information:
cmu:
6.60
.
2869.500
2017
-
12
-
18
CodeMeter
-
Service:
6.60
.
2869.500
2017
-
12
-
18
CodeMeterAct:
6.60
.
2869.500
2017
-
12
-
18
Library:
6.60
.
2869.500
2017
-
12
-
18
Installed
file
version information:
CodeMeter
-
Service:
6.60
.
2869.500
2017
-
12
-
18
(
64bit
)
CodeMeterCC:
6.60
.
2869.500
2017
-
12
-
18
(
64bit
)
codemeter
-
info:
6.60
.
2869.500
2017
-
12
-
18
(
64bit
)
cmu:
6.60
.
2869.500
2017
-
12
-
18
(
64bit
)
CM Lib (
/
usr
/
lib
/
i386
-
linux
-
gnu):
6.60
.
2869.500
2017
-
12
-
18
(
32bit
)
CM Lib (
/
usr
/
lib
/
x86_64
-
linux
-
gnu):
6.60
.
2869.500
2017
-
12
-
18
(
64bit
)
Note on libusb program library used on Linux
-
operating systems by
CodeMeter License Server:
The programming library serves to read
and
write USB devices. The code
is
licensed under the GNU Lesser General Public License (LGPL) Version
2.1
.
Call cmu
-
-
licensing
-
terms to view it.
The code of the programming library libusb can be downloaded at the project
website http:
/
/
www.libusb.org
/
. On request the source can also be electronically
obtained free of charge contacting Wibu
-
Systems (support@wibu.com).
> uname
-
a
Linux ubuntu
5.4
.
0
-
132
-
generic
> cmu
-
v
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
Operating System:
Name: Ubuntu
18.04
.
6
LTS (Kernel
5.4
.
0
-
132
-
generic)
Architecture: x86_64
Current system user:
username: mjs
domain:
RunTime version information:
cmu:
6.60
.
2869.500
2017
-
12
-
18
CodeMeter
-
Service:
6.60
.
2869.500
2017
-
12
-
18
CodeMeterAct:
6.60
.
2869.500
2017
-
12
-
18
Library:
6.60
.
2869.500
2017
-
12
-
18
Installed
file
version information:
CodeMeter
-
Service:
6.60
.
2869.500
2017
-
12
-
18
(
64bit
)
CodeMeterCC:
6.60
.
2869.500
2017
-
12
-
18
(
64bit
)
codemeter
-
info:
6.60
.
2869.500
2017
-
12
-
18
(
64bit
)
cmu:
6.60
.
2869.500
2017
-
12
-
18
(
64bit
)
CM Lib (
/
usr
/
lib
/
i386
-
linux
-
gnu):
6.60
.
2869.500
2017
-
12
-
18
(
32bit
)
CM Lib (
/
usr
/
lib
/
x86_64
-
linux
-
gnu):
6.60
.
2869.500
2017
-
12
-
18
(
64bit
)
Note on libusb program library used on Linux
-
operating systems by
CodeMeter License Server:
The programming library serves to read
and
write USB devices. The code
is
licensed under the GNU Lesser General Public License (LGPL) Version
2.1
.
Call cmu
-
-
licensing
-
terms to view it.
The code of the programming library libusb can be downloaded at the project
website http:
/
/
www.libusb.org
/
. On request the source can also be electronically
obtained free of charge contacting Wibu
-
Systems (support@wibu.com).
> sudo rm
/
var
/
lib
/
CodeMeter
/
CmAct
/
*
-
f
> cmu
-
i
-
f dji_aeroscope_pro.WibuCmLIF
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
The
file
contains
1
Update:
CmActLtLicense binding information: FirmCode
6000316
Execute Update ...
The
file
contains
1
Update:
CmActLtLicense update: Serial number
130
-
1021612743
, FirmCode
6000316.
-
-
> successful
1
successful update done
> cmu
-
c
6000316
-
s130
-
1021612743
-
f update
-
130
-
1021612743.WibuCmRaC
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
Write CmFAS
for
130
-
1021612743
for
FirmItem
6000316
> cp
/
var
/
lib
/
CodeMeter
/
CmAct .
-
r
> sudo rm
/
var
/
lib
/
CodeMeter
/
CmAct
/
*
-
f
> cmu
-
i
-
f dji_aeroscope_pro.WibuCmLIF
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
The
file
contains
1
Update:
CmActLtLicense binding information: FirmCode
6000316
Execute Update ...
The
file
contains
1
Update:
CmActLtLicense update: Serial number
130
-
1021612743
, FirmCode
6000316.
-
-
> successful
1
successful update done
> cmu
-
c
6000316
-
s130
-
1021612743
-
f update
-
130
-
1021612743.WibuCmRaC
cmu
-
CodeMeter Universal Support Tool.
Version
6.60
of
2017
-
Dec
-
18
(Build
2869
)
for
Linux
Copyright (C)
2007
-
2017
by WIBU
-
SYSTEMS AG.
All
rights reserved.
Write CmFAS
for
130
-
1021612743
for
FirmItem
6000316
> cp
/
var
/
lib
/
CodeMeter
/
CmAct .
-
r
> python test.py
code_5001 check ok, match item_10
code_5003 check ok, match item_9
code_6001 check ok, match item_0
code_6101 check ok, match item_2
code_6103 check ok, match item_7
code_6104 check faild,
not
match
any
item
code_6105 check ok, match item_4
code_6106 check ok, match item_5
code_6107 check ok, match item_6
code_6108 check ok, match item_3
code_6109 check ok, match item_8
code_6110 check ok, match item_1
code_8001 check ok, match item_11
code_200001 check faild,
not
match
any
item
code_200002 check faild,
not
match
any
item
code_200003 check faild,
not
match
any
item
wbc
id
count:
12
system featue count:
16
system featue ok:
12
all
wbc item check ok
part1:
2295bf3c4cdbb01a457c2955d514637074c771d7b638dbadb22a1b4a3d1a9782e661e8819f3c98945e91d7022254fc447689be8c833f732b338498e5351b32
part2:
64742897b75b86aa15e282b0b2585b7c33a11c5fc8749601d864adad327db4
part3:
None
private_key: d9352ca798fde876a6c093e60bb39870ddb10e722276ab78eea3cc40
> python test.py
code_5001 check ok, match item_10
code_5003 check ok, match item_9
code_6001 check ok, match item_0
code_6101 check ok, match item_2
code_6103 check ok, match item_7
code_6104 check faild,
not
match
any
item
code_6105 check ok, match item_4
code_6106 check ok, match item_5
code_6107 check ok, match item_6
code_6108 check ok, match item_3
code_6109 check ok, match item_8
code_6110 check ok, match item_1
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)