📄 readme
字号:
-------------------------------------------------------------------------------boot_auth README-------------------------------------------------------------------------------boot_auth is a utility for verifying the authenticity of a file. To ensure the trust of a file the following procedure is done:1) calculate SHA1 hash of the file2) sign the hash using a private RSA key3) the signed hash is then distributed with the fileboot_auth uses a public key to decrypt the signed hash and view the raw signature. Independantly at runtime boot_auth calculates the signature of a requested file, then compares the signed hash to the calculated hash. If these match, the file is authentic if not the file is a forgery.Signatures are generated with openssl, using an rsa public/private keypair. boot_auth ONLY SUPPORTS 2048 bit keys.Generating a 2048 bit rsa key pair can be done with the following command: # openssl genrsa 2048 > mykey.pem Note that boot_auth uses 65537 as the public exponent. Not specifying any arguments to openssl regarding the public exponent causes openssl to use 65537 by default.To sign a docmuent with that key, run openssl with the following arguments: # openssl dgst -sha1 -binary -sign mykey.pem < myfile > myfile.sigThe resulting file should be 256 bytes in length: # wc -c myfile.sig 256 myfile.sigboot_auth requires the above signature at runtime, as well as the public key to authenticate it with. The public key must be extracted from the PEM format file in little endian byte order, use the following bash script to convert hex values in big endian, to binary little endian:#!/bin/bash# NOTE: this converts to little endian binary from big endian hexX=$1# if odd pad left with one zeroif [ $[${#X}%2] != 0 ]; then X=0$X; fi#S=${#X}while [ $S != 0 ]; do Y=${X:$[S-2]:2} printf "\x$Y" S=$[S-2]doneThen extract your key with the following command: # openssl asn1parse <mykey.pem | head -n 3 | tail -n 1 | cut -d':' -f4 | xargs tobin.sh > mykey.pubThe key is then passed to boot_auth: # boot_auth -p mykey.pub -s myfile.sig /dev/mtd/block/2If the file is authentic, the return code will be 0. If the file is not authentic or the program encounters any other error it will return a non-zero number. For full usage arguments run boot_auth with the -h flag: # boot_auth -hUse this in an init script or any other shell script to authenticate a file.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -