This project was sourced from ELFsign with fixes to get it to build again, and a cgo binding added.
This project is used to sign ELF files and store the signature in a new section.
mkdir build
cd build
cmake ..
makeYou can sign and verify ELF files, and execute them after verification:
USAGE: ./ELFSign [options] file...
Options:
-c, --check Check ELF file and execute it
-X, --check-X509 Check ELF file with X509 and execute it
-s, --sign Sign a ELF file
-a, --argument Set arguments of ELF file to execute
-g, --generate Generate public and private key pair
-x, --create-X509 Generate X509 certificate
-p, --path Set the path of public/private key
-e, --elf Set the path of ELF file
Example:
./ELFSign --sign -p ./prikey.pem -e hello.out
./ELFSign -c -p ./pubkey.pem -e hello.out
./ELFSign -X -p ./ELFSign.pem -e /usr/bin/cat -a a.txt
This project has a Go binding that can be used to sign and verify ELF files in your Go code.
To use the Go binding, you need to install the project and then import it in your Go code.
go get github.com/pi-apps-go/elfsignExample:
package main
import (
"github.com/pi-apps-go/elfsign"
)
func main() {
signer := elfsign.NewELFSign()
signer.Sign("hello.out", "prikey.pem")
signer.Verify("hello.out", "pubkey.pem")
signer.Execute("hello.out")
}An example of the Go binding can also be found in the example directory.
A further explanation of the Go binding can be found in the README_GO_BINDINGS.md file.