Debian Codegraph @

tools/signedconfig/verify_b64.sh

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2
3 # Script to verify signatures, with both signature & data given in b64
4 # Args:
5 # 1. data (base64 encoded)
6 # 2. signature (base64 encoded)
7 # The arg values can be taken from the debug log for SignedConfigService when verbose logging is
8 # enabled.
9
10 function verifyscip-shell shell android-platform-frameworks-base 1:14~beta1-5 verify().() {
11 D=${1}
12 S=${2}
13 K=${3}
14 echoscip-shell system . . echo. Trying ${K}
15 opensslscip-shell system . . openssl. dgst -sha256 -verify $(dirnamescip-shell system . . dirname. $0)/${K} -signature <(echoscip-shell system . . echo. ${S} | base64scip-shell system . . base64. -d) <(echoscip-shell system . . echo. ${D} | base64scip-shell system . . base64. -d)
16 }
17
18
19 PROD_KEY_NAME=prod_public.pem
20 DEBUG_KEY_NAME=debug_public.pem
21 SIGNATURE="$2"
22 DATA="$1"
23
24 echoscip-shell system . . echo. DATA: ${DATA}
25 echoscip-shell system . . echo. SIGNATURE: ${SIGNATURE}
26
27 if verifyscip-shell shell android-platform-frameworks-base 1:14~beta1-5 verify(). "${DATA}" "${SIGNATURE}" "${PROD_KEY_NAME}"; then
28 echoscip-shell system . . echo. Verified with ${PROD_KEY_NAME}
29 exit 0
30 fi
31
32 if verifyscip-shell shell android-platform-frameworks-base 1:14~beta1-5 verify(). "${DATA}" "${SIGNATURE}" "${DEBUG_KEY_NAME}"; then
33 echoscip-shell system . . echo. Verified with ${DEBUG_KEY_NAME}
34 exit 0
35 fi
36 exit 1