diff options
Diffstat (limited to 'crxid')
-rwxr-xr-x | crxid | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -0,0 +1,23 @@ +#! /bin/sh +# Get CRX id from RSA key +# usage: crxid PEM_FILE + +set -efu + +pem_path=$1 + +digest=$( + openssl rsa -in "$pem_path" -pubout -outform der 2>/dev/null | + openssl dgst -sha256 -hex | + sed 's/^(stdin)= //;s/.*/\U&/' +) + +script=" + obase=16; + ibase=16; + ascii_a=61; + $(echo $digest | cut -b-32 | sed 's/./ascii_a + &;/g') +" + +echo "$script" | bc | xxd -r -p +echo |