Skip to content

Commit 0cee114

Browse files
committed
Add missing SHA384 and SHA512 OID constants
Fix ruff linting errors by adding the missing OID constants: - OID_SHA384_DER and OID_SHA384_STRING for SHA-384 hash algorithm - OID_SHA512_DER and OID_SHA512_STRING for SHA-512 hash algorithm These constants are referenced in the hash extraction logic but were not defined.
1 parent 91c807c commit 0cee114

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

scripts/authenticode_transplant.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,14 @@ def _extract_pe_hash_from_spc_indirect_data(content_bytes: bytes) -> Tuple[Optio
135135
# Format: [0x06 (OID tag), length, OID bytes...]
136136
OID_SHA1_DER = b'\x06\x05\x2b\x0e\x03\x02\x1a' # 1.3.14.3.2.26
137137
OID_SHA256_DER = b'\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x01' # 2.16.840.1.101.3.4.2.1
138+
OID_SHA384_DER = b'\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x02' # 2.16.840.1.101.3.4.2.2
139+
OID_SHA512_DER = b'\x06\x09\x60\x86\x48\x01\x65\x03\x04\x02\x03' # 2.16.840.1.101.3.4.2.3
138140

139141
# String representations of OIDs
140142
OID_SHA1_STRING = '1.3.14.3.2.26'
141143
OID_SHA256_STRING = '2.16.840.1.101.3.4.2.1'
144+
OID_SHA384_STRING = '2.16.840.1.101.3.4.2.2'
145+
OID_SHA512_STRING = '2.16.840.1.101.3.4.2.3'
142146

143147
# Search parameters
144148
OID_SEARCH_WINDOW = 50 # Bytes to search before hash for algorithm OID

0 commit comments

Comments
 (0)