Question

I want to verify the digital signature of any PE file (exe, dll) in Java. So, I need to find the public key and the signature of these files. Can you please help ?!

Was it helpful?

Solution

There's a good discussion here, which will be easier to understand if you have a background on the PE file format (there's a good intro here) but to summarise:

  • There's a pointer at offset 24 in the file header to the PE header
  • The PE header is 116 bytes long and is immediately followed by the data directory
  • There's a pointer at offset 32 of the data directory to the start of the security data
  • The security data is an array of resource objects, each of which contains an ASN.1 encoded certificate
  • The resource object consists of a length field (4 bytes), a version number (2 bytes), a certificate type field (2 bytes), then the raw data of the certificate
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top