diff options
author | Sehong Na <sehong.na@samsung.com> | 2014-05-31 12:59:38 +0900 |
---|---|---|
committer | Sehong Na <sehong.na@samsung.com> | 2014-05-31 12:59:38 +0900 |
commit | ea5d1b004229fb254342c19df832c8e0a8a9007c (patch) | |
tree | 2eacddacc76c07aa2048b74a73bcab3c2599c110 /scripts/tgpg | |
download | rpm-ea5d1b004229fb254342c19df832c8e0a8a9007c.tar.gz rpm-ea5d1b004229fb254342c19df832c8e0a8a9007c.tar.bz2 rpm-ea5d1b004229fb254342c19df832c8e0a8a9007c.zip |
Initialize Tizen 2.3submit/tizen_2.3/20140531.1109522.3a_release
Diffstat (limited to 'scripts/tgpg')
-rwxr-xr-x | scripts/tgpg | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/tgpg b/scripts/tgpg new file mode 100755 index 0000000..238cffb --- /dev/null +++ b/scripts/tgpg @@ -0,0 +1,36 @@ +#!/bin/sh + + +for pkg in $* +do + if [ "$pkg" = "" -o ! -e "$pkg" ]; then + echo "no package supplied" 1>&2 + exit 1 + fi + + plaintext=`mktemp ${TMPDIR:-/tmp}/tgpg-$$.XXXXXX` + detached=`mktemp ${TMPDIR:-/tmp}/tgpg-$$.XXXXXX` + +# --- Extract detached signature + rpm -qp -vv --qf '%{siggpg:armor}' $pkg > $detached + +# --- Figger the offset of header+payload in the package + leadsize=96 + o=`expr $leadsize + 8` + + set `od -j $o -N 8 -t u1 $pkg` + il=`expr 256 \* \( 256 \* \( 256 \* $2 + $3 \) + $4 \) + $5` + dl=`expr 256 \* \( 256 \* \( 256 \* $6 + $7 \) + $8 \) + $9` + + sigsize=`expr 8 + 16 \* $il + $dl` + o=`expr $o + $sigsize + \( 8 - \( $sigsize \% 8 \) \) \% 8` + +# --- Extract header+payload + dd if=$pkg ibs=$o skip=1 2>/dev/null > $plaintext + +# --- Verify DSA signature using gpg + gpg --batch -vv --debug 0xfc02 --verify $detached $plaintext + +# --- Clean up + rm -f $detached $plaintext +done |