0
$\begingroup$

Some devices (for example Android devices) are "locked", the bootloader checks following bootloader/software sign, right? Chain of trust. Signing technically means that the file must be encrypt with one (private) key and decrypted with another (public) key.

The software is compiled to executable binary and if we then sign/encrypt it, it's a mess (not machine code); so how hardware can execute it after verifying the sign?

How an executable binary can be signed and working machine code at the same time?

$\endgroup$
3
  • 1
    $\begingroup$ Signing does not imply encryption. Signing is based on a hash code, which allows to check that the file has not been modified. $\endgroup$
    – user16034
    Commented Feb 8, 2023 at 8:17
  • $\begingroup$ @YvesDaoust Check: en.wikipedia.org/wiki/Digital_signature, en.wikipedia.org/wiki/Digital_signature#/media/… $\endgroup$
    – anony33258
    Commented Feb 8, 2023 at 13:46
  • 1
    $\begingroup$ @anony33258 look at the caption below the picture you linked. Pay attention to the word "appending" and to the box depicting the signed message. $\endgroup$ Commented Feb 8, 2023 at 16:22

1 Answer 1

1
$\begingroup$

Let's start with a simple approach: Stored on your hard drive is a 1 to 1 image of an executable file. Your operating system allocates space for the executable file, reads it from the hard drive, and transfers control to the address where the executable file should start execution. That works just fine.

Now we can make it more complicated: When we create the executable file on the hard drive, compiler and linker create an image of the executable file, then they compress the executable file, then they encrypt it with your public key, then create a checksum using their private key. No loading the executable file into memory is just slightly more difficult:

Your operating system reads what is on the hard drive. Then it uses the compilers public key to check if the checksum is correct. If it is correct, then the operating system knows that only the genuine compiler could have created the checksum, so the data is genuine and not forged by a hacker.

Then the data is decrypted using your private key. This will only work if the compiler used your public key to encrypt the data. So if a hacker manages to get a copy of the encrypted data, they cannot decrypt it without your private key. So the compiler is now sure that the executable file didn't fall into the wrong hands.

Next the data is decompressed - that's only done to save time to transmit the executable. There are actually computers where reading say 1MB of data and decompressing it to 2MB is both faster, and saves space on your hard drive. That's the reason for this step, to save some space.

Well, and at that point the data is in RAM and execution can start, just as before. The only difference with the three steps (compression, encryption, checksum) is that we save some space and possibly time due to the compression, that the compiler knows the code didn't go to some hacker, and that your computer knows it wasn't a hacker producing the code.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.