Contents of /alx-src/branches/alx-web-050/signing-jars.sh
Parent Directory | Revision Log
Revision 1650 -
(show annotations)
(download)
(as text)
Fri Jan 21 00:01:27 2011 UTC (13 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 1467 byte(s)
Fri Jan 21 00:01:27 2011 UTC (13 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 1467 byte(s)
-added and integrate a ssh applet
1 | #!/bin/bash |
2 | |
3 | die() |
4 | { |
5 | echo "$@" |
6 | exit 1 |
7 | } |
8 | |
9 | if [[ -z ${JAVA_HOME} ]] |
10 | then |
11 | die "No JAVA_HOME in environment defined. Please install sun-jdk!" |
12 | fi |
13 | |
14 | COMMON_NAME="ESA" |
15 | KEY_ALIAS="alx-web" |
16 | KEY_EXPIRATION_TIME="365" |
17 | |
18 | JAR_FILES="vncviewer.jar mindterm.jar" |
19 | |
20 | echo -n "Please enter the keystore password: " |
21 | stty -echo |
22 | read STOREPASS |
23 | stty echo |
24 | echo |
25 | [[ -z ${STOREPASS} ]] && die "Keystore password is empty, aborting!" |
26 | |
27 | echo -n "Please enter the certificate key password: " |
28 | stty -echo |
29 | read KEYPASS |
30 | stty echo |
31 | echo |
32 | [[ -z ${KEYPASS} ]] && die "Certificate key password is empty, aborting!" |
33 | |
34 | # check if key-alias was already generated |
35 | ALREADY_EXIST=$(keytool -list -storepass "${STOREPASS}" | grep "^${KEY_ALIAS},") |
36 | if [[ -z ${ALREADY_EXIST} ]] |
37 | then |
38 | echo "Generating signing key ..." |
39 | keytool -dname "cn=${COMMON_NAME}" -validity "${KEY_EXPIRATION_TIME}" -genkey -storepass "${STOREPASS}" -keypass "${KEYPASS}" -alias "${KEY_ALIAS}" |
40 | fi |
41 | |
42 | for jar in ${JAR_FILES} |
43 | do |
44 | echo "Removing old signing certificates from jar file ${jar} ..." |
45 | TEMP="$(mktemp -d)" |
46 | WWWDIR="$(pwd)" |
47 | pushd "${TEMP}" |
48 | jar -xf "${WWWDIR}"/"${jar}" |
49 | mv -f "${WWWDIR}"/"${jar}" "${WWWDIR}"/"${jar}".old |
50 | rm -f META-INF/*.SF META-INF/*.DSA |
51 | jar -cf "${WWWDIR}"/"${jar}" . |
52 | popd |
53 | |
54 | echo "Signing jar file ${jar} ..." |
55 | jarsigner -storepass "${STOREPASS}" -keypass "${KEYPASS}" "${jar}" "${KEY_ALIAS}" |
56 | |
57 | echo "Verifing jar file ${jar} ..." |
58 | jarsigner -storepass "${STOREPASS}" -keypass "${KEYPASS}" -verify "${jar}" |
59 | done |