本文为看雪论坛精华文章
看雪论坛作者ID:Hacksign
一
背景
二
几个概念
三
再谈证书
Certificate ::= SEQUENCE {
tbsCertificate TBSCertificate,
signatureAlgorithm AlgorithmIdentifier,
signatureValue BIT STRING
}
tbsCertificate为上图中的蓝色部分
signatureValue为上图中的红色部分
signatureAlogrithm没有体现在上图中,此字段表示使用的是哪个哈希函数对tbsCertificate的数据进行的哈希计算
提取该证书的父证书(签发者或者叫Issuer)公钥
使用公钥解密子证书中的signatureValue部分,然后根据PKCS#9的结构,提取出哈希值1,此处记为Hash1
使用signatureAlgorithm中相同哈希算法对tbsCertificate数据做哈希,得到Hash2
如果Hash1与Hash2相等,则证书有效
DigiCert->DigiCert SHA2 Assured ID Code Singing CA->Python Software Foundation
>> openssl x509 -inform DER -in PythonParent.cer -pubkey -noout > PythonParentPublicKey.pem
>> cat PythonParentPublicKey.pem
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA+NOzHH8OEa9ndwfTCzFJ
Gc/Q+0WZsTrbRPV/5aid2zLXcep2nQUut4/6kkPApfmJ1DcZ17aq8JyGpdglrA55
KDp+6dFn08b7KSfH03sjlOSRI5aQd4L5oYQjZhJUM1B0sSgmuyRpwsJS8hRniolF
1C2ho+mILCCVrhxKhwjfDPXiTWAYvqrEsq5wMWYzcT6scKKrzn/pfMuSoeU7MRzP
6vIK5Fe7SrXpdOYr/mzLfnQ5Ng2Q7+S1TqSp6moKq4TzrGdOtcT3jNEgJSPrCGQ+
UpbB8g8S9MWOD8Gi6CxR93O8vYWxYoNzQYIH5DiLanMg0A9kczyen6Yzqf0Z3yWT
0QIDAQAB
-----END PUBLIC KEY-----
>> openssl x509 -inform DER -in ./Python.exe.cer -noout -text
Certificate:
Data:
Version: 3 (0x2)
Serial Number:
03:3e:d5:ed:a0:65:d1:b8:c9:1d:fc:f9:2a:6c:9b:d8
Signature Algorithm: sha256WithRSAEncryption
Issuer: C = US, O = DigiCert Inc, OU = www.digicert.com, CN = DigiCert SHA2 Assured ID Code Signing CA
Validity
Not Before: Dec 18 00:00:00 2018 GMT
Not After : Dec 22 12:00:00 2021 GMT
Subject: C = US, ST = New Hampshire, L = Wolfeboro, O = Python Software Foundation, CN = Python Software Foundation
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
RSA Public-Key: (4096 bit)
Modulus:
00:aa:bd:a4:4b:b2:75:b9:6e:e8:25:1c:65:b1:da:
c4:4c:08:ca:6a:b7:e8:1f:94:c8:f0:f5:92:4f:a6:
1b:db:13:e8:a0:fe:ef:1d:3e:22:69:55:f2:2f:92:
f3:7b:57:f9:dc:9c:3a:ed:2a:7e:bb:9d:b8:7c:95:
df:df:4a:87:56:21:16:c6:e9:b2:d9:15:86:d2:77:
22:53:67:7e:98:ca:b3:8e:56:80:59:26:4d:17:4b:
b8:45:cb:f2:0c:9a:24:11:5d:11:50:ea:88:e4:21:
b9:cc:f2:37:5b:db:90:e8:b8:94:93:71:c2:61:6e:
a4:a4:7d:7b:ec:0e:53:de:9c:3f:3e:8f:0e:f0:a1:
2b:24:69:f5:6a:76:aa:b4:82:02:ab:df:72:4b:1a:
cc:69:df:f6:84:f3:01:45:fe:8d:75:a8:7b:7f:b1:
cf:9f:58:24:49:24:c0:a1:e8:f2:ba:a1:79:87:e0:
74:a8:8e:3e:24:ae:7e:54:bb:f3:eb:9f:55:4d:b0:
16:26:c6:1a:92:4c:59:c5:55:98:a4:5b:f8:29:e4:
12:4b:0a:28:d0:3c:cc:be:61:11:b1:3c:cd:bd:50:
4c:5a:1b:bd:3a:b8:89:36:0f:90:7c:59:9f:f7:ac:
d5:4e:ef:77:71:9f:ab:ef:13:29:6d:7c:9f:20:e1:
8a:84:73:1a:46:e6:7c:8a:1b:96:23:1d:e0:23:d5:
87:0c:55:fa:7c:12:91:f3:e1:e5:85:d9:1a:88:11:
16:22:c5:d1:a3:2f:84:41:4c:8a:ef:35:2c:f8:5a:
8e:a3:6b:11:62:db:5b:b3:c3:13:17:d6:03:28:56:
70:c8:f8:e7:f5:69:fe:80:b1:9d:e4:d5:04:57:23:
6f:0f:d4:15:18:11:2d:37:bb:f1:f3:b6:dd:b8:95:
01:f0:5e:03:ca:51:2c:32:d6:53:7e:3c:3f:6a:ee:
80:98:e9:e6:9d:e2:b9:51:ca:92:26:ec:11:c9:96:
86:36:4e:f2:de:a8:f4:ea:eb:71:f8:74:d3:a8:78:
22:f7:be:54:a7:17:f2:af:00:2a:92:8b:e8:64:45:
81:55:2a:6f:92:ef:0f:56:19:01:5d:c2:e6:35:ee:
8c:10:79:45:89:a3:28:88:00:c0:78:a9:97:e5:11:
51:90:df:95:ae:66:06:4e:0e:33:6a:3c:5f:74:77:
88:63:c4:ef:2d:fe:3c:b5:37:e6:9d:02:5d:f7:c8:
1e:25:0b:ff:d3:53:54:cb:f1:71:bb:0a:80:b9:39:
1a:7b:3e:4d:97:52:f1:3f:40:a9:4c:78:60:87:33:
b8:15:10:f8:8a:d4:f6:c2:a4:e1:e2:3a:68:8f:0f:
50:66:7b
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Authority Key Identifier:
keyid:5A:C4:B9:7B:2A:0A:A3:A5:EA:71:03:C0:60:F9:2D:F6:65:75:0E:58
X509v3 Subject Key Identifier:
FC:2A:BF:7E:D4:BE:AC:F3:82:9C:A4:CF:7B:22:01:3B:B8:8F:07:F2
X509v3 Key Usage: critical
Digital Signature
X509v3 Extended Key Usage:
Code Signing
X509v3 CRL Distribution Points:
Full Name:
URI:http://crl3.digicert.com/sha2-assured-cs-g1.crl
Full Name:
URI:http://crl4.digicert.com/sha2-assured-cs-g1.crl
X509v3 Certificate Policies:
Policy: 2.16.840.1.114412.3.1
CPS: https://www.digicert.com/CPS
Policy: 2.23.140.1.4.1
Authority Information Access:
OCSP - URI:http://ocsp.digicert.com
CA Issuers - URI:http://cacerts.digicert.com/DigiCertSHA2AssuredIDCodeSigningCA.crt
X509v3 Basic Constraints: critical
CA:FALSE
Signature Algorithm: sha256WithRSAEncryption
4b:75:a1:2d:b5:5f:46:b1:89:a7:cf:8f:26:3e:be:56:2a:8d:
62:ae:52:ef:d8:16:e6:16:20:4a:ba:89:14:5a:15:a6:cd:0e:
18:fd:44:11:50:17:f6:89:88:4e:66:b2:b4:04:39:f0:03:eb:
fe:a0:55:21:fd:d6:56:56:06:a8:3a:34:47:86:f5:3f:52:5d:
b8:80:3e:f2:7d:08:45:85:b1:d9:17:52:b8:db:5a:1b:c2:9e:
e6:7b:92:a5:2e:53:90:40:ba:62:35:41:16:e9:62:06:4b:dd:
40:3e:89:95:e4:9a:36:c6:87:59:67:f2:b5:21:58:8c:5b:05:
82:f8:4a:0d:a7:aa:90:78:e2:9e:c2:50:56:24:3e:3f:cc:6f:
05:36:82:f0:55:da:95:e3:8f:95:9a:b2:4a:19:b6:c0:02:32:
fe:60:e3:60:4d:a1:52:e8:44:08:be:7a:fe:ac:d3:b3:ce:b7:
e2:6d:1d:12:26:f3:b9:53:ca:e7:3c:c2:1d:2c:c1:33:d4:c2:
4b:0a:6c:b5:35:65:d8:fd:0a:9a:ad:cd:79:ee:54:4d:30:e7:
47:b1:26:f4:52:2b:75:6d:e2:0f:b4:be:28:29:23:7a:8f:98:
37:69:91:ff:7e:e0:cb:f2:d1:73:0d:72:aa:ed:87:0d:b4:47:
e3:e4:22:53
>> hexdump -C PythonExeSignatureValue.bin
00000000 4b 75 a1 2d b5 5f 46 b1 89 a7 cf 8f 26 3e be 56 |Ku.-._F.....&>.V|
00000010 2a 8d 62 ae 52 ef d8 16 e6 16 20 4a ba 89 14 5a |*.b.R..... J...Z|
00000020 15 a6 cd 0e 18 fd 44 11 50 17 f6 89 88 4e 66 b2 |......D.P....Nf.|
00000030 b4 04 39 f0 03 eb fe a0 55 21 fd d6 56 56 06 a8 |..9.....U!..VV..|
00000040 3a 34 47 86 f5 3f 52 5d b8 80 3e f2 7d 08 45 85 |:4G..?R]..>.}.E.|
00000050 b1 d9 17 52 b8 db 5a 1b c2 9e e6 7b 92 a5 2e 53 |...R..Z....{...S|
00000060 90 40 ba 62 35 41 16 e9 62 06 4b dd 40 3e 89 95 |[email protected]@>..|
00000070 e4 9a 36 c6 87 59 67 f2 b5 21 58 8c 5b 05 82 f8 |..6..Yg..!X.[...|
00000080 4a 0d a7 aa 90 78 e2 9e c2 50 56 24 3e 3f cc 6f |J....x...PV$>?.o|
00000090 05 36 82 f0 55 da 95 e3 8f 95 9a b2 4a 19 b6 c0 |.6..U.......J...|
000000a0 02 32 fe 60 e3 60 4d a1 52 e8 44 08 be 7a fe ac |.2.`.`M.R.D..z..|
000000b0 d3 b3 ce b7 e2 6d 1d 12 26 f3 b9 53 ca e7 3c c2 |.....m..&..S..<.|
000000c0 1d 2c c1 33 d4 c2 4b 0a 6c b5 35 65 d8 fd 0a 9a |.,.3..K.l.5e....|
000000d0 ad cd 79 ee 54 4d 30 e7 47 b1 26 f4 52 2b 75 6d |..y.TM0.G.&.R+um|
000000e0 e2 0f b4 be 28 29 23 7a 8f 98 37 69 91 ff 7e e0 |....()#z..7i..~.|
000000f0 cb f2 d1 73 0d 72 aa ed 87 0d b4 47 e3 e4 22 53 |...s.r.....G.."S|
00000100
>> openssl rsautl -inkey PythonParentPublicKey.pem -pubin -in PythonExeSignatureValue.bin >PythonExeSignatureValueDecrypted.bin
>> hexdump -CPythonExeSignatureValueDecrypted.bin
00000000 30 31 30 0d 06 09 60 86 48 01 65 03 04 02 01 05 |010...`.H.e.....|
00000010 00 04 20 ca 1c 82 f3 fd 76 74 30 54 39 09 8d 87 |.. .....vt0T9...|
00000020 95 4f e2 af b4 a0 64 24 bf 49 2f 27 34 61 46 2e |.O....d$.I/'4aF.|
00000030 ea d7 33 |..3|
00000033
>> openssl asn1parse -i -inform DER -in PythonExeSignatureDecrypted.bin
0:d=0 hl=2 l= 49 cons: SEQUENCE
2:d=1 hl=2 l= 13 cons: SEQUENCE
4:d=2 hl=2 l= 9 prim: OBJECT :sha256
15:d=2 hl=2 l= 0 prim: NULL
17:d=1 hl=2 l= 32 prim: OCTET STRING [HEX DUMP]:CA1C82F3FD7674305439098D87954FE2AFB4A06424BF492F273461462EEAD733
>> openssl asn1parse -i -inform DER -in Python.exe.cer
0:d=0 hl=4 l=1607 cons: SEQUENCE
4:d=1 hl=4 l=1327 cons: SEQUENCE
.......
1335:d=1 hl=2 l= 13 cons: SEQUENCE
1337:d=2 hl=2 l= 9 prim: OBJECT :sha256WithRSAEncryption
1348:d=2 hl=2 l= 0 prim: NULL
1350:d=1 hl=4 l= 257 prim: BIT STRING
>> dd if=./Python.exe.cer of=./PythonExetbsCertificate.bin skip=4 bs=1 count=1331
输入了 1331+0 块记录
输出了 1331+0 块记录
1331 字节 (1.3 kB, 1.3 KiB) 已复制,0.018058 s,73.7 kB/s
>> sha256sum PythonExetbsCertificate.bin
ca1c82f3fd7674305439098d87954fe2afb4a06424bf492f273461462eead733 PythonExetbsCertificate.bin
回顾一下上面我们干了什么。
从信任证书 DigiCert SHA2 Assured ID Code Singing CA 中提取了此证书的公钥
使用这个公钥解密了Python.exe证书中的signatureValue部分,得到第一个sha256值
提取Python.exe证书的tbsCertificate部分数据,并对提取的数据做sha256运算,得到第二个sha256值
第一个sha256值与第二个sha256相等
四
PE文件AuthentiCode
typedef struct _WIN_CERTIFICATE
{
DWORD dwLength;
WORD wRevision;
WORD wCertificateType;
BYTE bCertificate[ANYSIZE_ARRAY];
} WIN_CERTIFICATE, *LPWIN_CERTIFICATE;
>> dd if=./python.exe of=./PythonPkcs7Data.bin skip=93704 bs=1 count=6664
输入了 6664+0 块记录
输出了 6664+0 块记录
6664 字节 (6.7 kB, 6.5 KiB) 已复制,0.0351038 s,190 kB/s
SignedData ::= SEQUENCE {
version Version,
digestAlgorithms DigestAlgorithmIdentifiers,
contentInfo ContentInfo,
certificates
[0] IMPLICIT ExtendedCertificatesAndCertificates
OPTIONAL,
Crls
[1] IMPLICIT CertificateRevocationLists OPTIONAL,
signerInfos SignerInfos
}
DigestAlgorithmIdentifiers ::=
SET OF DigestAlgorithmIdentifier
ContentInfo ::= SEQUENCE {
contentType ContentType,
content
[0] EXPLICIT ANY DEFINED BY contentType OPTIONAL
}
ContentType ::= OBJECT IDENTIFIER
SignerInfos ::= SET OF SignerInfo
SignerInfo ::= SEQUENCE {
version Version,
issuerAndSerialNumber IssuerAndSerialNumber,
digestAlgorithm DigestAlgorithmIdentifier,
authenticatedAttributes
[0] IMPLICIT Attributes OPTIONAL,
digestEncryptionAlgorithm
DigestEncryptionAlgorithmIdentifier,
encryptedDigest EncryptedDigest,
unauthenticatedAttributes
[1] IMPLICIT Attributes OPTIONAL
}
IssuerAndSerialNumber ::= SEQUENCE {
issuer Name,
serialNumber CertificateSerialNumber
}
EncryptedDigest ::= OCTET STRING
// 提取Python.exe公钥到PythonExePublicKey.pem文件中
>> openssl x509 -in Python.exe.cer -inform DER -noout -pubkey > PythonExePublicKey.pem
// Dump出来的SignedData.singerInfo.encryptDigest数据
>> hexdump -C PythonPkcs7Encrypted.bin
00000000 12 37 05 82 c9 7f 73 e9 fc ff d0 71 78 f8 50 04 |.7....s....qx.P.|
00000010 18 c4 2d ae 0b 4f da 5f 6a db 88 79 44 bc 80 cd |..-..O._j..yD...|
00000020 9d 8d 86 51 48 5d 83 38 d2 1f 5d 60 ed a6 09 6e |...QH].8..]`...n|
00000030 61 1d 55 e6 0b df ab 34 01 21 e1 c3 17 5d 2f d7 |a.U....4.!...]/.|
00000040 f6 e0 cd 18 1b 88 bb c9 f9 0f 2e b9 3b ea 34 28 |............;.4(|
00000050 0e 4d 99 01 1b 33 66 59 d4 dd fa e0 4a 81 36 35 |.M...3fY....J.65|
00000060 8f 6d b1 9e 76 f7 eb c9 5a 31 a4 0f 4f 32 28 be |.m..v...Z1..O2(.|
00000070 a7 d9 7a 01 c9 d7 fa 22 06 10 76 06 55 57 42 ce |..z...."..v.UWB.|
00000080 f5 9c 7e 36 ff 24 cc 0f 5d d1 b2 00 d2 e6 da 47 |..~6.$..]......G|
00000090 03 c0 06 f1 41 cb 2a f3 7f cc 69 1c f1 ea 53 de |....A.*...i...S.|
000000a0 ab ca 25 a3 db 53 6e 0e 06 ff 37 b6 71 a9 5b 6b |..%..Sn...7.q.[k|
000000b0 85 d8 d7 b0 19 4e 1f 56 a2 5f b9 4c c4 4a 1b 18 |.....N.V._.L.J..|
000000c0 4f 30 86 95 90 e6 b9 23 6d 74 9e 76 d3 7e 5f ad |O0.....#mt.v.~_.|
000000d0 20 8e ae 02 d6 32 f3 a7 be ba 00 6a 30 90 8d e4 | ....2.....j0...|
000000e0 83 d5 02 bb 19 e6 eb 62 a0 55 c9 4b 93 59 3b 12 |.......b.U.K.Y;.|
000000f0 51 ef 7e 50 b3 f3 0b 50 3c e5 01 9a ef 6a 9a 9b |Q.~P...P<....j..|
00000100 1a 2b a4 ef 79 47 09 1a d8 48 28 e8 2c 52 3e 29 |.+..yG...H(.,R>)|
00000110 ad 31 05 2b 24 e6 11 e1 c0 bb 11 1d d0 0f e0 78 |.1.+$..........x|
00000120 89 cf dc 85 e5 52 21 1c 43 69 b5 40 17 dc 08 98 |[email protected]|
00000130 8e fe d6 36 d4 6b ce ef 24 06 34 09 eb 7f 1b 9d |...6.k..$.4.....|
00000140 24 04 e2 e6 cb de b9 6d 14 70 3a b2 50 82 f9 83 |$......m.p:.P...|
00000150 37 b8 b8 ee 70 08 ce 6e 94 53 0e c4 0a 8b 5b d9 |7...p..n.S....[.|
00000160 98 b5 54 2f 94 bd 46 20 9f a7 38 02 86 ef d8 b5 |..T/..F ..8.....|
00000170 64 a2 ea 2f 0b 79 fb d3 e0 5c a3 83 8f 94 54 56 |d../.y...\....TV|
00000180 51 16 06 f7 fe ba 93 e2 b2 7d 08 74 08 a8 55 84 |Q........}.t..U.|
00000190 11 09 7d 74 4b 6b 48 2f 4f 98 4b dd 19 5d f2 db |..}tKkH/O.K..]..|
000001a0 18 40 d9 d1 a7 52 c3 35 7e 9a 5e d5 72 62 f2 64 |[email protected]~.^.rb.d|
000001b0 f4 cd 3f 70 d6 de e8 27 a8 cd 06 30 40 58 80 31 |..?p...'[email protected]|
000001c0 6a 44 7b 22 bd 4f 1b d0 1d 9e a5 b1 26 60 d5 e4 |jD{".O......&`..|
000001d0 10 8e c5 67 4d 1d d2 51 b0 29 bb f5 f2 0f 24 e6 |...gM..Q.)....$.|
000001e0 96 49 36 99 01 e2 56 aa 32 5f 13 c9 bd a0 2c dd |.I6...V.2_....,.|
000001f0 06 db dc ae ee ca 28 9e 0c e8 98 68 2d e8 d0 a8 |......(....h-...|
00000200
// 使用PythonExePulbicKey.pem公钥解密PythonPkcs7Encrypted.bin数据到PythonPkcs7Decrypted.bin文件中
>> openssl rsautl -inkey PythonExePublicKey.pem -pubin -in PythonPkcs7Encrypted.bin > PythonPkcs7Decrypted.bin
// 解析解密后的PKCS#9数据(ASN1语法描述)
>> openssl asn1parse -i -inform DER -in PythonPkcs7Decrypted.bin
0:d=0 hl=2 l= 49 cons: SEQUENCE
2:d=1 hl=2 l= 13 cons: SEQUENCE
4:d=2 hl=2 l= 9 prim: OBJECT :sha256
15:d=2 hl=2 l= 0 prim: NULL
17:d=1 hl=2 l= 32 prim: OCTET STRING [HEX DUMP]:B300E437486CB53B647A9C1A84B2986502254681C688020158504646776C31E1
>> hexdump -C PythonExeContentInfo.bin
00000000 30 17 06 0a 2b 06 01 04 01 82 37 02 01 0f 30 09 |0...+.....7...0.|
00000010 03 01 00 a0 04 a2 02 80 00 30 31 30 0d 06 09 60 |.........010...`|
00000020 86 48 01 65 03 04 02 01 05 00 04 20 5a 3a d4 3d |.H.e....... Z:.=|
00000030 81 d5 6a 86 d9 7b 24 b3 74 da 49 44 aa ee 94 c7 |..j..{$.t.ID....|
00000040 10 e3 77 25 4c fe 8e cc 72 04 06 6a |..w%L...r..j|
0000004c
>> sha256sum PythonExeContentInfo.bin
b5e4b32d6ebae47869646ccf93416b320a113b2d35d948e7e2a9122146cb9634 PythonContentInfo.bin
// 注意第一个字节已经被替换成0x31
>> hexdump -C PythonExeAttrubite.bin
00000000 31 81 98 30 19 06 09 2a 86 48 86 f7 0d 01 09 03 |1..0...*.H......|
00000010 31 0c 06 0a 2b 06 01 04 01 82 37 02 01 04 30 1c |1...+.....7...0.|
00000020 06 0a 2b 06 01 04 01 82 37 02 01 0b 31 0e 30 0c |..+.....7...1.0.|
00000030 06 0a 2b 06 01 04 01 82 37 02 01 15 30 2c 06 0a |..+.....7...0,..|
00000040 2b 06 01 04 01 82 37 02 01 0c 31 1e 30 1c a0 1a |+.....7...1.0...|
00000050 80 18 00 50 00 79 00 74 00 68 00 6f 00 6e 00 20 |...P.y.t.h.o.n. |
00000060 00 33 00 2e 00 38 00 2e 00 36 30 2f 06 09 2a 86 |.3...8...60/..*.|
00000070 48 86 f7 0d 01 09 04 31 22 04 20 b5 e4 b3 2d 6e |H......1". ...-n|
00000080 ba e4 78 69 64 6c cf 93 41 6b 32 0a 11 3b 2d 35 |..xidl..Ak2..;-5|
00000090 d9 48 e7 e2 a9 12 21 46 cb 96 34 |.H....!F..4|
0000009b
[email protected] [11:02:59] : ~/Work/虚拟机共享目录/Certificate/python
>> sha256sum PythonExeAttrubite.bin
b300e437486cb53b647a9c1a84b2986502254681c688020158504646776c31e1 PythonExeAttrubite.bin
五
AuthentiCode哈希
验证数据真实有效
提取数据中的内容
回到第一步,直到验证结束
首先用Python.exe父证书的公钥解密了Python.exe证书的signatureValue部分,得到了第一个哈希值:CA1C82F3FD7674305439098D87954FE2AFB4A06424BF492F273461462EEAD733,该值和Python.exe证书的tbsCertificate部分数据计算的sha256相等,因此tbsCertificate部分的消息未经篡改、可以信任。
tbsCertificate部分的数据, 包含Python.exe开发者的公钥,然后我们使用Python.exe开发者公钥解密了SingedData.SingerInfo.encryptedDigest部分数据,此时得到了第二个哈希值:B300E437486CB53B647A9C1A84B2986502254681C688020158504646776C31E1
使用相同的哈喜算法,计算SignedData.SingerInfo.authenticatedAttributes字段的哈希值,发现此哈希值和第二步中得到的哈希值二相等。经过进一步查看authenticatedAttributes中的数据发现第三个哈希值:b5e4b32d6ebae47869646ccf93416b320a113b2d35d948e7e2a9122146cb9634
使用相同的算法计算SignedData.contentInfo.content哈希值,发现其和第三步之中的哈希三相等。查看SignedData.contentInfo.content的内容,发现第四个哈希值:5A3AD43D81D56A86D97B24B374DA4944AAEE94C710E377254CFE8ECC7204066A
使用微软描述的方法计算Python.exe的AuthentiCode,发现此值和上面第四步中的哈希相等。
六
伸手党福利
ASN.1格式学习
ASN.1维基百科
ASN.1 DER 格式編碼與解碼
PKCS#7
PE文件结构
Windows Authenticode Portable Executable Signature Format
PE文件中的数字签名信息
PE文件逆向之数字签名详细解析
开源的AuthentiCode计算器
手工验证一张数字证书的有效性
Authenticode签名对未签名代码的应用
看雪ID:Hacksign
https://bbs.pediy.com/user-home-156241.htm
# 往期推荐
球分享
球点赞
球在看
点击“阅读原文”,了解更多!