Author: nextgens
Date: 2006-07-25 20:03:22 +0000 (Tue, 25 Jul 2006)
New Revision: 9760

Added:
   trunk/apps/new_installer/ProcessPanel.Spec.xml
   trunk/apps/new_installer/RegistrySpec.xml
   trunk/apps/new_installer/TODO
   trunk/apps/new_installer/Unix_shortcutSpec.xml
   trunk/apps/new_installer/Win_shortcutSpec.xml
   trunk/apps/new_installer/bin/
   trunk/apps/new_installer/bin/native/
   trunk/apps/new_installer/bin/native/3rdparty/
   trunk/apps/new_installer/bin/native/3rdparty/COIOSHelper.dll
   trunk/apps/new_installer/bin/native/3rdparty/res
   trunk/apps/new_installer/bin/native/izpack/
   trunk/apps/new_installer/bin/native/izpack/ShellLink.dll
   trunk/apps/new_installer/bin/native/izpack/res
   trunk/apps/new_installer/build.xml
   trunk/apps/new_installer/install.xml
   trunk/apps/new_installer/lib/
   trunk/apps/new_installer/res/
   trunk/apps/new_installer/res/README
   trunk/apps/new_installer/res/bin/
   trunk/apps/new_installer/res/doc/
   trunk/apps/new_installer/res/doc/doc.txt
   trunk/apps/new_installer/res/freenet.ini
   trunk/apps/new_installer/res/img/
   trunk/apps/new_installer/res/img/border1.png
   trunk/apps/new_installer/res/img/border2.png
   trunk/apps/new_installer/res/img/border3.png
   trunk/apps/new_installer/res/img/border4.png
   trunk/apps/new_installer/res/img/border5.png
   trunk/apps/new_installer/res/img/border6.png
   trunk/apps/new_installer/res/img/border7.png
   trunk/apps/new_installer/res/img/border8.png
   trunk/apps/new_installer/res/img/icon.png
   trunk/apps/new_installer/res/img/title.png
   trunk/apps/new_installer/res/lib/
   trunk/apps/new_installer/res/lib/wrapper.jar
   trunk/apps/new_installer/res/license/
   trunk/apps/new_installer/res/license/LICENSE.Freenet
   trunk/apps/new_installer/res/license/LICENSE.Mantissa
   trunk/apps/new_installer/res/license/README
   trunk/apps/new_installer/res/plugins/
   trunk/apps/new_installer/res/plugins/JSTUN.jar
   trunk/apps/new_installer/res/src/
   trunk/apps/new_installer/res/src/README
   trunk/apps/new_installer/res/unix/
   trunk/apps/new_installer/res/unix/bin/
   trunk/apps/new_installer/res/unix/bin/1run.sh
   trunk/apps/new_installer/res/unix/bin/install_frost.sh
   trunk/apps/new_installer/res/unix/bin/install_jSite.sh
   trunk/apps/new_installer/res/unix/bin/install_thaw.sh
   trunk/apps/new_installer/res/unix/bin/update.sh
   trunk/apps/new_installer/res/unix/bin/wrapper-linux-x86-32
   trunk/apps/new_installer/res/unix/lib/
   trunk/apps/new_installer/res/unix/lib/libwrapper.so
   trunk/apps/new_installer/res/unix/run.sh
   trunk/apps/new_installer/res/windows/
   trunk/apps/new_installer/res/windows/bin/
   trunk/apps/new_installer/res/windows/bin/1run.cmd
   trunk/apps/new_installer/res/windows/bin/install_frost.cmd
   trunk/apps/new_installer/res/windows/bin/install_jSite.cmd
   trunk/apps/new_installer/res/windows/bin/install_service.bat
   trunk/apps/new_installer/res/windows/bin/install_thaw.cmd
   trunk/apps/new_installer/res/windows/bin/remove_service.bat
   trunk/apps/new_installer/res/windows/bin/start.cmd
   trunk/apps/new_installer/res/windows/bin/stop.cmd
   trunk/apps/new_installer/res/windows/bin/wget.exe
   trunk/apps/new_installer/res/windows/bin/wrapper-windows-x86-32.exe
   trunk/apps/new_installer/res/windows/freenet.ico
   trunk/apps/new_installer/res/windows/lib/
   trunk/apps/new_installer/res/windows/lib/wrapper.dll
   trunk/apps/new_installer/res/windows/update.cmd
   trunk/apps/new_installer/res/wrapper.conf
   trunk/apps/new_installer/src/
   trunk/apps/new_installer/src/BareBonesBrowserLaunch.java
   trunk/apps/new_installer/src/Sha1Test.java
   trunk/apps/new_installer/src/Uncompress.java
   trunk/apps/new_installer/src/freenet/
   trunk/apps/new_installer/src/freenet/support/
   trunk/apps/new_installer/src/freenet/support/HexUtil.java
   trunk/apps/new_installer/src/gnu/
   trunk/apps/new_installer/src/gnu/crypto/
   trunk/apps/new_installer/src/gnu/crypto/Registry.java
   trunk/apps/new_installer/src/gnu/crypto/hash/
   trunk/apps/new_installer/src/gnu/crypto/hash/BaseHash.java
   trunk/apps/new_installer/src/gnu/crypto/hash/IMessageDigest.java
   trunk/apps/new_installer/src/gnu/crypto/hash/Sha160.java
   trunk/apps/new_installer/src/gnu/crypto/util/
   trunk/apps/new_installer/src/gnu/crypto/util/Util.java
Log:
First commit of the new installer for freenet 0.7

Added: trunk/apps/new_installer/ProcessPanel.Spec.xml
===================================================================
--- trunk/apps/new_installer/ProcessPanel.Spec.xml      2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/ProcessPanel.Spec.xml      2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1,10 @@
+<processing>
+       <job name="Downloading required files (windows)">
+               <os family="windows" />
+               <executefile name="$INSTALL_PATH\bin\1run.cmd"/>
+       </job>
+       <job name="Downloading required files (unix)">
+               <os family="unix" />
+               <executefile name="$INSTALL_PATH/bin/1run.sh"/>
+       </job>
+</processing>

Added: trunk/apps/new_installer/RegistrySpec.xml
===================================================================
--- trunk/apps/new_installer/RegistrySpec.xml   2006-07-25 19:47:22 UTC (rev 
9759)
+++ trunk/apps/new_installer/RegistrySpec.xml   2006-07-25 20:03:22 UTC (rev 
9760)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+<!-- 
+       ATTENTION!!! do not edit with an editor which do not handle UTF-8 in a 
right manner!!
+       Storing with a wrong editor can crash this file!
+    Registry definition file for IzPack Installation.
+    $Id: RegistrySpec.xml 1335 2005-09-02 11:02:23Z bartzkau $
+-->
+
+<registry>
+       <pack name="UninstallStuff">
+               <!-- Special "pack", if not defined an uninstall key will be 
generated automatically -->
+               <!-- The variable $UNINSTALL_NAME can be only used if 
CheckedHelloPanel will be used
+                    because there the variable will be declared. With that 
variabel it is possible
+                    to install more as one instances of the product on one 
machine each with an
+                    unique uninstall key. -->
+               <value name="DisplayName" 
+                       
keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$UNINSTALL_NAME"  
+                       root="HKLM" 
+                       string="$UNINSTALL_NAME"/>
+               <value name="UninstallString" 
+                       
keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$UNINSTALL_NAME"  
+                       root="HKLM" 
+                       string="&quot;$JAVA_HOME\bin\javaw.exe&quot; -jar 
&quot;$INSTALL_PATH\uninstaller\uninstaller.jar&quot;"/>
+               <value name="DisplayIcon" 
+                       
keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$UNINSTALL_NAME"  
+                       root="HKLM" 
+                       string="$INSTALL_PATH\freenet.ico"/>
+               <value name="HelpLink" 
+                       
keypath="SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$UNINSTALL_NAME"  
+                       root="HKLM" 
+                       string="$APP_URL"/>
+      </pack>
+</registry>
+

Added: trunk/apps/new_installer/TODO
===================================================================
--- trunk/apps/new_installer/TODO       2006-07-25 19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/TODO       2006-07-25 20:03:22 UTC (rev 9760)
@@ -0,0 +1,9 @@
+TODO:
+       * l10n
+       * x86_64 support
+       * more support for unix
+       * Welcome page
+       * Fix uninstallation hooks
+       * Don't bundle JSTUN but download it
+       * New packs:
+               - auto-update

Added: trunk/apps/new_installer/Unix_shortcutSpec.xml
===================================================================
--- trunk/apps/new_installer/Unix_shortcutSpec.xml      2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/Unix_shortcutSpec.xml      2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+
+<shortcuts>
+       <skipIfNotSupported/>
+
+       <programGroup defaultName="The Free Network Project" 
location="applications"/>
+       <shortcut
+               name="Show Fproxy"
+               programGroup="yes"
+               desktop="yes"
+               applications="no"
+               startMenu="no"
+               startup="no"
+               iconFile="$INSTALL_PATH/freenet.ico"
+               iconIndex="0" 
+               type="Link"
+               url="http://localhost:8888";
+               encoding="UTF-8"
+               createForAll="false"
+               description="This starts a browser pointing to Fproxy">
+
+               <createForPack name="Base" />
+       </shortcut>
+       
+       <shortcut
+               name="The Freenet Project Website"
+               programGroup="yes"
+               desktop="yes"
+               applications="no"
+               startMenu="no"
+               startup="no"
+               iconFile="$INSTALL_PATH/freenet.ico"
+               iconIndex="0" 
+               type="Link"
+               url="http://freenetproject.org";
+               encoding="UTF-8"
+               createForAll="false"
+               description="This starts a browser pointing to 
http://freenetproject.org";>
+
+               <createForPack name="Base" />
+       </shortcut>
+
+       <shortcut
+               name="Uninstaller"
+               programGroup="yes"
+               desktop="no"
+               applications="no"
+               startMenu="no"
+               startup="no"
+               target="java"
+               commandLine="-jar 
&quot;$INSTALL_PATH/Uninstaller/uninstaller.jar&quot;"
+
+               initialState="noShow"
+               iconFile="trashcan_full"
+               iconIndex="0" 
+               workingDirectory="$INSTALL_PATH"
+               type="Application"
+               encoding="UTF-8"
+               createForAll="false"
+               description="This uninstalls Freenet">
+
+               <createForPack name="Base" />
+       </shortcut>
+</shortcuts>

Added: trunk/apps/new_installer/Win_shortcutSpec.xml
===================================================================
--- trunk/apps/new_installer/Win_shortcutSpec.xml       2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/Win_shortcutSpec.xml       2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
+
+<shortcuts>
+
+       <skipIfNotSupported />
+
+       <programGroup defaultName="The Free Network Project" 
location="applications"/>
+
+       <shortcut
+               name="Start the node"
+               programGroup="yes"
+               desktop="no"
+               applications="no"
+               startMenu="no"
+               startup="no"
+               target="$INSTALL_PATH\bin\start.cmd"
+               commandLine=""
+               description="This starts the freenet node"
+               workingDirectory="$INSTALL_PATH"
+       >
+               <createForPack name="Base" />
+       </shortcut>
+       
+       <shortcut
+               name="Stop the node"
+               programGroup="yes"
+               desktop="no"
+               applications="no"
+               startMenu="no"
+               startup="no"
+               target="$INSTALL_PATH\bin\stop.cmd"
+               commandLine=""
+               workingDirectory="$INSTALL_PATH"
+               description="This stops the freenet node">
+
+               <createForPack name="Base" />
+       </shortcut>
+       
+       <shortcut
+               name="Browse Freenet"
+               programGroup="yes"
+               desktop="yes"
+               applications="no"
+               startMenu="no"
+               startup="no"
+               iconFile="$INSTALL_PATH\freenet.ico"
+               iconIndex="0"
+               target="http://localhost:8888/";
+               description="It opens a browser pointing to Fproxy">
+
+               <createForPack name="Base" />
+       </shortcut>
+       
+       <shortcut
+               name="Browse our website"
+               programGroup="yes"
+               desktop="no"
+               applications="no"
+               startMenu="yes"
+               startup="no"
+               iconFile="$INSTALL_PATH\freenet.ico"
+               iconIndex="0"
+               target="http://freenetproject.org";
+               description="It opens a browser pointing to our website">
+
+               <createForPack name="Base" />
+       </shortcut>
+</shortcuts>

Added: trunk/apps/new_installer/bin/native/3rdparty/COIOSHelper.dll
===================================================================
(Binary files differ)


Property changes on: 
trunk/apps/new_installer/bin/native/3rdparty/COIOSHelper.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/bin/native/3rdparty/res
===================================================================
--- trunk/apps/new_installer/bin/native/3rdparty/res    2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/bin/native/3rdparty/res    2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1 @@
+link ../../../res
\ No newline at end of file


Property changes on: trunk/apps/new_installer/bin/native/3rdparty/res
___________________________________________________________________
Name: svn:special
   + *

Added: trunk/apps/new_installer/bin/native/izpack/ShellLink.dll
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/bin/native/izpack/ShellLink.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/bin/native/izpack/res
===================================================================
--- trunk/apps/new_installer/bin/native/izpack/res      2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/bin/native/izpack/res      2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1 @@
+link ../../../res
\ No newline at end of file


Property changes on: trunk/apps/new_installer/bin/native/izpack/res
___________________________________________________________________
Name: svn:special
   + *

Added: trunk/apps/new_installer/build.xml
===================================================================
--- trunk/apps/new_installer/build.xml  2006-07-25 19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/build.xml  2006-07-25 20:03:22 UTC (rev 9760)
@@ -0,0 +1,83 @@
+<?xml version="1.0"?>
+<!-- ant build file for the freenet installer -->
+
+<project name="Freenet" default="dist" basedir=".">
+       <description>
+               This file builds the freenet installer...
+       </description>
+
+       <property name="config" value="install.xml"/>
+       <property name="dest" value="install.jar"/>
+       <property name="build" value="build"/>
+       <property name="izPack.lib" value="lib/standalone-compiler.jar"/>
+
+       <taskdef name="izpack" 
classpath="${basedir}/lib/standalone-compiler.jar" 
classname="com.izforge.izpack.ant.IzPackTask"/>
+
+       <target name="dist" description="generate the distribution" 
depends="compile_sha1test, compile_browser, compile_uncompress">
+               <echo message="Build the installer"/>
+               <izpack input="${config}" output="${dest}" 
baseDir="${basedir}"/>
+       </target>
+
+       <!-- ================================================== -->
+       <target name="clean" description="Delete the installer">
+               <delete file="${dest}"/>
+               <delete dir="${build}"/>
+               <delete dir="${build}_sha1test"/>
+               <delete dir="${build}_browser"/>
+               <delete dir="${build}_uncompress"/>
+       </target>
+
+       <target name="compile_sha1test">
+               <!-- Create the time stamp -->
+               <tstamp/>
+               <!-- Create the build directory structure used by compile -->
+
+               <mkdir dir="${build}_sha1test"/>
+               <javac srcdir="./src" destdir="./${build}_sha1test" 
optimize="on" source="1.4">
+                       <classpath>
+                               <pathelement location="${izPack.lib}"/>
+                       </classpath>
+
+                       <include name="gnu/**/*.java"/>
+                       <include name="freenet/support/HexUtil"/>
+                       <include name="Sha1Test.java"/>
+               </javac>
+               <jar jarfile="./res/bin/sha1test.jar" 
basedir="./${build}_sha1test">
+                       <manifest>
+                               <attribute name="Main-Class" value="Sha1Test"/>
+                       </manifest>
+               </jar>
+       </target>
+
+       <target name="compile_browser">
+               <!-- Create the time stamp -->
+               <tstamp/>
+               <!-- Create the build directory structure used by compile -->
+
+               <mkdir dir="${build}_browser"/>
+               <javac srcdir="./src" destdir="./${build}_browser" 
optimize="on" source="1.4">
+                       <include name="BareBonesBrowserLaunch.java"/>
+               </javac>
+               <jar jarfile="./res/bin/browser.jar" 
basedir="./${build}_browser">
+                       <manifest>
+                               <attribute name="Main-Class" 
value="BareBonesBrowserLaunch"/>
+                       </manifest>
+               </jar>
+       </target>
+       
+       <target name="compile_uncompress">
+               <!-- Create the time stamp -->
+               <tstamp/>
+               <!-- Create the build directory structure used by compile -->
+
+               <mkdir dir="${build}_uncompress"/>
+               <javac srcdir="./src" destdir="./${build}_uncompress" 
optimize="on" source="1.4">
+                       <include name="Uncompress.java"/>
+               </javac>
+               <jar jarfile="./res/bin/uncompress.jar" 
basedir="./${build}_uncompress">
+                       <manifest>
+                               <attribute name="Main-Class" 
value="Uncompress$Test"/>
+                       </manifest>
+               </jar>
+       </target>
+</project>

Added: trunk/apps/new_installer/install.xml
===================================================================
--- trunk/apps/new_installer/install.xml        2006-07-25 19:47:22 UTC (rev 
9759)
+++ trunk/apps/new_installer/install.xml        2006-07-25 20:03:22 UTC (rev 
9760)
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
+
+<installation version="1.0">
+
+       <info>
+               <appname>Freenet</appname>
+               <appversion>0.7-a2-pre</appversion>
+               <url>http://freenetproject.org/</url>
+               <javaversion>1.4</javaversion>
+               <uninstaller write="yes"/>
+               <authors>
+                       <author name="Ian Clarke" email="ian at 
freenetproject.org"/>
+                       <author name="Florent Daigni?re" email="nextgens at 
freenetproject.org"/>
+                       <author name="Scott Miller" email="scgmille at 
freenetproject.org"/>
+                       <author name="Oskar Sandberg" email="oskar at 
freenetproject.org"/>
+                       <author name="Matthew Toseland" email="toad at 
freenetproject.org"/>
+                       <author name="Many unlisted volunteers" email=""/>
+               </authors>
+       </info>
+
+
+       <!-- remove labels or icons on buttons ? -->
+       <guiprefs width="640" height="480" resizable="no">
+               <laf name="looks">
+                       <os family="windows"/>
+                       <param name="variant" value="plasticXP"/>
+               </laf>
+               <laf name="liquid">
+                       <os family="unix"/>
+               </laf>
+       </guiprefs>
+
+       <locale>
+               <langpack iso3="eng"/>
+               <langpack iso3="fra"/>
+               <langpack iso3="deu"/>
+               <langpack iso3="ita"/>
+               <langpack iso3="jpn"/>
+               <langpack iso3="spa"/>
+               <langpack iso3="dan"/>
+               <langpack iso3="ell" />
+               <langpack iso3="cat"/>
+               <langpack iso3="ned"/>
+               <langpack iso3="fin"/>
+               <langpack iso3="swe"/>
+               <langpack iso3="por"/>
+               <langpack iso3="pol"/>
+               <langpack iso3="rus"/>
+               <langpack iso3="ukr"/>
+               <langpack iso3="hun"/>
+               <langpack iso3="svk"/>
+               <langpack iso3="rom"/>
+               <langpack iso3="mys"/>
+               <langpack iso3="nor"/>
+               <langpack iso3="chn"/>
+               <langpack iso3="scg"/>
+               <langpack iso3="cze"/>
+               <langpack iso3="kor"/>
+       </locale>
+
+       <variables>
+               <variable name="DesktopShortcutCheckboxEnabled" value="true" />
+               <variable name="app-version" value="0.7-a2"/>
+               <variable name="released-on" value="not yet :?"/>
+       </variables>
+
+       <resources>
+               <res src="RegistrySpec.xml" id="RegistrySpec.xml"/>
+               <res id="ProcessPanel.Spec.xml" src="ProcessPanel.Spec.xml"/> 
+               <res src="res/img/title.png" id="installer.langsel.img"/>
+               <res src="res/img/title.png" id="Installer.image"/>
+               <res id="LicencePanel.licence" 
src="res/license/LICENSE.Freenet"/>
+               <res id="InfoPanel.info" src="res/README"/>
+               <res src="Win_shortcutSpec.xml" id="shortcutSpec.xml"/>
+               <res src="Win_shortcutSpec.xml" id="Win_shortcutSpec.xml"/>
+               <res src="Unix_shortcutSpec.xml" id="Unix_shortcutSpec.xml"/>
+               <res src="res/img/border1.png" id="Installer.image.0"/>
+               <res src="res/img/border2.png" id="Installer.image.1"/>
+               <res src="res/img/border3.png" id="Installer.image.2"/>
+               <res src="res/img/border4.png" id="Installer.image.3"/>
+               <res src="res/img/border5.png" id="Installer.image.4"/>
+               <res src="res/img/border5.png" id="Installer.image.5"/>
+               <res src="res/img/border6.png" id="Installer.image.6"/>
+               <res src="res/img/border7.png" id="Installer.image.7"/>
+               <res src="res/img/border8.png" id="Installer.image.8"/>
+       </resources>
+
+       <!-- The listeners section for CustomActions -->
+       <listeners>
+               <listener installer="SummaryLoggerInstallerListener"/>
+
+               <listener installer="RegistryInstallerListener" 
uninstaller="RegistryUninstallerListener">
+                       <os family="windows"/>
+               </listener>
+       </listeners>
+
+       <panels>
+               <panel classname="CheckedHelloPanel"/>
+               <panel classname="InfoPanel"/>
+               <panel classname="LicencePanel"/>
+               <panel classname="TargetPanel"/> 
+               <panel classname="PacksPanel"/>
+               <panel classname="InstallPanel"/>
+               <panel classname="ProcessPanel"/>
+               <panel classname="ShortcutPanel"/>
+               <panel classname="SimpleFinishPanel"/>
+       </panels>
+
+       <packs>
+               <pack name="Base" required="yes">
+                       <description>The base files</description>
+                       <fileset dir="res/" targetdir="$INSTALL_PATH">
+                               <exclude name="*/**/.svn"/>
+                               <exclude name="*/**/.svn/**"/>
+                               <include name="lib/**/*"/>
+                               <include name="bin/**/*"/>
+                               <include name="wrapper.conf"/>
+                               <include name="freenet.ini"/>
+                               <include name="update.cmd"/>
+                       </fileset>
+                       <parsable targetfile="$INSTALL_PATH/freenet.ini"/> 
+               </pack>
+
+               <pack name="License" required="yes">
+                       <description>The licence files</description>
+                       <file src="res/license/LICENSE.Freenet" 
targetdir="$INSTALL_PATH"/>
+                       <file src="res/license/LICENSE.Mantissa" 
targetdir="$INSTALL_PATH"/>
+                       <file src="res/license/README" 
targetdir="$INSTALL_PATH"/>
+               </pack>
+
+               <pack name="Windows" required="yes" os="windows">
+                       <os family="windows"/>
+                       <description>A windows specific catch-all 
pack</description>
+
+                       <fileset dir="res/windows/" targetdir="$INSTALL_PATH">
+                               <exclude name="*/**/.svn"/>
+                               <exclude name="*/**/.svn/**"/>
+                               <include name="freenet.ico"/>
+                               <include name="lib/**/*"/>
+                               <include name="bin/**/*"/>
+                       </fileset>
+                       <parsable targetfile="$INSTALL_PATH\bin\1run.cmd"/> 
+                       <parsable 
targetfile="$INSTALL_PATH\bin\install_jSite.cmd"/> 
+                       <executable 
targetfile="$INSTALL_PATH\bin\remove_service.bat" os="windows" keep="true" 
stage="uninstall"/>
+               </pack>
+
+               <pack name="Unix" required="yes" os="unix">
+                       <os family="unix"/>
+                       <description>An UNIX specific catch-all 
pack</description>
+
+                       <fileset dir="res/unix/" targetdir="$INSTALL_PATH">
+                               <exclude name="*/**/.svn"/>
+                               <exclude name="*/**/.svn/**"/>
+                               <include name="**/*"/>
+                       </fileset>
+
+                       <executable targetfile="$INSTALL_PATH/bin/update.sh" 
type="bin" stage="never" keep="true"/>
+                       <executable 
targetfile="$INSTALL_PATH/bin/wrapper-linux-x86-32" type="bin" stage="never" 
keep="true"/>
+                       <executable targetfile="$INSTALL_PATH/run.sh" 
type="bin" stage="never" keep="true"/>
+                       <executable targetfile="$INSTALL_PATH/bin/1run.sh" 
type="bin" stage="never" keep="true"/>
+                       <parsable targetfile="$INSTALL_PATH/bin/1run.sh"/> 
+                       <parsable 
targetfile="$INSTALL_PATH/bin/install_jSite.sh"/> 
+                       <parsable 
targetfile="$INSTALL_PATH/bin/install_frost.sh"/> 
+                       <parsable 
targetfile="$INSTALL_PATH/bin/install_thaw.sh"/> 
+               </pack>
+               <pack name="UninstallStuff" required="no">
+                       <os family="windows"/>
+                       <description>Create uninstallation hooks in the 
registry</description>
+                       <executable 
targetfile="$INSTALL_PATH\bin\uninstall_service.bat" os="windows" keep="true" 
stage="uninstall"/>
+               </pack>
+               <pack name="STUN" required="no">
+                       <description>A plugin enabling the node to use STUN to 
determine your external internet address. Note that this involves contacting an 
external server so may be a security risk, however it improves connectivity 
significantly for nodes behind a router (i.e. most nodes).</description>
+                       <fileset dir="res/" targetdir="$INSTALL_PATH">
+                               <exclude name="*/**/.svn"/>
+                               <exclude name="*/**/.svn/**"/>
+                               <include name="plugins/JSTUN.jar"/>
+                       </fileset>
+               </pack>
+               <pack name="jSite" required="no">
+                       <description>A tool to ease the insertion of 
freesites</description>
+                       <executable 
targetfile="$INSTALL_PATH/bin/install_jSite.sh" type="bin" stage="postinstall" 
os="unix"/>
+                       <executable 
targetfile="$INSTALL_PATH\bin\install_jSite.cmd" type="bin" stage="postinstall" 
os="windows"/>
+               </pack>
+               <pack name="frost" required="no">
+                       <description>A message board application for freenet 
(http://jtcfrost.sourceforge.net/</description>
+                       <executable 
targetfile="$INSTALL_PATH/bin/install_frost.sh" type="bin" stage="postinstall" 
os="unix"/>
+                       <executable 
targetfile="$INSTALL_PATH\bin\install_frost.cmd" type="bin" stage="postinstall" 
os="windows"/>
+               </pack>
+               <pack name="thaw" required="no">
+                       <description>A powerfull filesharing tool designed for 
freenet</description>
+                       <executable 
targetfile="$INSTALL_PATH/bin/install_thaw.sh" type="bin" stage="postinstall" 
os="unix"/>
+                       <executable 
targetfile="$INSTALL_PATH\bin\install_thaw.cmd" type="bin" stage="postinstall" 
os="windows"/>
+               </pack>
+       </packs>
+
+       <!-- The native libraries to add  
http://svn.berlios.de/svnroot/repos/izpack/izpack-src/trunk/src/native/ -->
+       <native type="3rdparty" name="COIOSHelper.dll" stage="both">
+               <os family="windows"/>
+       </native>
+       <native type="izpack" name="ShellLink.dll" stage="install">
+               <os family="windows"/>
+       </native>
+
+       <jar src="res/bin/sha1test.jar"/>
+
+</installation>

Added: trunk/apps/new_installer/res/README
===================================================================
--- trunk/apps/new_installer/res/README 2006-07-25 19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/res/README 2006-07-25 20:03:22 UTC (rev 9760)
@@ -0,0 +1,7 @@
+Welcome to the Freenet 0.7 installer program
+
+This is the first version of the installer
+
+This is the 0.7 rewrite of Freenet.
+It has been largely rewritten from scratch,
+although it pulls in a load of code from Dijjer.

Added: trunk/apps/new_installer/res/doc/doc.txt
===================================================================
--- trunk/apps/new_installer/res/doc/doc.txt    2006-07-25 19:47:22 UTC (rev 
9759)
+++ trunk/apps/new_installer/res/doc/doc.txt    2006-07-25 20:03:22 UTC (rev 
9760)
@@ -0,0 +1 @@
+We can have here some documenation files ...
\ No newline at end of file

Added: trunk/apps/new_installer/res/freenet.ini
===================================================================
--- trunk/apps/new_installer/res/freenet.ini    2006-07-25 19:47:22 UTC (rev 
9759)
+++ trunk/apps/new_installer/res/freenet.ini    2006-07-25 20:03:22 UTC (rev 
9760)
@@ -0,0 +1,3 @@
+pluginmanager.loadplugin=*@file://$INSTALL_PATH/plugins/JSTUN.jar;
+node.updater.enabled=true
+node.updater.autoupdate=true

Added: trunk/apps/new_installer/res/img/border1.png
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/img/border1.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/img/border2.png
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/img/border2.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/img/border3.png
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/img/border3.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/img/border4.png
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/img/border4.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/img/border5.png
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/img/border5.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/img/border6.png
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/img/border6.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/img/border7.png
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/img/border7.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/img/border8.png
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/img/border8.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/img/icon.png
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/img/icon.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/img/title.png
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/img/title.png
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/lib/wrapper.jar
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/lib/wrapper.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/license/LICENSE.Freenet
===================================================================
--- trunk/apps/new_installer/res/license/LICENSE.Freenet        2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/res/license/LICENSE.Freenet        2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,437 @@
+                 GNU LIBRARY GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1991 Free Software Foundation, Inc.
+                   59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the library GPL.  It is
+ numbered 2 because it goes with version 2 of the ordinary GPL.]
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Library General Public License, applies to some
+specially designated Free Software Foundation software, and to any
+other libraries whose authors decide to use it.  You can use it for
+your libraries, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if
+you distribute copies of the library, or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link a program with the library, you must provide
+complete object files to the recipients so that they can relink them
+with the library, after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  Our method of protecting your rights has two steps: (1) copyright
+the library, and (2) offer you this license which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  Also, for each distributor's protection, we want to make certain
+that everyone understands that there is no warranty for this free
+library.  If the library is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original
+version, so that any problems introduced by others will not reflect on
+the original authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that companies distributing free
+software will individually obtain patent licenses, thus in effect
+transforming the program into proprietary software.  To prevent this,
+we have made it clear that any patent must be licensed for everyone's
+free use or not licensed at all.
+
+  Most GNU software, including some libraries, is covered by the ordinary
+GNU General Public License, which was designed for utility programs.  This
+license, the GNU Library General Public License, applies to certain
+designated libraries.  This license is quite different from the ordinary
+one; be sure to read it in full, and don't assume that anything in it is
+the same as in the ordinary license.
+
+  The reason we have a separate public license for some libraries is that
+they blur the distinction we usually make between modifying or adding to a
+program and simply using it.  Linking a program with a library, without
+changing the library, is in some sense simply using the library, and is
+analogous to running a utility program or application program.  However, in
+a textual and legal sense, the linked executable is a combined work, a
+derivative of the original library, and the ordinary General Public License
+treats it as such.
+
+  Because of this blurred distinction, using the ordinary General
+Public License for libraries did not effectively promote software
+sharing, because most developers did not use the libraries.  We
+concluded that weaker conditions might promote sharing better.
+
+  However, unrestricted linking of non-free programs would deprive the
+users of those programs of all benefit from the free status of the
+libraries themselves.  This Library General Public License is intended to
+permit developers of non-free programs to use free libraries, while
+preserving your freedom as a user of such programs to change the free
+libraries that are incorporated in them.  (We have not seen how to achieve
+this as regards changes in header files, but we have achieved it as regards
+changes in the actual functions of the Library.)  The hope is that this
+will lead to faster development of free libraries.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, while the latter only
+works together with the library.
+
+  Note that it is possible for a library to be covered by the ordinary
+General Public License rather than by this special one.
+
+                 GNU LIBRARY GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library which
+contains a notice placed by the copyright holder or other authorized
+party saying it may be distributed under the terms of this Library
+General Public License (also called "this License").  Each licensee is
+addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also compile or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    c) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    d) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the source code distributed need not include anything that is normally
+distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Library General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                           NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                    END OF TERMS AND CONDITIONS

Added: trunk/apps/new_installer/res/license/LICENSE.Mantissa
===================================================================
--- trunk/apps/new_installer/res/license/LICENSE.Mantissa       2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/res/license/LICENSE.Mantissa       2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,35 @@
+Copyright (c) 2001-2004, Luc Maisonobe
+All rights reserved.
+
+Redistribution and use in source and binary forms, with
+or without modification, are permitted provided that
+the following conditions are met:
+
+   Redistributions of source code must retain the
+   above copyright notice, this list of conditions and
+   the following disclaimer. 
+   Redistributions in binary form must reproduce the
+   above copyright notice, this list of conditions and
+   the following disclaimer in the documentation
+   and/or other materials provided with the
+   distribution. 
+   Neither the names of spaceroots.org, spaceroots.com
+   nor the names of their contributors may be used to
+   endorse or promote products derived from this
+   software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.

Added: trunk/apps/new_installer/res/license/README
===================================================================
--- trunk/apps/new_installer/res/license/README 2006-07-25 19:47:22 UTC (rev 
9759)
+++ trunk/apps/new_installer/res/license/README 2006-07-25 20:03:22 UTC (rev 
9760)
@@ -0,0 +1,13 @@
+This is the 0.7 rewrite of Freenet. This is largely rewritten from scratch, 
+although it pulls in a load of code from Dijjer.
+
+Major changes:
+- Freenet now uses UDP
+- Freenet now uses 32kB fixed block sizes
+- Many more...
+
+Freenet is under the GPLv2 - see LICENSE.Freenet. However, we use some other 
+code:
+- Mantissa is under the modified BSD license. See README.Mantissa. According 
+  to the FSF, modified BSD is compatible with GPL; we must include both 
+  licenses.

Added: trunk/apps/new_installer/res/plugins/JSTUN.jar
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/plugins/JSTUN.jar
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/src/README
===================================================================
--- trunk/apps/new_installer/res/src/README     2006-07-25 19:47:22 UTC (rev 
9759)
+++ trunk/apps/new_installer/res/src/README     2006-07-25 20:03:22 UTC (rev 
9760)
@@ -0,0 +1 @@
+our sources

Added: trunk/apps/new_installer/res/unix/bin/1run.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/1run.sh       2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/res/unix/bin/1run.sh       2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+DST="$INSTALL_PATH"
+
+echo "install: $INSTALL_PATH"
+cd "$DST"
+echo "Downloading freenet-cvs-snapshot.jar"
+java -jar bin/sha1test.jar freenet-cvs-snapshot.jar "$DST" || exit 1
+echo "Downloading freenet-ext.jar"
+java -jar bin/sha1test.jar freenet-ext.jar "$DST" || exit 1
+./run.sh start
+echo "Waiting for Freenet to startup"
+sleep 10
+echo "Starting up a browser"
+java -cp bin/browser.jar BareBonesBrowserLaunch "http://127.0.0.1:8888/";
+
+echo "Finished"
+
+exit 0

Added: trunk/apps/new_installer/res/unix/bin/install_frost.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/install_frost.sh      2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/res/unix/bin/install_frost.sh      2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,8 @@
+#!/bin/bash
+cd $INSTALL_PATH/bin
+echo "Downloading frost"
+java -jar sha1test.jar frost/frost.zip ../ || exit 1
+echo "Unzipping frost"
+mkdir ../frost
+java -jar uncompress.jar ../frost.zip ../frost
+echo "Done"

Added: trunk/apps/new_installer/res/unix/bin/install_jSite.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/install_jSite.sh      2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/res/unix/bin/install_jSite.sh      2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,5 @@
+#!/bin/bash
+cd $INSTALL_PATH/bin
+echo "Downloading jSite"
+java -jar sha1test.jar jSite/jSite.jar ../ || exit 1
+echo "Done"

Added: trunk/apps/new_installer/res/unix/bin/install_thaw.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/install_thaw.sh       2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/res/unix/bin/install_thaw.sh       2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,5 @@
+#!/bin/bash
+cd $INSTALL_PATH/bin
+echo "Downloading Thaw"
+java -jar sha1test.jar Thaw/Thaw.jar ../ || exit 1
+echo "Done"

Added: trunk/apps/new_installer/res/unix/bin/update.sh
===================================================================
--- trunk/apps/new_installer/res/unix/bin/update.sh     2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/res/unix/bin/update.sh     2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1,122 @@
+#!/bin/bash
+WHEREAMI="$(pwd)"
+cd @path@
+echo "Updating freenet"
+
+# Attempt to use the auto-fetcher code, which will check the sha1sums.
+
+if [[ "$1" != "debug" ]]
+then
+       THEMASK="-o /dev/null"
+fi
+
+# see https://bugs.freenetproject.org/view.php?id=223
+# we can't afford a valid non-selfsigned SSL certificate :/
+if [[ $(wget --version | head -n1 | cut -d" " -f3 | cut -d"." -f2) -ge 10 ]]
+then
+    NOCERT="--no-check-certificate "
+fi
+
+if [[ ! -x "$(which wget)" ]]
+then
+       WGET=0
+       DOWNLOADER="curl --insecure -q -f -L -O "
+       DOWNLOADER2="curl --insecure -q -f -L -O 
http://downloads.freenetproject.org/alpha/freenet-cvs-snapshot.jar";
+       DOWNLOADER3="curl --insecure -q -f -L -O "
+else
+       WGET=1
+       DOWNLOADER="wget $THEMASK -N "
+       DOWNLOADER2="wget $THEMASK -N -i freenet-cvs-snapshot.jar.url"
+       DOWNLOADER3="wget $THEMASK -N -O update2.sh $NOCERT "
+fi
+
+if [[ ! -s sha1test.jar ]]
+then
+       for x in 1 2 3 4 5
+       do
+               echo Downloading sha1test.jar utility jar which will download 
the actual update.
+               if [[ $WGET -eq 1 ]]
+               then
+                       $DOWNLOADER $NOCERT 
https://emu.freenetproject.org/sha1test.jar
+               else
+                       $DOWNLOADER https://emu.freenetproject.org/sha1test.jar
+               fi
+               
+               if [[ -s sha1test.jar ]]
+               then
+                       break
+               fi
+       done
+       if [[ ! -s sha1test.jar ]]
+       then
+               echo Could not download Sha1Test. The servers may be offline?
+               exit
+       fi
+fi
+
+cp freenet-cvs-snapshot.jar freenet-cvs-snapshot.jar.old
+cp freenet-ext.jar freenet-ext.jar.old
+
+if java -cp sha1test.jar Sha1Test freenet-cvs-snapshot.jar
+then
+       echo Downloaded freenet-cvs-snapshot.jar
+else
+       echo Could not download new freenet-cvs-snapshot.jar.
+       exit
+fi
+
+if java -cp sha1test.jar Sha1Test freenet-ext.jar
+then
+       echo Downloaded freenet-ext.jar
+else
+       echo Could not download new freenet-ext.jar.
+       exit
+fi
+
+if [[ ! -x "$(which cmp)" ]]
+then
+       if [[ ! -x "$(which md5sum)" ]]
+       then
+               echo No cmp or md5sum utility detected
+               echo Restarting the node as we cannot tell whether we need to.
+               ./run.sh restart
+       else
+               echo hmmm
+               if [[ "$(md5sum freenet-cvs-snapshot.jar)" != "$(md5sum 
freenet-cvs-snapshot.jar.old)" ]]
+               then
+                       echo Restarting node because freenet-cvs-snapshot.jar 
updated.
+                       ./run.sh restart
+               elif [[ "$(md5sum freenet-ext.jar)" != "$(md5sum 
freenet-ext.jar.old)" ]]
+               then
+                       echo Restarting node because freenet-ext.jar updated.
+                       ./run.sh restart
+               fi
+       fi
+else
+       if cmp freenet-cvs-snapshot.jar freenet-cvs-snapshot.jar.old && cmp 
freenet-ext.jar freenet-ext.jar.old
+       then
+               echo Your node is up to date
+       else
+               echo Restarting node because freenet-cvs-snapshot.jar or 
freenet-ext.jar updated.
+               ./run.sh restart
+       fi
+fi
+
+$DOWNLOADER3 
https://emu.freenetproject.org/svn/trunk/apps/installer/installclasspath/linux/update.sh
+touch update.sh update2.sh
+diff --brief update.sh update2.sh
+if [[ $? -ne 0 ]]
+then
+       LOCATION="$(pwd | sed -e 's/\//\\\//g')"
+       # we need to escape it, thanks to the_JinX for the hack
+       WHAT="@pa"
+       WHAT2="th@"
+       if [[ $WGET -eq 0 ]]
+       then
+               cp update.sh update2.sh
+       fi
+       cat update2.sh |sed "s/$WHAT$WHAT2/$LOCATION/" > update.sh
+       chmod +x update.sh
+fi
+
+cd $WHEREAMI


Property changes on: trunk/apps/new_installer/res/unix/bin/update.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/apps/new_installer/res/unix/bin/wrapper-linux-x86-32
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/unix/bin/wrapper-linux-x86-32
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/unix/lib/libwrapper.so
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/unix/lib/libwrapper.so
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/unix/run.sh
===================================================================
--- trunk/apps/new_installer/res/unix/run.sh    2006-07-25 19:47:22 UTC (rev 
9759)
+++ trunk/apps/new_installer/res/unix/run.sh    2006-07-25 20:03:22 UTC (rev 
9760)
@@ -0,0 +1,543 @@
+#! /bin/sh
+
+#
+# Copyright (c) 1999, 2006 Tanuki Software Inc.
+#
+# Java Service Wrapper sh script.  Suitable for starting and stopping
+#  wrapped Java applications on UNIX platforms.
+#
+
+#-----------------------------------------------------------------------------
+# These settings can be modified to fit the needs of your application
+
+# Application
+APP_NAME="Freenet"
+APP_LONG_NAME="Freenet 0.7"
+
+# Wrapper
+WRAPPER_CMD="./bin/wrapper"
+WRAPPER_CONF="./wrapper.conf"
+
+# Priority at which to run the wrapper.  See "man nice" for valid priorities.
+#  nice is only used if a priority is specified.
+PRIORITY=15
+
+# Location of the pid file.
+PIDDIR="."
+
+# If uncommented, causes the Wrapper to be shutdown using an anchor file.
+#  When launched with the 'start' command, it will also ignore all INT and
+#  TERM signals.
+IGNORE_SIGNALS=true
+
+# If specified, the Wrapper will be run as the specified user.
+# IMPORTANT - Make sure that the user has the required privileges to write
+#  the PID file and wrapper.log files.  Failure to be able to write the log
+#  file will cause the Wrapper to exit without any way to write out an error
+#  message.
+# NOTE - This will set the user which is used to run the Wrapper as well as
+#  the JVM and is not useful in situations where a privileged resource or
+#  port needs to be allocated prior to the user being changed.
+#RUN_AS_USER=
+
+# The following two lines are used by the chkconfig command. Change as is
+#  appropriate for your application.  They should remain commented.
+# chkconfig: 2345 20 80
+# description: @app.long.name@
+
+# Do not modify anything beyond this point
+#-----------------------------------------------------------------------------
+
+if [ "X`id -u`" = "X0" -a -z "$RUN_AS_USER" ]
+then
+    echo "Do not run this script as root."
+    exit 1
+fi
+
+# and get java implementation too, Sun JDK or Kaffe
+JAVA_IMPL=`java -version 2>&1 | head -n 1 | cut -f1 -d' '`
+
+# sun specific options
+LDPROP=""
+#if [ "$JAVA_IMPL" = "java" ]
+#then 
+#      echo Sun java detected.
+#      # Tell it not to use NPTL.
+#      # BAD THINGS happen if it uses NPTL.
+#      # Specifically, at least on 1.4.1. and 1.5.0b2, we get hangs
+#      # where many threads are stuck waiting for a lock to be 
+#      # unlocked but no thread owns it.
+#
+#      ## won't work on libc2.4 ... let's hope it's fixed
+#      if [[ -z "$(/lib/libc.so.6 | head -n 1 | grep 'release version 2.4')" ]]
+#      then
+#              if [[ -d /lib/tls ]]
+#              then
+#                      LDPROP="set.LD_ASSUME_KERNEL=2.4.1" 
+#              fi
+#      fi
+#fi 
+
+
+# Get the fully qualified path to the script
+case $0 in
+    /*)
+        SCRIPT="$0"
+        ;;
+    *)
+        PWD=`pwd`
+        SCRIPT="$PWD/$0"
+        ;;
+esac
+
+# Resolve the true real path without any sym links.
+CHANGED=true
+while [ "X$CHANGED" != "X" ]
+do
+    # Change spaces to ":" so the tokens can be parsed.
+    SCRIPT=`echo $SCRIPT | sed -e 's; ;:;g'`
+    # Get the real path to this script, resolving any symbolic links
+    TOKENS=`echo $SCRIPT | sed -e 's;/; ;g'`
+    REALPATH=
+    for C in $TOKENS; do
+        REALPATH="$REALPATH/$C"
+        while [ -h "$REALPATH" ] ; do
+            LS="`ls -ld "$REALPATH"`"
+            LINK="`expr "$LS" : '.*-> \(.*\)$'`"
+            if expr "$LINK" : '/.*' > /dev/null; then
+                REALPATH="$LINK"
+            else
+                REALPATH="`dirname "$REALPATH"`""/$LINK"
+            fi
+        done
+    done
+    # Change ":" chars back to spaces.
+    REALPATH=`echo $REALPATH | sed -e 's;:; ;g'`
+
+    if [ "$REALPATH" = "$SCRIPT" ]
+    then
+        CHANGED=""
+    else
+        SCRIPT="$REALPATH"
+    fi
+done
+
+# Change the current directory to the location of the script
+cd "`dirname "$REALPATH"`"
+REALDIR=`pwd`
+
+# If the PIDDIR is relative, set its value relative to the full REALPATH to 
avoid problems if
+#  the working directory is later changed.
+FIRST_CHAR=`echo $PIDDIR | cut -c1,1`
+if [ "$FIRST_CHAR" != "/" ]
+then
+    PIDDIR=$REALDIR/$PIDDIR
+fi
+# Same test for WRAPPER_CMD
+FIRST_CHAR=`echo $WRAPPER_CMD | cut -c1,1`
+if [ "$FIRST_CHAR" != "/" ]
+then
+    WRAPPER_CMD=$REALDIR/$WRAPPER_CMD
+fi
+# Same test for WRAPPER_CONF
+FIRST_CHAR=`echo $WRAPPER_CONF | cut -c1,1`
+if [ "$FIRST_CHAR" != "/" ]
+then
+    WRAPPER_CONF=$REALDIR/$WRAPPER_CONF
+fi
+
+# Process ID
+ANCHORFILE="$PIDDIR/$APP_NAME.anchor"
+PIDFILE="$PIDDIR/$APP_NAME.pid"
+LOCKDIR="$REALDIR"
+LOCKFILE="$LOCKDIR/$APP_NAME"
+pid=""
+
+# Resolve the os
+DIST_OS=`uname -s | tr [:upper:] [:lower:] | tr -d [:blank:]`
+case "$DIST_OS" in
+    'sunos')
+        DIST_OS="solaris"
+        ;;
+    'hp-ux' | 'hp-ux64')
+        DIST_OS="hpux"
+        ;;
+    'darwin')
+        DIST_OS="macosx"
+        ;;
+    'unix_sv')
+        DIST_OS="unixware"
+        ;;
+esac
+
+# Resolve the architecture
+DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d [:blank:]`
+case "$DIST_ARCH" in
+    'amd64' | 'ia32' | 'ia64' | 'i386' | 'i486' | 'i586' | 'i686' | 'x86_64')
+        DIST_ARCH="x86"
+        ;;
+    'ip27')
+        DIST_ARCH="mips"
+        ;;
+    'power' | 'powerpc' | 'power_pc' | 'ppc64')
+        DIST_ARCH="ppc"
+        ;;
+    'pa_risc' | 'pa-risc')
+        DIST_ARCH="parisc"
+        ;;
+    'sun4u' | 'sparcv9')
+        DIST_ARCH="sparc"
+        ;;
+    '9000/800')
+        DIST_ARCH="parisc"
+        ;;
+esac
+
+# Decide on the wrapper binary to use.
+# If a 32-bit wrapper binary exists then it will work on 32 or 64 bit
+#  platforms, if the 64-bit binary exists then the distribution most
+#  likely wants to use long names.  Otherwise, look for the default.
+# For macosx, we also want to look for universal binaries.
+WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+if [ -x $WRAPPER_TEST_CMD ]
+then
+    WRAPPER_CMD="$WRAPPER_TEST_CMD"
+else
+    if [ "$DIST_OS" = "macosx" ]
+    then
+        WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-32"
+        if [ -x $WRAPPER_TEST_CMD ]
+        then
+            WRAPPER_CMD="$WRAPPER_TEST_CMD"
+        else
+            WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+            if [ -x $WRAPPER_TEST_CMD ]
+            then
+                WRAPPER_CMD="$WRAPPER_TEST_CMD"
+            else
+                WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-universal-64"
+                if [ -x $WRAPPER_TEST_CMD ]
+                then
+                    WRAPPER_CMD="$WRAPPER_TEST_CMD"
+                else
+                    if [ ! -x $WRAPPER_CMD ]
+                    then
+                        echo "Unable to locate any of the following binaries:"
+                        echo "  $WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+                        echo "  $WRAPPER_CMD-$DIST_OS-universal-32"
+                        echo "  $WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+                        echo "  $WRAPPER_CMD-$DIST_OS-universal-64"
+                        echo "  $WRAPPER_CMD"
+                        exit 1
+                    fi
+                fi
+            fi
+        fi
+    else
+        WRAPPER_TEST_CMD="$WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+        if [ -x $WRAPPER_TEST_CMD ]
+        then
+            WRAPPER_CMD="$WRAPPER_TEST_CMD"
+        else
+            if [ ! -x $WRAPPER_CMD ]
+            then
+                echo "Unable to locate any of the following binaries:"
+                echo "  $WRAPPER_CMD-$DIST_OS-$DIST_ARCH-32"
+                echo "  $WRAPPER_CMD-$DIST_OS-$DIST_ARCH-64"
+                echo "  $WRAPPER_CMD"
+                exit 1
+            fi
+        fi
+    fi
+fi
+ 
+# Build the nice clause
+if [ "X$PRIORITY" = "X" ]
+then
+    CMDNICE=""
+else
+    CMDNICE="nice -$PRIORITY"
+fi
+
+# Build the anchor file clause.
+if [ "X$IGNORE_SIGNALS" = "X" ]
+then
+   ANCHORPROP=
+   IGNOREPROP=
+else
+   ANCHORPROP=wrapper.anchorfile=$ANCHORFILE
+   IGNOREPROP=wrapper.ignore_signals=TRUE
+fi
+
+# Build the lock file clause.  Only create a lock file if the lock directory 
exists on this platform.
+if [ -d $LOCKDIR ]
+then
+    LOCKPROP=wrapper.lockfile=$LOCKFILE
+else
+    LOCKPROP=
+fi
+
+checkUser() {
+    # Check the configured user.  If necessary rerun this script as the 
desired user.
+    if [ "X$RUN_AS_USER" != "X" ]
+    then
+        # Resolve the location of the 'id' command
+        IDEXE="/usr/xpg4/bin/id"
+        if [ ! -x $IDEXE ]
+        then
+            IDEXE="/usr/bin/id"
+            if [ ! -x $IDEXE ]
+            then
+                echo "Unable to locate 'id'."
+                echo "Please report this message along with the location of 
the command on your system."
+                exit 1
+            fi
+        fi
+    
+        if [ "`$IDEXE -u -n`" = "$RUN_AS_USER" ]
+        then
+            # Already running as the configured user.  Avoid password prompts 
by not calling su.
+            RUN_AS_USER=""
+        fi
+    fi
+    if [ "X$RUN_AS_USER" != "X" ]
+    then
+        # If LOCKPROP and $RUN_AS_USER are defined then the new user will most 
likely not be
+        # able to create the lock file.  The Wrapper will be able to update 
this file once it
+        # is created but will not be able to delete it on shutdown.  If $2 is 
defined then
+        # the lock file should be created for the current command
+        if [ "X$LOCKPROP" != "X" ]
+        then
+            if [ "X$2" != "X" ]
+            then
+                # Resolve the primary group 
+                RUN_AS_GROUP=`groups $RUN_AS_USER | awk '{print $3}' | tail -1`
+                if [ "X$RUN_AS_GROUP" = "X" ]
+                then
+                    RUN_AS_GROUP=RUN_AS_USER
+                fi
+                touch $LOCKFILE
+                chown $RUN_AS_USER:$RUN_AS_GROUP $LOCKFILE
+            fi
+        fi
+
+        # Still want to change users, recurse.  This means that the user will 
only be
+        #  prompted for a password once.
+        su -m $RUN_AS_USER -c "$REALPATH $1"
+
+        # Now that we are the original user again, we may need to clean up the 
lock file.
+        if [ "X$LOCKPROP" != "X" ]
+        then
+            getpid
+            if [ "X$pid" = "X" ]
+            then
+                # Wrapper is not running so make sure the lock file is deleted.
+                if [ -f $LOCKFILE ]
+                then
+                    rm $LOCKFILE
+                fi
+            fi
+        fi
+
+        exit 0
+    fi
+}
+
+getpid() {
+    if [ -f $PIDFILE ]
+    then
+        if [ -r $PIDFILE ]
+        then
+            pid=`cat $PIDFILE`
+            if [ "X$pid" != "X" ]
+            then
+                # It is possible that 'a' process with the pid exists but that 
it is not the
+                #  correct process.  This can happen in a number of cases, but 
the most
+                #  common is during system startup after an unclean shutdown.
+                # So make sure the process is one of "ours" -- that we can send
+               # a signal to it.  (We don't use ps(1) because that's neither
+               # safe nor portable.
+               if ! kill -0 $pid 2>/dev/null
+                then
+                    # This is a stale pid file.
+                    rm -f $PIDFILE
+                    echo "Removed stale pid file: $PIDFILE"
+                    pid=""
+                fi
+            fi
+        else
+            echo "Cannot read $PIDFILE."
+            exit 1
+        fi
+    fi
+}
+
+testpid() {
+    if ! kill -0 $pid 2>/dev/null
+    then
+        # Process is gone so remove the pid file.
+        rm -f $PIDFILE
+        pid=""
+    fi
+}
+
+console() {
+    echo "Running $APP_LONG_NAME..."
+    getpid
+    if [ "X$pid" = "X" ]
+    then
+        COMMAND_LINE="$CMDNICE $WRAPPER_CMD $WRAPPER_CONF 
wrapper.syslog.ident=$APP_NAME wrapper.pidfile=$PIDFILE $LDPROP $ANCHORPROP 
$LOCKPROP"
+        exec $COMMAND_LINE
+    else
+        echo "$APP_LONG_NAME is already running."
+        exit 1
+    fi
+}
+ 
+start() {
+    echo "Starting $APP_LONG_NAME..."
+    getpid
+    if [ "X$pid" = "X" ]
+    then
+        COMMAND_LINE="$CMDNICE $WRAPPER_CMD $WRAPPER_CONF 
wrapper.syslog.ident=$APP_NAME wrapper.pidfile=$PIDFILE $LDPROP 
wrapper.daemonize=TRUE $ANCHORPROP $IGNOREPROP $LOCKPROP"
+        exec $COMMAND_LINE
+    else
+        echo "$APP_LONG_NAME is already running."
+        exit 1
+    fi
+}
+ 
+stopit() {
+    echo "Stopping $APP_LONG_NAME..."
+    getpid
+    if [ "X$pid" = "X" ]
+    then
+        echo "$APP_LONG_NAME was not running."
+    else
+        if [ "X$IGNORE_SIGNALS" = "X" ]
+        then
+            # Running so try to stop it.
+            kill $pid
+            if [ $? -ne 0 ]
+            then
+                # An explanation for the failure should have been given
+                echo "Unable to stop $APP_LONG_NAME."
+                exit 1
+            fi
+        else
+            rm -f $ANCHORFILE
+            if [ -f $ANCHORFILE ]
+            then
+                # An explanation for the failure should have been given
+                echo "Unable to stop $APP_LONG_NAME."
+                exit 1
+            fi
+        fi
+
+        # We can not predict how long it will take for the wrapper to
+        #  actually stop as it depends on settings in wrapper.conf.
+        #  Loop until it does.
+        savepid=$pid
+        CNT=0
+        TOTCNT=0
+        while [ "X$pid" != "X" ]
+        do
+            # Show a waiting message every 5 seconds.
+            if [ "$CNT" -lt "5" ]
+            then
+                CNT=`expr $CNT + 1`
+            else
+                echo "Waiting for $APP_LONG_NAME to exit..."
+                CNT=0
+            fi
+            TOTCNT=`expr $TOTCNT + 1`
+
+            sleep 1
+
+            testpid
+        done
+
+        pid=$savepid
+        testpid
+        if [ "X$pid" != "X" ]
+        then
+            echo "Failed to stop $APP_LONG_NAME."
+            exit 1
+        else
+            echo "Stopped $APP_LONG_NAME."
+        fi
+    fi
+}
+
+status() {
+    getpid
+    if [ "X$pid" = "X" ]
+    then
+        echo "$APP_LONG_NAME is not running."
+        exit 1
+    else
+        echo "$APP_LONG_NAME is running ($pid)."
+        exit 0
+    fi
+}
+
+dump() {
+    echo "Dumping $APP_LONG_NAME..."
+    getpid
+    if [ "X$pid" = "X" ]
+    then
+        echo "$APP_LONG_NAME was not running."
+
+    else
+        kill -3 $pid
+
+        if [ $? -ne 0 ]
+        then
+            echo "Failed to dump $APP_LONG_NAME."
+            exit 1
+        else
+            echo "Dumped $APP_LONG_NAME."
+        fi
+    fi
+}
+
+case "$1" in
+
+    'console')
+        checkUser $1 touchlock
+        console
+        ;;
+
+    'start')
+        checkUser $1 touchlock
+        start
+        ;;
+
+    'stop')
+        checkUser $1
+        stopit
+        ;;
+
+    'restart')
+        checkUser $1 touchlock
+        stopit
+        start
+        ;;
+
+    'status')
+        checkUser $1
+        status
+        ;;
+
+    'dump')
+        checkUser $1
+        dump
+        ;;
+
+    *)
+        echo "Usage: $0 { console | start | stop | restart | status | dump }"
+        exit 1
+        ;;
+esac
+
+exit 0


Property changes on: trunk/apps/new_installer/res/unix/run.sh
___________________________________________________________________
Name: svn:executable
   + *

Added: trunk/apps/new_installer/res/windows/bin/1run.cmd
===================================================================
--- trunk/apps/new_installer/res/windows/bin/1run.cmd   2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/res/windows/bin/1run.cmd   2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1,15 @@
+ at set PATH=%SYSTEMROOT%\System32\;%PATH%
+ at cd "$INSTALL_PATH"
+ at echo "Downloading freenet-cvs-snapshot.jar"
+ at java -jar bin\sha1test.jar freenet-cvs-snapshot.jar "$INSTALL_PATH"
+ at echo "Downloading freenet-ext.jar"
+ at java -jar bin\sha1test.jar freenet-ext.jar "$INSTALL_PATH"
+ at echo "Installing the wrapper"
+ at echo "Registering Freenet as a system service"
+ at bin\wrapper-windows-x86-32.exe -i ../wrapper.conf
+ at net start freenet-darknet
+ at echo "Waiting for freenet to startup"
+ at ping -n 10 127.0.0.1 >nul
+ at echo "Spawing up a browser"
+ at start http://127.0.0.1:8888
+ at echo "Finished"

Added: trunk/apps/new_installer/res/windows/bin/install_frost.cmd
===================================================================
--- trunk/apps/new_installer/res/windows/bin/install_frost.cmd  2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/res/windows/bin/install_frost.cmd  2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,8 @@
+ at echo "Downloading Frost"
+ at set PATH=%SYSTEMROOT%\System32\;%PATH%
+ at cd $INSTALL_PATH\bin
+ at java -jar sha1test.jar frost/frost.zip ../
+ at echo "Setting Frost up"
+ at mkdir ../frost
+ at java -jar uncompress.jar ../frost.zip ../frost
+ at echo "Done"

Added: trunk/apps/new_installer/res/windows/bin/install_jSite.cmd
===================================================================
--- trunk/apps/new_installer/res/windows/bin/install_jSite.cmd  2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/res/windows/bin/install_jSite.cmd  2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,5 @@
+ at echo "Downloading jSite"
+ at set PATH=%SYSTEMROOT%\System32\;%PATH%
+ at cd $INSTALL_PATH\bin
+ at java -jar sha1test.jar jSite/jSite.jar ../
+ at echo "Done"

Added: trunk/apps/new_installer/res/windows/bin/install_service.bat
===================================================================
--- trunk/apps/new_installer/res/windows/bin/install_service.bat        
2006-07-25 19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/res/windows/bin/install_service.bat        
2006-07-25 20:03:22 UTC (rev 9760)
@@ -0,0 +1,7 @@
+ at set PATH=%SYSTEMROOT%\System32\;%PATH%
+
+ at echo "Cleaning up"
+ at net stop freenet-darknet
+ at wrapper-windows-x86-32.exe -r ../wrapper.conf
+ at echo "Registering Freenet as a system service"
+ at wrapper-windows-x86-32.exe -i ../wrapper.conf

Added: trunk/apps/new_installer/res/windows/bin/install_thaw.cmd
===================================================================
--- trunk/apps/new_installer/res/windows/bin/install_thaw.cmd   2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/res/windows/bin/install_thaw.cmd   2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,5 @@
+ at echo "Downloading Thaw"
+ at set PATH=%SYSTEMROOT%\System32\;%PATH%
+ at cd $INSTALL_PATH\bin
+ at java -jar sha1test Thaw/Thaw.jar ../
+ at echo "Done"

Added: trunk/apps/new_installer/res/windows/bin/remove_service.bat
===================================================================
--- trunk/apps/new_installer/res/windows/bin/remove_service.bat 2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/res/windows/bin/remove_service.bat 2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,6 @@
+ at set PATH=%SYSTEMROOT%\System32\;%PATH%
+
+ at echo "Cleaning up"
+ at net stop freenet-darknet
+ at echo "Unregistering Freenet as a system service"
+ at wrapper-windows-x86-32.exe -r ../wrapper.conf

Added: trunk/apps/new_installer/res/windows/bin/start.cmd
===================================================================
--- trunk/apps/new_installer/res/windows/bin/start.cmd  2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/res/windows/bin/start.cmd  2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1,4 @@
+ at echo "Starting Freenet"
+ at set PATH=%SYSTEMROOT%\System32\;%PATH%
+ at net start freenet-darknet
+ at pause

Added: trunk/apps/new_installer/res/windows/bin/stop.cmd
===================================================================
--- trunk/apps/new_installer/res/windows/bin/stop.cmd   2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/res/windows/bin/stop.cmd   2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1,4 @@
+ at echo "Stopping Freenet"
+ at set PATH=%SYSTEMROOT%\System32\;%PATH%
+ at net stop freenet-darknet
+ at pause

Added: trunk/apps/new_installer/res/windows/bin/wget.exe
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/windows/bin/wget.exe
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/windows/bin/wrapper-windows-x86-32.exe
===================================================================
(Binary files differ)


Property changes on: 
trunk/apps/new_installer/res/windows/bin/wrapper-windows-x86-32.exe
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/windows/freenet.ico
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/windows/freenet.ico
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/windows/lib/wrapper.dll
===================================================================
(Binary files differ)


Property changes on: trunk/apps/new_installer/res/windows/lib/wrapper.dll
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: trunk/apps/new_installer/res/windows/update.cmd
===================================================================
--- trunk/apps/new_installer/res/windows/update.cmd     2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/res/windows/update.cmd     2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1,134 @@
+ at echo off
+::This script is designed for the Windows command line shell, so please don't 
put it into anything else! :)
+::If you want to debug this script by adding pauses and stuff, please do it 
from another batch file, because
+::if you modify this script in any way it will be detected as outdated and 
will be overwritten on the next run.
+::To force a re-download of the latest Freenet .jar, simply delete 
freenet-cvs-snapshot.jar.url before running this script.
+echo -----
+echo - Freenet Windows update script 1.6 by Zero3Cool (zero3cool at 
zerosplayground.dk)
+echo - Thanks to search4answers, Michael Schierl and toad for help and 
feedback.
+echo - This script will automatically update your Freenet installation.
+echo - In case of an unrecoverable error, this script will pause.
+echo -----
+
+::Initialize some stuff
+set MAGICSTRING=INDO
+set RESTART=0
+set PATH=%SYSTEMROOT%\System32\;%PATH%
+
+::Go to our location
+for %%I in (%0) do set LOCATION=%%~dpI
+cd %LOCATION%
+
+::Check if its valid, or at least looks like it
+if not exist freenet.ini goto error2
+if not exist bin\wget.exe goto error2
+echo - Freenet installation found at %LOCATION%
+echo -----
+
+::Get the filename and skip straight to the Freenet update if this is a new 
updater
+for %%I in (%0) do set FILENAME=%%~nxI
+if %FILENAME%==update.new.cmd goto updaterok
+
+::Download latest updater and verify it
+if exist update.new.cmd del update.new.cmd
+echo - Checking for updater updates...
+bin\wget.exe -o NUL 
https://emu.freenetproject.org/svn/trunk/apps/installer/installclasspath/windows/update.cmd
 -O update.new.cmd
+if not exist update.new.cmd goto error1
+find "FREENET W%MAGICSTRING%WS UPDATE SCRIPT" update.new.cmd > NUL
+if errorlevel 1 goto error1
+
+::Check if updater has been updated
+fc update.cmd update.new.cmd > nul
+if not errorlevel 1 goto updaterok
+
+::It has! Run new version and end self
+echo - Updater updated, restarting update...
+echo -----
+start update.new.cmd
+goto veryend
+
+::Updater is up to date, check Freenet
+:updaterok
+echo - Updater is up to date.
+echo -----
+echo - Checking for Freenet updates...
+if exist freenet-cvs-snapshot.jar.new.url del freenet-cvs-snapshot.jar.new.url
+bin\wget.exe -o NUL 
http://downloads.freenetproject.org/alpha/freenet-cvs-snapshot.jar.url -O 
freenet-cvs-snapshot.jar.new.url
+if not exist freenet-cvs-snapshot.jar.new.url goto error3
+FOR %%I IN ("%LOCATION%freenet-cvs-snapshot.jar.url") DO if %%~zI==0 goto 
error3
+
+::Do we have something old to compare with? If not, update right away
+if not exist freenet-cvs-snapshot.jar.url goto updatefreenet
+
+::Compare with current copy
+fc freenet-cvs-snapshot.jar.url freenet-cvs-snapshot.jar.new.url > nul
+if not errorlevel 1 goto noupdate
+
+::New version found, check if the node is currently running
+:updatefreenet
+echo - New version found!
+net start | find "Freenet" > NUL
+if errorlevel 1 goto updatefreenet2 > NUL
+set RESTART=1
+echo - Shutting down Freenet...
+call stop.cmd > NUL
+
+:updatefreenet2
+echo - Downloading new version and updating local installation...
+if exist freenet-cvs-snapshot.jar ren freenet-cvs-snapshot.jar 
freenet-cvs-snapshot.bak.jar
+bin\wget.exe -o NUL -i freenet-cvs-snapshot.jar.new.url -O 
freenet-cvs-snapshot.jar
+if not exist freenet-cvs-snapshot.jar goto error4
+FOR %%I IN ("%LOCATION%freenet-cvs-snapshot.jar") DO if %%~zI==0 goto error4
+if exist freenet-cvs-snapshot.jar.url del freenet-cvs-snapshot.jar.url
+ren freenet-cvs-snapshot.jar.new.url freenet-cvs-snapshot.jar.url
+echo - Freenet updated.
+goto end
+
+:noupdate
+echo - Freenet is up to date.
+goto end
+
+:error1
+echo - Error! Downloaded update script is invalid. Try again later.
+goto end
+
+:error2
+echo - Error! Please run this script from a working Freenet installation.
+echo -----
+pause
+goto veryend
+
+:error3
+echo - Error! Could not download latest Freenet update information. Try again 
later.
+goto end
+
+:error4
+echo - Error! Freenet update failed, trying to restore backup...
+if exist freenet-cvs-snapshot.jar del freenet-cvs-snapshot.jar
+if exist freenet-cvs-snapshot.bak.jar ren freenet-cvs-snapshot.bak.jar 
freenet-cvs-snapshot.jar
+goto end
+
+:end
+echo -----
+echo - Cleaning up...
+if exist freenet-cvs-snapshot.jar.new.url del freenet-cvs-snapshot.jar.new.url
+if exist freenet-cvs-snapshot.bak.jar del freenet-cvs-snapshot.bak.jar
+
+if %RESTART%==0 goto cleanup2
+echo - Restarting Freenet...
+call start.cmd > NUL
+
+:cleanup2
+if %FILENAME%==update.new.cmd goto newend
+if exist update.new.cmd del update.new.cmd
+echo -----
+goto veryend
+
+::If this session was launched by an old updater, replace it now (and force 
exit, or we will leave a command promt open)
+:newend
+copy /Y update.new.cmd update.cmd > NUL
+echo -----
+exit
+
+:veryend
+::FREENET WINDOWS UPDATE SCRIPT

Added: trunk/apps/new_installer/res/wrapper.conf
===================================================================
--- trunk/apps/new_installer/res/wrapper.conf   2006-07-25 19:47:22 UTC (rev 
9759)
+++ trunk/apps/new_installer/res/wrapper.conf   2006-07-25 20:03:22 UTC (rev 
9760)
@@ -0,0 +1,47 @@
+wrapper.java.command=java
+wrapper.working.dir=../
+wrapper.java.mainclass=freenet.node.NodeStarter
+wrapper.java.classpath.1=freenet-cvs-snapshot.jar
+wrapper.java.classpath.2=freenet-ext.jar
+wrapper.java.library.path.1=lib
+wrapper.java.initmemory=60
+wrapper.java.maxmemory=128
+wrapper.app.parameter.1=freenet.ini
+wrapper.console.format=PM
+wrapper.console.loglevel=INFO
+wrapper.logfile=wrapper.log
+wrapper.logfile.format=LPTM
+wrapper.logfile.loglevel=INFO
+wrapper.logfile.maxsize=2M
+wrapper.logfile.maxfiles=3
+wrapper.syslog.loglevel=NONE
+wrapper.console.title=Freenet 0.7
+wrapper.jvm_exit.timeout=120
+wrapper.restart.reload_configuration=TRUE
+wrapper.filter.trigger.1=java.lang.OutOfMemoryError
+wrapper.filter.action.1=RESTART
+
+# Name of the service
+wrapper.ntservice.name=freenet-darknet
+
+# Display name of the service
+wrapper.ntservice.displayname=Freenet 0.7 darknet
+
+# Description of the service
+wrapper.ntservice.description=The Free Network Project daemon
+
+# Service dependencies.  Add dependencies as needed starting from 1
+wrapper.ntservice.dependency.1=
+
+# Mode in which the service is installed.  AUTO_START or DEMAND_START
+wrapper.ntservice.starttype=AUTO_START
+
+# Allow the service to interact with the desktop.
+wrapper.ntservice.interactive=false
+
+# Start services with a different user than SYSTEM
+# SEE 
http://wrapper.tanukisoftware.org/doc/english/prop-ntservice-account.html 
BEFORE PROCEEDING !
+
+#wrapper.ntservice.account=
+
+wrapper.ntservice.process_priority=BELOW_NORMAL

Added: trunk/apps/new_installer/src/BareBonesBrowserLaunch.java
===================================================================
--- trunk/apps/new_installer/src/BareBonesBrowserLaunch.java    2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/src/BareBonesBrowserLaunch.java    2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,45 @@
+///////////////////////////////////////////////////////// // Bare Bones 
Browser Launch // // Version 1.5 // // December 10, 2005 // // Supports: Mac OS 
X, GNU/Linux, Unix, Windows XP // // Example Usage: // // String url = 
"http://www.centerkey.com/";;
+// // BareBonesBrowserLaunch.openURL(url);
+// // Public Domain Software -- Free to Use as You Like // 
/////////////////////////////////////////////////////////
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import javax.swing.JOptionPane;
+public class BareBonesBrowserLaunch {
+       private static final String errMsg = "Error attempting to launch web 
browser";
+       public static void main(String arg[]) {
+               String url = arg[0];
+               String osName = System.getProperty("os.name");
+               try {
+                       if (osName.startsWith("Mac OS")) {
+                               Class fileMgr = 
Class.forName("com.apple.eio.FileManager");
+                               Method openURL = 
fileMgr.getDeclaredMethod("openURL", new Class[] {
+                                       String.class
+                               }
+                               );
+                               openURL.invoke(null, new Object[] {
+                                       url}
+                                       );
+                       }
+                       else if (osName.startsWith("Windows")) 
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
+                       else {
+                               //assume Unix or Linux
+                               String[] browsers = {"firefox", "opera", 
"konqueror", "epiphany", "mozilla", "netscape" }
+                               ;
+                               String browser = null;
+                               for (int count = 0;
+                                               count < browsers.length && 
browser == null;
+                                               count++) if 
(Runtime.getRuntime().exec( new String[] {
+                                       "which", browsers[count]}
+                                       ).waitFor() == 0) browser = 
browsers[count];
+                                               if (browser == null) throw new 
Exception("Could not find web browser");
+                                               else 
Runtime.getRuntime().exec(new String[] {
+                                                       browser, url}
+                                                       );
+                       }
+               }
+               catch (Exception e) {
+                       JOptionPane.showMessageDialog(null, errMsg + ":\n" + 
e.getLocalizedMessage());
+               }
+       }
+}
+

Added: trunk/apps/new_installer/src/Sha1Test.java
===================================================================
--- trunk/apps/new_installer/src/Sha1Test.java  2006-07-25 19:47:22 UTC (rev 
9759)
+++ trunk/apps/new_installer/src/Sha1Test.java  2006-07-25 20:03:22 UTC (rev 
9760)
@@ -0,0 +1,132 @@
+import java.io.*;
+import java.net.*;
+import freenet.support.HexUtil;
+import gnu.crypto.hash.*;
+import com.izforge.izpack.util.AbstractUIProcessHandler;
+
+public class Sha1Test {
+       protected static int BUFFERSIZE=8192;
+       private static final String base = new 
String("http://downloads.freenetproject.org/alpha/";);
+
+       public static void run(AbstractUIProcessHandler handler, String[] args){
+               main(args);
+       }
+
+       public static void main(String[] args) {
+               final String URI2 = args[0];
+               final String path = args[1]+"/";
+               int count = 0;
+               if(URI2 == null) System.exit(2);
+
+               String filename = (new File(URI2)).getName();
+               System.out.println("Fetching "+filename);
+
+               while(count<10){
+                       if(count>0)
+                               System.out.println("Attempt "+count);
+                       try{
+                               get(URI2+".sha1", path+filename+".sha1");
+                               if(sha1test(path+filename)) System.exit(0);
+                               get(URI2, path+filename);
+                       }catch(FileNotFoundException e){
+                               System.out.println("Not found, ignoring");
+                       }
+                       count++;
+                       try{
+                               Thread.sleep(5000);
+                       }catch(Exception e){
+                       }
+               }
+               System.out.println("No mirror is available at the moment, 
please try again later");
+               System.exit(1);
+       }
+
+       public static boolean sha1test(String file) {
+               Sha160 hash=new Sha160();
+               try{
+                       FileInputStream fis = null;
+                       BufferedInputStream bis = null;
+                       String result=new String();
+
+                       // We compute the hash
+                       // 
http://java.sun.com/developer/TechTips/1998/tt0915.html#tip2
+                       try {
+                               fis = new FileInputStream(file);
+                               bis = new BufferedInputStream(fis);
+                               int len = 0;
+                               byte[] buffer = new byte[BUFFERSIZE];
+                               while ((len = bis.read(buffer)) > -1) {
+                                       hash.update(buffer,0,len);
+                               }
+                       } finally {
+                               if (bis != null) bis.close();
+                               if (fis != null) fis.close();
+                       }
+
+                       // We read the hash-file
+                       try {
+                               fis = new FileInputStream(file+".sha1");
+                               bis = new BufferedInputStream(fis);
+                               int len = 0;
+                               byte[] buffer = new byte[BUFFERSIZE];
+                               while ((len = bis.read(buffer)) > -1) {
+                                       result+=new String(buffer,0,len);
+                               }
+                       } finally {
+                               if (bis != null) bis.close();
+                               if (fis != null) fis.close();
+                       }
+
+
+                       // now we compare
+                       byte[] digest=new byte[160];
+                       digest=hash.digest();
+
+                       int i=result.indexOf(' ');
+                       result=result.substring(0,i);
+                       if(result.equalsIgnoreCase(HexUtil.bytesToHex(digest))){
+                               return true;
+                       }else {
+                               return false;
+                       }
+
+               }catch (Exception e){
+                       return false;
+               }
+       }
+
+
+       public static void get(String file, String filename) throws 
FileNotFoundException{
+               URL url;
+               InputStream is = null;
+               DataInputStream dis;
+               String s;
+
+               try {
+                       url = new URL(base+file);
+                       is = url.openStream();         // throws an IOException
+                       dis = new DataInputStream(new BufferedInputStream(is));
+                       File f = new File(filename);
+                       BufferedOutputStream os = new BufferedOutputStream(new 
FileOutputStream(f));
+                       int b;
+                       while ((b = dis.read()) != -1) {
+                               os.write(b);
+                       }
+                       os.close();
+
+               } catch (MalformedURLException mue) {
+
+                       System.out.println("Ouch - a MalformedURLException 
happened.");
+                       mue.printStackTrace();
+                       System.exit(2);
+
+               } catch (Exception ioe) {
+                       System.out.println(ioe);
+               } finally {
+                       try {
+                               if(is != null) is.close();
+                       } catch (IOException ioe) {
+                       }
+               }
+       }
+}

Added: trunk/apps/new_installer/src/Uncompress.java
===================================================================
--- trunk/apps/new_installer/src/Uncompress.java        2006-07-25 19:47:22 UTC 
(rev 9759)
+++ trunk/apps/new_installer/src/Uncompress.java        2006-07-25 20:03:22 UTC 
(rev 9760)
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2001 Matthew Feldt. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided the copyright notice above is
+ * retained.
+ *
+ * THIS SOFTWARE IS PROVIDED ''AS IS'' AND WITHOUT ANY EXPRESSED OR
+ * IMPLIED WARRANTIES.
+ */
+
+import java.io.*;
+import java.util.zip.*;
+
+class Uncompress {
+       public static void gunzipFile(String from, String to)
+                   throws IllegalArgumentException, IOException {
+               byte[] buffer = new byte[4096];
+               int bytes_read;
+
+               // check input file
+               File fin = new File(from);
+               if (! fin.exists())
+                       throw new IllegalArgumentException(from + " does not 
exist.");
+               if (! fin.canRead())
+                       throw new IllegalArgumentException(from + " read 
protected.");
+               GZIPInputStream in = new GZIPInputStream(new 
FileInputStream(from));
+
+               File fout = new File(to);
+               if (fout.exists()) // don't overwrite existing files
+                       throw new IllegalArgumentException("File '" + to + "' 
already exisits.");
+               FileOutputStream out = new FileOutputStream(to);
+
+               while ((bytes_read = in.read(buffer)) != -1) // write file
+                       out.write(buffer, 0, bytes_read);
+
+               in.close();
+               out.close();
+    }
+
+       public static void unzipFile(String from, String to)
+                   throws IllegalArgumentException, IOException {
+               byte[] buffer = new byte[4096];
+               int bytes_read;
+
+               // check input file
+               File fin = new File(from);
+               if (! fin.exists())
+                       throw new IllegalArgumentException(from + " does not 
exist.");
+               if (! fin.canRead())
+                       throw new IllegalArgumentException(from + " read 
protected.");
+               ZipInputStream in = new ZipInputStream(new 
FileInputStream(from));
+               ZipEntry entry;
+               FileOutputStream out;
+
+               while ((entry = in.getNextEntry()) != null) {
+                       String toName = to + File.separator + entry.getName();
+                       File fout = new File(toName);
+                       if (fout.exists()) { // don't overwrite existing files 
and continue
+                       System.err.println("File '" + toName + "' already 
exists.");
+                               continue;
+                       }
+
+                       if (entry.isDirectory()) { // create directory for 
directory entries
+                               if (! fout.mkdirs()) {
+                                       System.err.println("Unable to create 
directory: " + toName);
+                                       System.exit(-1);
+                               }
+                       } else { // write file
+                           out = new FileOutputStream(toName);
+                       while ((bytes_read = in.read(buffer)) != -1)
+                               out.write(buffer, 0, bytes_read);
+                           out.close();
+                       }
+                       System.out.println(toName);
+               }
+               in.close();
+    }
+
+       /** test class */
+       public static class Test {
+        public static void main (String args[]) {
+                       final String usage = "Usage: java Uncompress$Test 
<source> [<dest>]";
+                       String from, to = "";
+
+                       if ((args.length != 1) && (args.length != 2)) {
+                           fail(usage);
+                   }
+                       from = args[0];
+
+               try {
+                           if (args.length == 2) {
+                               to = args[1];
+                       }
+
+                       // suffix .gz indicates gzipped file
+                               if (from.substring(from.length()-3, 
from.length()).equals(".gz")) {
+                                       if (to.equals("")) // create 'to' if 
not supplied
+                                               to = new 
String(from.substring(0, from.length()-3));
+                                   Uncompress.gunzipFile(from, to); // gunzip
+                               // suffix .zip indicates zipped file
+                           } else if (from.substring(from.length()-4, 
from.length()).equals(".zip")) {
+                               if (to.equals("")) // create 'to' if not 
supplied
+                                               // zip archives contain file 
name entries so 'to'
+                                               // should be a directory
+                                               to = new String(".");
+                               Uncompress.unzipFile(from, to); // unzip
+                               } else {
+                                   fail("Expecting .zip or .gz file 
extension.");
+                       }
+               } catch(IOException e) {
+                               System.err.println(e.getMessage());
+                           System.exit(-1);
+                   } catch(IllegalArgumentException e) {
+                               System.err.println(e.getMessage());
+                               System.exit(-1);
+                   }
+           }
+
+               /** shorthand method to throw an exception with the appropriate 
message */
+           protected static void fail(String msg) throws 
IllegalArgumentException {
+                   throw new IllegalArgumentException(msg);
+           }
+       }
+}

Added: trunk/apps/new_installer/src/freenet/support/HexUtil.java
===================================================================
--- trunk/apps/new_installer/src/freenet/support/HexUtil.java   2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/src/freenet/support/HexUtil.java   2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,215 @@
+package freenet.support;
+
+import java.io.DataInputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.util.BitSet;
+
+/**
+ * Number in hexadecimal format are used throughout Freenet.
+ * 
+ * <p>Unless otherwise stated, the conventions follow the rules outlined in 
the 
+ * Java Language Specification.</p>
+ * 
+ * @author syoung
+ */
+public class HexUtil {
+       private HexUtil() {             
+       }       
+       
+
+       /**
+        * Converts a byte array into a string of upper case hex chars.
+        * 
+        * @param bs
+        *            A byte array
+        * @param off
+        *            The index of the first byte to read
+        * @param length
+        *            The number of bytes to read.
+        * @return the string of hex chars.
+        */
+       public static final String bytesToHex(byte[] bs, int off, int length) {
+               StringBuffer sb = new StringBuffer(length * 2);
+               bytesToHexAppend(bs, off, length, sb);
+               return sb.toString();
+       }
+
+       public static final void bytesToHexAppend(
+               byte[] bs,
+               int off,
+               int length,
+               StringBuffer sb) {
+               sb.ensureCapacity(sb.length() + length * 2);
+               for (int i = off; i < (off + length) && i < bs.length; i++) {
+                       sb.append(Character.forDigit((bs[i] >>> 4) & 0xf, 16));
+                       sb.append(Character.forDigit(bs[i] & 0xf, 16));
+               }
+       }
+
+       public static final String bytesToHex(byte[] bs) {
+               return bytesToHex(bs, 0, bs.length);
+       }
+
+       public static final byte[] hexToBytes(String s) {
+               return hexToBytes(s, 0);
+       }
+
+       public static final byte[] hexToBytes(String s, int off) {
+               byte[] bs = new byte[off + (1 + s.length()) / 2];
+               hexToBytes(s, bs, off);
+               return bs;
+       }
+
+       /**
+        * Converts a String of hex characters into an array of bytes.
+        * 
+        * @param s
+        *            A string of hex characters (upper case or lower) of even
+        *            length.
+        * @param out
+        *            A byte array of length at least s.length()/2 + off
+        * @param off
+        *            The first byte to write of the array
+        */
+       public static final void hexToBytes(String s, byte[] out, int off)
+               throws NumberFormatException, IndexOutOfBoundsException {
+               int slen = s.length();
+               if ((slen % 2) != 0) {
+                       s = '0' + s;
+               }
+
+               if (out.length < off + slen / 2) {
+                       throw new IndexOutOfBoundsException(
+                               "Output buffer too small for input ("
+                                       + out.length
+                                       + "<"
+                                       + off
+                                       + slen / 2
+                                       + ")");
+               }
+
+               // Safe to assume the string is even length
+               byte b1, b2;
+               for (int i = 0; i < slen; i += 2) {
+                       b1 = (byte) Character.digit(s.charAt(i), 16);
+                       b2 = (byte) Character.digit(s.charAt(i + 1), 16);
+                       if (b1 < 0 || b2 < 0) {
+                               throw new NumberFormatException();
+                       }
+                       out[off + i / 2] = (byte) (b1 << 4 | b2);
+               }
+       }
+
+       /**
+        * Pack the bits in ba into a byte[].
+        */
+       public final static byte[] bitsToBytes(BitSet ba, int size) {
+               int bytesAlloc = countBytesForBits(size);
+               byte[] b = new byte[bytesAlloc];
+               StringBuffer sb =null;
+               for(int i=0;i<b.length;i++) {
+                       short s = 0;
+                       for(int j=0;j<8;j++) {
+                               int idx = i*8+j;
+                               boolean val = 
+                                       idx > size ? false :
+                                               ba.get(idx);
+                               s |= val ? (1<<j) : 0;
+                               if(sb != null) sb.append(val ? '1' : '0');
+                       }
+                       if(s > 255) throw new IllegalStateException("WTF? s = 
"+s);
+                       b[i] = (byte)s;
+               }
+               return b;
+       }
+
+       /**
+        * Pack the bits in ba into a byte[] then convert that
+        * to a hex string and return it.
+        */
+       public final static String bitsToHexString(BitSet ba, int size) {
+               return bytesToHex(bitsToBytes(ba, size));
+       }
+
+
+       /**
+        * @return the number of bytes required to represent the
+        * bitset
+        */
+       public static int countBytesForBits(int size) {
+               // Brackets matter here! == takes precedence over the rest
+               return (size/8) + ((size % 8) == 0 ? 0:1);
+       }
+
+
+       /**
+        * Read bits from a byte array into a bitset
+        * @param b the byte[] to read from
+        * @param ba the bitset to write to
+        */
+       public static void bytesToBits(byte[] b, BitSet ba, int maxSize) {
+               int x = 0;
+               for(int i=0;i<b.length;i++) {
+                       for(int j=0;j<8;j++) {
+                               if(x > maxSize) break;
+                               int mask = 1 << j;
+                               boolean value = (mask & b[i]) != 0;
+                               ba.set(x, value);
+                               x++;
+                       }
+               }
+       }
+
+
+       /**
+        * Read a hex string of bits and write it into a bitset
+        * @param s hex string of the stored bits
+        * @param ba the bitset to store the bits in
+        * @param length the maximum number of bits to store 
+        */
+       public static void hexToBits(String s, BitSet ba, int length) {
+               byte[] b = hexToBytes(s);
+               bytesToBits(b, ba, length);
+       }
+       
+       /**
+     * Write a (reasonably short) BigInteger to a stream.
+     * @param integer the BigInteger to write
+     * @param out the stream to write it to
+     */
+    public static void writeBigInteger(BigInteger integer, DataOutputStream 
out) throws IOException {
+        if(integer.signum() == -1) {
+            throw new IllegalStateException("Negative BigInteger!");
+        }
+        byte[] buf = integer.toByteArray();
+        if(buf.length > Short.MAX_VALUE)
+            throw new IllegalStateException("Too long: "+buf.length);
+        out.writeShort((short)buf.length);
+        out.write(buf);
+    }
+
+    /**
+        * Read a (reasonably short) BigInteger from a DataInputStream
+        * @param dis the stream to read from
+        * @return a BigInteger
+        */
+       public static BigInteger readBigInteger(DataInputStream dis) throws 
IOException {
+           short i = dis.readShort();
+           if(i < 0) throw new IOException("Invalid BigInteger length: "+i);
+           byte[] buf = new byte[i];
+           dis.readFully(buf);
+           return new BigInteger(1,buf);
+       }
+
+
+    /**
+     * Turn a BigInteger into a hex string.
+     * BigInteger.toString(16) NPEs on Sun JDK 1.4.2_05. :<
+     * The bugs in their Big* are getting seriously irritating...
+     */
+    public static String biToHex(BigInteger bi) {
+        return bytesToHex(bi.toByteArray());
+    }
+}

Added: trunk/apps/new_installer/src/gnu/crypto/Registry.java
===================================================================
--- trunk/apps/new_installer/src/gnu/crypto/Registry.java       2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/src/gnu/crypto/Registry.java       2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,364 @@
+package gnu.crypto;
+
+// ----------------------------------------------------------------------------
+// $Id: Registry.java.in,v 1.4 2005/10/06 04:24:13 rsdio Exp $
+//
+// Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+//
+// This file is part of GNU Crypto.
+//
+// GNU Crypto is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GNU Crypto is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING.  If not, write to the
+//
+//    Free Software Foundation Inc.,
+//    51 Franklin Street, Fifth Floor,
+//    Boston, MA 02110-1301
+//    USA
+//
+// Linking this library statically or dynamically with other modules is
+// making a combined work based on this library.  Thus, the terms and
+// conditions of the GNU General Public License cover the whole
+// combination.
+//
+// As a special exception, the copyright holders of this library give
+// you permission to link this library with independent modules to
+// produce an executable, regardless of the license terms of these
+// independent modules, and to copy and distribute the resulting
+// executable under terms of your choice, provided that you also meet,
+// for each linked independent module, the terms and conditions of the
+// license of that module.  An independent module is a module which is
+// not derived from or based on this library.  If you modify this
+// library, you may extend this exception to your version of the
+// library, but you are not obligated to do so.  If you do not wish to
+// do so, delete this exception statement from your version.
+// ----------------------------------------------------------------------------
+
+/**
+ * A placeholder for <i>names</i> and <i>literals</i> used throughout this
+ * library.
+ *
+ * @version $Revision: 1.4 $
+ */
+public interface Registry {
+
+   // Constants
+   // -------------------------------------------------------------------------
+
+   /** The name of our Providers. */
+   String GNU_CRYPTO   = "GNU-CRYPTO";
+   String GNU_SASL     = "GNU-SASL";
+   String GNU_SECURITY = "GNU-SECURITY";
+
+   /** Our version number. */
+   String VERSION_STRING = "@VERSION@@PRERELEASE@";
+
+   // Names of properties to use in Maps when initialising primitives .........
+
+   // Symmetric block cipher algorithms and synonyms...........................
+
+   String ANUBIS_CIPHER =    "anubis";
+   String BLOWFISH_CIPHER =  "blowfish";
+   String DES_CIPHER =       "des";
+   String KHAZAD_CIPHER =    "khazad";
+   String RIJNDAEL_CIPHER =  "rijndael";
+   String SERPENT_CIPHER =   "serpent";
+   String SQUARE_CIPHER =    "square";
+   String TRIPLEDES_CIPHER = "tripledes";
+   String TWOFISH_CIPHER =   "twofish";
+   String CAST5_CIPHER =     "cast5";
+   String NULL_CIPHER =      "null";
+
+   /** AES is synonymous to Rijndael for 128-bit block size only. */
+   String AES_CIPHER = "aes";
+
+   /** TripleDES is also known as DESede. */
+   String DESEDE_CIPHER = "desede";
+
+   /** CAST5 is also known as CAST-128. */
+   String CAST128_CIPHER =  "cast128";
+   String CAST_128_CIPHER = "cast-128";
+
+   // Message digest algorithms and synonyms...................................
+
+   String WHIRLPOOL_HASH = "whirlpool";
+   String RIPEMD128_HASH = "ripemd128";
+   String RIPEMD160_HASH = "ripemd160";
+   String SHA160_HASH =    "sha-160";
+   String SHA256_HASH =    "sha-256";
+   String SHA384_HASH =    "sha-384";
+   String SHA512_HASH =    "sha-512";
+   String TIGER_HASH =     "tiger";
+   String HAVAL_HASH =     "haval";
+   String MD5_HASH =       "md5";
+   String MD4_HASH =       "md4";
+   String MD2_HASH =       "md2";
+
+   /** RIPEMD-128 is synonymous to RIPEMD128. */
+   String RIPEMD_128_HASH = "ripemd-128";
+
+   /** RIPEMD-160 is synonymous to RIPEMD160. */
+   String RIPEMD_160_HASH = "ripemd-160";
+
+   /** SHA-1 is synonymous to SHA-160. */
+   String SHA_1_HASH = "sha-1";
+
+   /** SHA1 is synonymous to SHA-160. */
+   String SHA1_HASH = "sha1";
+
+   /** SHA is synonymous to SHA-160. */
+   String SHA_HASH = "sha";
+
+   // Symmetric block cipher modes of operations...............................
+
+   /** Electronic CodeBook mode. */
+   String ECB_MODE = "ecb";
+
+   /** Counter (NIST) mode. */
+   String CTR_MODE = "ctr";
+
+   /** Integer Counter Mode (David McGrew). */
+   String ICM_MODE = "icm";
+
+   /** Output Feedback Mode (NIST). */
+   String OFB_MODE = "ofb";
+
+   /** Cipher block chaining mode (NIST). */
+   String CBC_MODE = "cbc";
+
+   /** Cipher feedback mode (NIST). */
+   String CFB_MODE = "cfb";
+
+   /** Authenticated-Encrypted mode. */
+   String EAX_MODE = "eax";
+
+   // Padding scheme names and synonyms........................................
+
+   /** PKCS#7 padding scheme. */
+   String PKCS7_PAD = "pkcs7";
+
+   /** Trailing Bit Complement padding scheme. */
+   String TBC_PAD = "tbc";
+
+   /** EME-PKCS1-v1_5 padding as described in section 7.2 in RFC-3447. */
+   String EME_PKCS1_V1_5_PAD = "eme-pkcs1-v1.5";
+
+   /** SSLv3 padding scheme. */
+   String SSL3_PAD = "ssl3";
+
+   /** TLSv1 padding scheme. */
+   String TLS1_PAD = "tls1";
+
+   // Pseudo-random number generators..........................................
+
+   /** (Apparently) RC4 keystream PRNG. */
+   String ARCFOUR_PRNG = "arcfour";
+
+   /** We use "rc4" as an alias for "arcfour". */
+   String RC4_PRNG = "rc4";
+
+   /** PRNG based on David McGrew's Integer Counter Mode. */
+   String ICM_PRNG = "icm";
+
+   /** PRNG based on a designated hash function. */
+   String MD_PRNG = "md";
+
+   /** PRNG based on UMAC's Key Derivation Function. */
+   String UMAC_PRNG = "umac-kdf";
+
+   /**
+    * PRNG based on PBKDF2 from PKCS #5 v.2. This is suffixed with the name
+    * of a MAC to be used as a PRF.
+    */
+   String PBKDF2_PRNG_PREFIX = "pbkdf2-";
+
+   /** The continuously-seeded pseudo-random number generator. */
+   String CSPRNG_PRNG = "csprng";
+
+   /** The Fortuna PRNG. */
+   String FORTUNA_PRNG = "fortuna";
+
+   /** The Fortuna generator PRNG. */
+   String FORTUNA_GENERATOR_PRNG = "fortuna-generator";
+
+   // Asymmetric keypair generators............................................
+
+   String DSS_KPG =  "dss";
+   String RSA_KPG =  "rsa";
+   String DH_KPG =   "dh";
+   String SRP_KPG =  "srp";
+
+   /** DSA is synonymous to DSS. */
+   String DSA_KPG = "dsa";
+
+   // Signature-with-appendix schemes..........................................
+
+   String DSS_SIG =            "dss";
+   String RSA_PSS_SIG =        "rsa-pss";
+   String RSA_PKCS1_V1_5_SIG = "rsa-pkcs1-v1.5";
+
+   /** DSA is synonymous to DSS. */
+   String DSA_SIG = "dsa";
+
+   // Key agreement protocols .................................................
+
+   String DH_KA =       "dh";
+   String ELGAMAL_KA =  "elgamal";
+   String SRP6_KA =     "srp6";
+   String SRP_SASL_KA = "srp-sasl";
+   String SRP_TLS_KA =  "srp-tls";
+
+   // Keyed-Hash Message Authentication Code ..................................
+
+   /** Name prefix of every HMAC implementation. */
+   String HMAC_NAME_PREFIX = "hmac-";
+
+   // Other MAC algorithms ....................................................
+
+   /** The One-key CBC MAC. */
+   String OMAC_PREFIX = "omac-";
+
+   /** Message Authentication Code using Universal Hashing (Ted Krovetz). */
+   String UHASH32 = "uhash32";
+   String UMAC32 = "umac32";
+   /** The Truncated Multi-Modular Hash Function -v1 (David McGrew). */
+   String TMMH16 = "tmmh16";
+//   String TMMH32 = "tmmh32";
+
+   // Format IDs used to identify how we externalise asymmetric keys ..........
+   String RAW_ENCODING = "gnu.crypto.raw.format";
+   int RAW_ENCODING_ID = 1;
+
+   // Magic bytes we generate/expect in externalised asymmetric keys ..........
+   // the four bytes represent G (0x47) for GNU, 1 (0x01) for Raw format,
+   // D (0x44) for DSS, R (0x52) for RSA, H (0x48) for Diffie-Hellman, or S
+   // (0x53) for SRP-6, and finally P (0x50) for Public, p (0x70) for private,
+   // or S (0x53) for signature.
+   byte[] MAGIC_RAW_DSS_PUBLIC_KEY =    new byte[] {0x47, RAW_ENCODING_ID, 
0x44, 0x50};
+   byte[] MAGIC_RAW_DSS_PRIVATE_KEY =   new byte[] {0x47, RAW_ENCODING_ID, 
0x44, 0x70};
+   byte[] MAGIC_RAW_DSS_SIGNATURE =     new byte[] {0x47, RAW_ENCODING_ID, 
0x44, 0x53};
+   byte[] MAGIC_RAW_RSA_PUBLIC_KEY =    new byte[] {0x47, RAW_ENCODING_ID, 
0x52, 0x50};
+   byte[] MAGIC_RAW_RSA_PRIVATE_KEY =   new byte[] {0x47, RAW_ENCODING_ID, 
0x52, 0x70};
+   byte[] MAGIC_RAW_RSA_PSS_SIGNATURE = new byte[] {0x47, RAW_ENCODING_ID, 
0x52, 0x53};
+
+   byte[] MAGIC_RAW_DH_PUBLIC_KEY =     new byte[] {0x47, RAW_ENCODING_ID, 
0x48, 0x50};
+   byte[] MAGIC_RAW_DH_PRIVATE_KEY =    new byte[] {0x47, RAW_ENCODING_ID, 
0x48, 0x70};
+
+   byte[] MAGIC_RAW_SRP_PUBLIC_KEY =    new byte[] {0x47, RAW_ENCODING_ID, 
0x53, 0x50};
+   byte[] MAGIC_RAW_SRP_PRIVATE_KEY =   new byte[] {0x47, RAW_ENCODING_ID, 
0x53, 0x70};
+
+   // SASL Property names .....................................................
+
+   String SASL_PREFIX = "gnu.crypto.sasl";
+
+   /** Name of username property. */
+   String SASL_USERNAME = SASL_PREFIX + ".username";
+
+   /** Name of password property. */
+   String SASL_PASSWORD = SASL_PREFIX + ".password";
+
+   /** Name of authentication information provider packages. */
+   String SASL_AUTH_INFO_PROVIDER_PKGS = SASL_PREFIX + 
".auth.info.provider.pkgs";
+
+   /** SASL authorization ID. */
+   String SASL_AUTHORISATION_ID = SASL_PREFIX + ".authorisation.ID";
+
+   /** SASL protocol. */
+   String SASL_PROTOCOL = SASL_PREFIX + ".protocol";
+
+   /** SASL Server name. */
+   String SASL_SERVER_NAME = SASL_PREFIX + ".server.name";
+
+   /** SASL Callback handler. */
+   String SASL_CALLBACK_HANDLER = SASL_PREFIX + ".callback.handler";
+
+   /** SASL channel binding. */
+   String SASL_CHANNEL_BINDING = SASL_PREFIX + ".channel.binding";
+
+   // SASL data element size limits ...........................................
+
+   /** The size limit, in bytes, of a SASL OS (Octet Sequence) element. */
+   int SASL_ONE_BYTE_MAX_LIMIT = 255;
+
+   /**
+    * The size limit, in bytes, of both a SASL MPI (Multi-Precision Integer)
+    * element and a SASL Text element.
+    */
+   int SASL_TWO_BYTE_MAX_LIMIT = 65535;
+
+   /** The size limit, in bytes, of a SASL EOS (Extended Octet Sequence) 
element. */
+   int SASL_FOUR_BYTE_MAX_LIMIT = 2147483383;
+
+   /** The size limit, in bytes, of a SASL Buffer. */
+   int SASL_BUFFER_MAX_LIMIT = 2147483643;
+
+   // Canonical names of SASL mechanisms ......................................
+
+   String SASL_ANONYMOUS_MECHANISM = "ANONYMOUS";
+   String SASL_CRAM_MD5_MECHANISM = "CRAM-MD5";
+   String SASL_PLAIN_MECHANISM = "PLAIN";
+   String SASL_SRP_MECHANISM = "SRP";
+
+   // Canonical names of Integrity Protection algorithms ......................
+
+   String SASL_HMAC_MD5_IALG = "HMACwithMD5";
+   String SASL_HMAC_SHA_IALG = "HMACwithSHA";
+
+   // Quality Of Protection string representations ............................
+
+   /** authentication only. */
+   String QOP_AUTH = "auth";
+   /** authentication plus integrity protection. */
+   String QOP_AUTH_INT = "auth-int";
+   /** authentication plus integrity and confidentiality protection. */
+   String QOP_AUTH_CONF = "auth-conf";
+
+   // SASL mechanism strength string representation ...........................
+
+   String STRENGTH_HIGH = "high";
+   String STRENGTH_MEDIUM = "medium";
+   String STRENGTH_LOW = "low";
+
+   // SASL Server Authentication requirement ..................................
+
+   /** Server must authenticate to the client. */
+   String SERVER_AUTH_TRUE = "true";
+   /** Server does not need to, or cannot, authenticate to the client. */
+   String SERVER_AUTH_FALSE = "false";
+
+   // SASL mechanism reuse capability .........................................
+
+   String REUSE_TRUE = "true";
+   String REUSE_FALSE = "false";
+
+   // Keyrings  ...............................................................
+
+   byte[] GKR_MAGIC = new byte[] { 0x47, 0x4b, 0x52, 0x01 };
+
+   // Ring usage fields.
+   int GKR_PRIVATE_KEYS       = 1 << 0;
+   int GKR_PUBLIC_CREDENTIALS = 1 << 1;
+   int GKR_CERTIFICATES       = 1 << 2;
+
+   // HMac types.
+   int GKR_HMAC_MD5_128 = 0;
+   int GKR_HMAC_SHA_160 = 1;
+   int GKR_HMAC_MD5_96  = 2;
+   int GKR_HMAC_SHA_96  = 3;
+
+   // Cipher types.
+   int GKR_CIPHER_AES_128_OFB = 0;
+   int GKR_CIPHER_AES_128_CBC = 1;
+
+   // Methods
+   // -------------------------------------------------------------------------
+}

Added: trunk/apps/new_installer/src/gnu/crypto/hash/BaseHash.java
===================================================================
--- trunk/apps/new_installer/src/gnu/crypto/hash/BaseHash.java  2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/src/gnu/crypto/hash/BaseHash.java  2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,198 @@
+package gnu.crypto.hash;
+
+// ----------------------------------------------------------------------------
+// $Id: BaseHash.java,v 1.10 2005/10/06 04:24:14 rsdio Exp $
+//
+// Copyright (C) 2001, 2002, Free Software Foundation, Inc.
+//
+// This file is part of GNU Crypto.
+//
+// GNU Crypto is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GNU Crypto is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING.  If not, write to the
+//
+//    Free Software Foundation Inc.,
+//    51 Franklin Street, Fifth Floor,
+//    Boston, MA 02110-1301
+//    USA
+//
+// Linking this library statically or dynamically with other modules is
+// making a combined work based on this library.  Thus, the terms and
+// conditions of the GNU General Public License cover the whole
+// combination.
+//
+// As a special exception, the copyright holders of this library give
+// you permission to link this library with independent modules to
+// produce an executable, regardless of the license terms of these
+// independent modules, and to copy and distribute the resulting
+// executable under terms of your choice, provided that you also meet,
+// for each linked independent module, the terms and conditions of the
+// license of that module.  An independent module is a module which is
+// not derived from or based on this library.  If you modify this
+// library, you may extend this exception to your version of the
+// library, but you are not obligated to do so.  If you do not wish to
+// do so, delete this exception statement from your version.
+// ----------------------------------------------------------------------------
+
+/**
+ * <p>A base abstract class to facilitate hash implementations.</p>
+ *
+ * @version $Revision: 1.10 $
+ */
+public abstract class BaseHash implements IMessageDigest {
+
+   // Constants and variables
+   // -------------------------------------------------------------------------
+
+   /** The canonical name prefix of the hash. */
+   protected String name;
+
+   /** The hash (output) size in bytes. */
+   protected int hashSize;
+
+   /** The hash (inner) block size in bytes. */
+   protected int blockSize;
+
+   /** Number of bytes processed so far. */
+   protected long count;
+
+   /** Temporary input buffer. */
+   protected byte[] buffer;
+
+   // Constructor(s)
+   // -------------------------------------------------------------------------
+
+   /**
+    * <p>Trivial constructor for use by concrete subclasses.</p>
+    *
+    * @param name the canonical name prefix of this instance.
+    * @param hashSize the block size of the output in bytes.
+    * @param blockSize the block size of the internal transform.
+    */
+   protected BaseHash(String name, int hashSize, int blockSize) {
+      super();
+
+      this.name = name;
+      this.hashSize = hashSize;
+      this.blockSize = blockSize;
+      this.buffer = new byte[blockSize];
+
+      resetContext();
+   }
+
+   // Class methods
+   // -------------------------------------------------------------------------
+
+   // Instance methods
+   // -------------------------------------------------------------------------
+
+   // IMessageDigest interface implementation ---------------------------------
+
+   public String name() {
+      return name;
+   }
+
+   public int hashSize() {
+      return hashSize;
+   }
+
+   public int blockSize() {
+      return blockSize;
+   }
+
+   public void update(byte b) {
+      // compute number of bytes still unhashed; ie. present in buffer
+      int i = (int)(count % blockSize);
+      count++;
+      buffer[i] = b;
+      if (i == (blockSize - 1)) {
+         transform(buffer, 0);
+      }
+   }
+
+   public void update(byte[] b) {
+      update(b, 0, b.length);
+   }
+
+   public void update(byte[] b, int offset, int len) {
+      int n = (int)(count % blockSize);
+      count += len;
+      int partLen = blockSize - n;
+      int i = 0;
+
+      if (len >= partLen) {
+         System.arraycopy(b, offset, buffer, n, partLen);
+         transform(buffer, 0);
+         for (i = partLen; i + blockSize - 1 < len; i+= blockSize) {
+            transform(b, offset + i);
+         }
+         n = 0;
+      }
+
+      if (i < len) {
+         System.arraycopy(b, offset + i, buffer, n, len - i);
+      }
+   }
+
+   public byte[] digest() {
+      byte[] tail = padBuffer(); // pad remaining bytes in buffer
+      update(tail, 0, tail.length); // last transform of a message
+      byte[] result = getResult(); // make a result out of context
+
+      reset(); // reset this instance for future re-use
+
+      return result;
+   }
+
+   public void reset() { // reset this instance for future re-use
+      count = 0L;
+      for (int i = 0; i < blockSize; ) {
+         buffer[i++] = 0;
+      }
+
+      resetContext();
+   }
+
+   // methods to be implemented by concrete subclasses ------------------------
+
+   public abstract Object clone();
+
+   public abstract boolean selfTest();
+
+   /**
+    * <p>Returns the byte array to use as padding before completing a hash
+    * operation.</p>
+    *
+    * @return the bytes to pad the remaining bytes in the buffer before
+    * completing a hash operation.
+    */
+   protected abstract byte[] padBuffer();
+
+   /**
+    * <p>Constructs the result from the contents of the current context.</p>
+    *
+    * @return the output of the completed hash operation.
+    */
+   protected abstract byte[] getResult();
+
+   /** Resets the instance for future re-use. */
+   protected abstract void resetContext();
+
+   /**
+    * <p>The block digest transformation per se.</p>
+    *
+    * @param in the <i>blockSize</i> long block, as an array of bytes to 
digest.
+    * @param offset the index where the data to digest is located within the
+    * input buffer.
+    */
+   protected abstract void transform(byte[] in, int offset);
+}

Added: trunk/apps/new_installer/src/gnu/crypto/hash/IMessageDigest.java
===================================================================
--- trunk/apps/new_installer/src/gnu/crypto/hash/IMessageDigest.java    
2006-07-25 19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/src/gnu/crypto/hash/IMessageDigest.java    
2006-07-25 20:03:22 UTC (rev 9760)
@@ -0,0 +1,141 @@
+package gnu.crypto.hash;
+
+// ----------------------------------------------------------------------------
+// $Id: IMessageDigest.java,v 1.11 2005/10/06 04:24:14 rsdio Exp $
+//
+// Copyright (C) 2001, 2002, Free Software Foundation, Inc.
+//
+// This file is part of GNU Crypto.
+//
+// GNU Crypto is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GNU Crypto is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING.  If not, write to the
+//
+//    Free Software Foundation Inc.,
+//    51 Franklin Street, Fifth Floor,
+//    Boston, MA 02110-1301
+//    USA
+//
+// Linking this library statically or dynamically with other modules is
+// making a combined work based on this library.  Thus, the terms and
+// conditions of the GNU General Public License cover the whole
+// combination.
+//
+// As a special exception, the copyright holders of this library give
+// you permission to link this library with independent modules to
+// produce an executable, regardless of the license terms of these
+// independent modules, and to copy and distribute the resulting
+// executable under terms of your choice, provided that you also meet,
+// for each linked independent module, the terms and conditions of the
+// license of that module.  An independent module is a module which is
+// not derived from or based on this library.  If you modify this
+// library, you may extend this exception to your version of the
+// library, but you are not obligated to do so.  If you do not wish to
+// do so, delete this exception statement from your version.
+// ----------------------------------------------------------------------------
+
+/**
+ * <p>The basic visible methods of any hash algorithm.</p>
+ *
+ * <p>A hash (or message digest) algorithm produces its output by iterating a
+ * basic compression function on blocks of data.</p>
+ *
+ * @version $Revision: 1.11 $
+ */
+public interface IMessageDigest extends Cloneable {
+
+   // Constants
+   // -------------------------------------------------------------------------
+
+   // Methods
+   // -------------------------------------------------------------------------
+
+   /**
+    * <p>Returns the canonical name of this algorithm.</p>
+    *
+    * @return the canonical name of this instance.
+    */
+   String name();
+
+   /**
+    * <p>Returns the output length in bytes of this message digest 
algorithm.</p>
+    *
+    * @return the output length in bytes of this message digest algorithm.
+    */
+   int hashSize();
+
+   /**
+    * <p>Returns the algorithm's (inner) block size in bytes.</p>
+    *
+    * @return the algorithm's inner block size in bytes.
+    */
+   int blockSize();
+
+   /**
+    * <p>Continues a message digest operation using the input byte.</p>
+    *
+    * @param b the input byte to digest.
+    */
+   void update(byte b);
+
+   /**
+    * <p>Continues a message digest operation, by filling the buffer, 
processing
+    * data in the algorithm's HASH_SIZE-bit block(s), updating the context and
+    * count, and buffering the remaining bytes in buffer for the next
+    * operation.</p>
+    *
+    * @param in the input block.
+    */
+   void update(byte[] in);
+
+   /**
+    * <p>Continues a message digest operation, by filling the buffer, 
processing
+    * data in the algorithm's HASH_SIZE-bit block(s), updating the context and
+    * count, and buffering the remaining bytes in buffer for the next
+    * operation.</p>
+    *
+    * @param in the input block.
+    * @param offset start of meaningful bytes in input block.
+    * @param length number of bytes, in input block, to consider.
+    */
+   void update(byte[] in, int offset, int length);
+
+   /**
+    * <p>Completes the message digest by performing final operations such as
+    * padding and resetting the instance.</p>
+    *
+    * @return the array of bytes representing the hash value.
+    */
+   byte[] digest();
+
+   /**
+    * <p>Resets the current context of this instance clearing any eventually 
cached
+    * intermediary values.</p>
+    */
+   void reset();
+
+   /**
+    * <p>A basic test. Ensures that the digest of a pre-determined message is 
equal
+    * to a known pre-computed value.</p>
+    *
+    * @return <tt>true</tt> if the implementation passes a basic self-test.
+    * Returns <tt>false</tt> otherwise.
+    */
+   boolean selfTest();
+
+   /**
+    * <p>Returns a clone copy of this instance.</p>
+    *
+    * @return a clone copy of this instance.
+    */
+   Object clone();
+}

Added: trunk/apps/new_installer/src/gnu/crypto/hash/Sha160.java
===================================================================
--- trunk/apps/new_installer/src/gnu/crypto/hash/Sha160.java    2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/src/gnu/crypto/hash/Sha160.java    2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,295 @@
+package gnu.crypto.hash;
+
+// ----------------------------------------------------------------------------
+// $Id: Sha160.java,v 1.10 2005/10/06 04:24:14 rsdio Exp $
+//
+// Copyright (C) 2001, 2002, Free Software Foundation, Inc.
+//
+// This file is part of GNU Crypto.
+//
+// GNU Crypto is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GNU Crypto is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING.  If not, write to the
+//
+//    Free Software Foundation Inc.,
+//    51 Franklin Street, Fifth Floor,
+//    Boston, MA 02110-1301
+//    USA
+//
+// Linking this library statically or dynamically with other modules is
+// making a combined work based on this library.  Thus, the terms and
+// conditions of the GNU General Public License cover the whole
+// combination.
+//
+// As a special exception, the copyright holders of this library give
+// you permission to link this library with independent modules to
+// produce an executable, regardless of the license terms of these
+// independent modules, and to copy and distribute the resulting
+// executable under terms of your choice, provided that you also meet,
+// for each linked independent module, the terms and conditions of the
+// license of that module.  An independent module is a module which is
+// not derived from or based on this library.  If you modify this
+// library, you may extend this exception to your version of the
+// library, but you are not obligated to do so.  If you do not wish to
+// do so, delete this exception statement from your version.
+// ----------------------------------------------------------------------------
+
+import gnu.crypto.Registry;
+import gnu.crypto.util.Util;
+
+/**
+ * <p>The Secure Hash Algorithm (SHA-1) is required for use with the Digital
+ * Signature Algorithm (DSA) as specified in the Digital Signature Standard
+ * (DSS) and whenever a secure hash algorithm is required for federal
+ * applications. For a message of length less than 2^64 bits, the SHA-1
+ * produces a 160-bit condensed representation of the message called a message
+ * digest. The message digest is used during generation of a signature for the
+ * message. The SHA-1 is also used to compute a message digest for the received
+ * version of the message during the process of verifying the signature. Any
+ * change to the message in transit will, with very high probability, result in
+ * a different message digest, and the signature will fail to verify.</p>
+ *
+ * <p>The SHA-1 is designed to have the following properties: it is
+ * computationally infeasible to find a message which corresponds to a given
+ * message digest, or to find two different messages which produce the same
+ * message digest.</p>
+ *
+ * <p>References:</p>
+ *
+ * <ol>
+ *    <li><a href="http://www.itl.nist.gov/fipspubs/fip180-1.htm";>SECURE HASH
+ *    STANDARD</a><br>
+ *    Federal Information, Processing Standards Publication 180-1, 1995 April 
17.
+ *    </li>
+ * </ol>
+ *
+ * @version $Revision: 1.10 $
+ */
+public class Sha160 extends BaseHash {
+
+   // Constants and variables
+   // -------------------------------------------------------------------------
+
+   private static final int BLOCK_SIZE = 64; // inner block size in bytes
+
+   private static final String DIGEST0 = 
"A9993E364706816ABA3E25717850C26C9CD0D89D";
+
+   private static final int[] w = new int[80];
+
+   /** caches the result of the correctness test, once executed. */
+   private static Boolean valid;
+
+   /** 160-bit interim result. */
+   private int h0, h1, h2, h3, h4;
+
+   // Constructor(s)
+   // -------------------------------------------------------------------------
+
+   /** Trivial 0-arguments constructor. */
+   public Sha160() {
+      super(Registry.SHA160_HASH, 20, BLOCK_SIZE);
+   }
+
+   /**
+    * <p>Private constructor for cloning purposes.</p>
+    *
+    * @param md the instance to clone.
+    */
+   private Sha160(Sha160 md) {
+      this();
+
+      this.h0 = md.h0;
+      this.h1 = md.h1;
+      this.h2 = md.h2;
+      this.h3 = md.h3;
+      this.h4 = md.h4;
+      this.count = md.count;
+      this.buffer = (byte[]) md.buffer.clone();
+   }
+
+   // Class methods
+   // -------------------------------------------------------------------------
+
+   public static final int[]
+   G(int hh0, int hh1, int hh2, int hh3, int hh4, byte[] in, int offset) {
+//      int[] w = new int[80];
+//      int i, T;
+//      for (i = 0; i < 16; i++) {
+//         w[i] = in[offset++]         << 24 |
+//               (in[offset++] & 0xFF) << 16 |
+//               (in[offset++] & 0xFF) <<  8 |
+//               (in[offset++] & 0xFF);
+//      }
+//      for (i = 16; i < 80; i++) {
+//         T = w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16];
+//         w[i] = T << 1 | T >>> 31;
+//      }
+
+//      return sha(hh0, hh1, hh2, hh3, hh4, in, offset, w);
+      return sha(hh0, hh1, hh2, hh3, hh4, in, offset);
+   }
+
+   // Instance methods
+   // -------------------------------------------------------------------------
+
+   // java.lang.Cloneable interface implementation ----------------------------
+
+   public Object clone() {
+      return new Sha160(this);
+   }
+
+   // Implementation of concrete methods in BaseHash --------------------------
+
+   protected void transform(byte[] in, int offset) {
+//      int i, T;
+//      for (i = 0; i < 16; i++) {
+//         W[i] = in[offset++]         << 24 |
+//               (in[offset++] & 0xFF) << 16 |
+//               (in[offset++] & 0xFF) <<  8 |
+//               (in[offset++] & 0xFF);
+//      }
+//      for (i = 16; i < 80; i++) {
+//         T = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16];
+//         W[i] = T << 1 | T >>> 31;
+//      }
+
+//      int[] result = sha(h0, h1, h2, h3, h4, in, offset, W);
+      int[] result = sha(h0, h1, h2, h3, h4, in, offset);
+
+      h0 = result[0];
+      h1 = result[1];
+      h2 = result[2];
+      h3 = result[3];
+      h4 = result[4];
+   }
+
+   protected byte[] padBuffer() {
+      int n = (int)(count % BLOCK_SIZE);
+      int padding = (n < 56) ? (56 - n) : (120 - n);
+      byte[] result = new byte[padding + 8];
+
+      // padding is always binary 1 followed by binary 0s
+      result[0] = (byte) 0x80;
+
+      // save number of bits, casting the long to an array of 8 bytes
+      long bits = count << 3;
+      result[padding++] = (byte)(bits >>> 56);
+      result[padding++] = (byte)(bits >>> 48);
+      result[padding++] = (byte)(bits >>> 40);
+      result[padding++] = (byte)(bits >>> 32);
+      result[padding++] = (byte)(bits >>> 24);
+      result[padding++] = (byte)(bits >>> 16);
+      result[padding++] = (byte)(bits >>>  8);
+      result[padding  ] = (byte) bits;
+
+      return result;
+   }
+
+   protected byte[] getResult() {
+      byte[] result = new byte[] {
+         (byte)(h0 >>> 24), (byte)(h0 >>> 16), (byte)(h0 >>> 8), (byte) h0,
+         (byte)(h1 >>> 24), (byte)(h1 >>> 16), (byte)(h1 >>> 8), (byte) h1,
+         (byte)(h2 >>> 24), (byte)(h2 >>> 16), (byte)(h2 >>> 8), (byte) h2,
+         (byte)(h3 >>> 24), (byte)(h3 >>> 16), (byte)(h3 >>> 8), (byte) h3,
+         (byte)(h4 >>> 24), (byte)(h4 >>> 16), (byte)(h4 >>> 8), (byte) h4
+      };
+
+      return result;
+   }
+
+   protected void resetContext() {
+      // magic SHA-1/RIPEMD160 initialisation constants
+      h0 = 0x67452301;
+      h1 = 0xEFCDAB89;
+      h2 = 0x98BADCFE;
+      h3 = 0x10325476;
+      h4 = 0xC3D2E1F0;
+   }
+
+   public boolean selfTest() {
+      if (valid == null) {
+         Sha160 md = new Sha160();
+         md.update((byte) 0x61); // a
+         md.update((byte) 0x62); // b
+         md.update((byte) 0x63); // c
+         String result = Util.toString(md.digest());
+         valid = new Boolean(DIGEST0.equals(result));
+      }
+      return valid.booleanValue();
+   }
+
+   // SHA specific methods ----------------------------------------------------
+
+   private static final synchronized int[]
+//   sha(int hh0, int hh1, int hh2, int hh3, int hh4, byte[] in, int offset, 
int[] w) {
+   sha(int hh0, int hh1, int hh2, int hh3, int hh4, byte[] in, int offset) {
+      int A = hh0;
+      int B = hh1;
+      int C = hh2;
+      int D = hh3;
+      int E = hh4;
+      int r, T;
+
+      for (r = 0; r < 16; r++) {
+         w[r] = in[offset++]         << 24 |
+               (in[offset++] & 0xFF) << 16 |
+               (in[offset++] & 0xFF) <<  8 |
+               (in[offset++] & 0xFF);
+      }
+      for (r = 16; r < 80; r++) {
+         T = w[r-3] ^ w[r-8] ^ w[r-14] ^ w[r-16];
+         w[r] = T << 1 | T >>> 31;
+      }
+
+      // rounds 0-19
+      for (r = 0; r < 20; r++) {
+         T = (A << 5 | A >>> 27) + ((B & C) | (~B & D)) + E + w[r] + 
0x5A827999;
+         E = D;
+         D = C;
+         C = B << 30 | B >>> 2;
+         B = A;
+         A = T;
+      }
+
+      // rounds 20-39
+      for (r = 20; r < 40; r++) {
+         T = (A << 5 | A >>> 27) + (B ^ C ^ D) + E + w[r] + 0x6ED9EBA1;
+         E = D;
+         D = C;
+         C = B << 30 | B >>> 2;
+         B = A;
+         A = T;
+      }
+
+      // rounds 40-59
+      for (r = 40; r < 60; r++) {
+         T = (A << 5 | A >>> 27) + (B & C | B & D | C & D) + E + w[r] + 
0x8F1BBCDC;
+         E = D;
+         D = C;
+         C = B << 30 | B >>> 2;
+         B = A;
+         A = T;
+      }
+
+      // rounds 60-79
+      for (r = 60; r < 80; r++) {
+         T = (A << 5 | A >>> 27) + (B ^ C ^ D) + E + w[r] + 0xCA62C1D6;
+         E = D;
+         D = C;
+         C = B << 30 | B >>> 2;
+         B = A;
+         A = T;
+      }
+
+      return new int[] {hh0+A, hh1+B, hh2+C, hh3+D, hh4+E};
+   }
+}

Added: trunk/apps/new_installer/src/gnu/crypto/util/Util.java
===================================================================
--- trunk/apps/new_installer/src/gnu/crypto/util/Util.java      2006-07-25 
19:47:22 UTC (rev 9759)
+++ trunk/apps/new_installer/src/gnu/crypto/util/Util.java      2006-07-25 
20:03:22 UTC (rev 9760)
@@ -0,0 +1,612 @@
+package gnu.crypto.util;
+
+// ----------------------------------------------------------------------------
+// $Id: Util.java,v 1.11 2005/10/06 04:24:19 rsdio Exp $
+//
+// Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
+//
+// This file is part of GNU Crypto.
+//
+// GNU Crypto is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2, or (at your option)
+// any later version.
+//
+// GNU Crypto is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING.  If not, write to the
+//
+//    Free Software Foundation Inc.,
+//    51 Franklin Street, Fifth Floor,
+//    Boston, MA 02110-1301
+//    USA
+//
+// Linking this library statically or dynamically with other modules is
+// making a combined work based on this library.  Thus, the terms and
+// conditions of the GNU General Public License cover the whole
+// combination.
+//
+// As a special exception, the copyright holders of this library give
+// you permission to link this library with independent modules to
+// produce an executable, regardless of the license terms of these
+// independent modules, and to copy and distribute the resulting
+// executable under terms of your choice, provided that you also meet,
+// for each linked independent module, the terms and conditions of the
+// license of that module.  An independent module is a module which is
+// not derived from or based on this library.  If you modify this
+// library, you may extend this exception to your version of the
+// library, but you are not obligated to do so.  If you do not wish to
+// do so, delete this exception statement from your version.
+// ----------------------------------------------------------------------------
+
+import java.math.BigInteger;
+
+/**
+ * <p>A collection of utility methods used throughout this project.</p>
+ *
+ * @version $Revision: 1.11 $
+ */
+public class Util {
+
+   // Constants and variables
+   // -------------------------------------------------------------------------
+
+   // Hex charset
+   private static final char[] HEX_DIGITS = "0123456789ABCDEF".toCharArray();
+
+   // Base-64 charset
+   private static final String BASE64_CHARS =
+      "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";
+   private static final char[] BASE64_CHARSET = BASE64_CHARS.toCharArray();
+
+   // Constructor(s)
+   // -------------------------------------------------------------------------
+
+   /** Trivial constructor to enforce Singleton pattern. */
+   private Util() {
+      super();
+   }
+
+   // Class methods
+   // -------------------------------------------------------------------------
+
+   /**
+    * <p>Returns a string of hexadecimal digits from a byte array. Each byte is
+    * converted to 2 hex symbols; zero(es) included.</p>
+    *
+    * <p>This method calls the method with same name and three arguments 
as:</p>
+    *
+    * <pre>
+    *    toString(ba, 0, ba.length);
+    * </pre>
+    *
+    * @param ba the byte array to convert.
+    * @return a string of hexadecimal characters (two for each byte)
+    * representing the designated input byte array.
+    */
+   public static String toString(byte[] ba) {
+      return toString(ba, 0, ba.length);
+   }
+
+   /**
+    * <p>Returns a string of hexadecimal digits from a byte array, starting at
+    * <code>offset</code> and consisting of <code>length</code> bytes. Each 
byte
+    * is converted to 2 hex symbols; zero(es) included.</p>
+    *
+    * @param ba the byte array to convert.
+    * @param offset the index from which to start considering the bytes to
+    * convert.
+    * @param length the count of bytes, starting from the designated offset to
+    * convert.
+    * @return a string of hexadecimal characters (two for each byte)
+    * representing the designated input byte sub-array.
+    */
+   public static final String toString(byte[] ba, int offset, int length) {
+      char[] buf = new char[length * 2];
+      for (int i = 0, j = 0, k; i < length; ) {
+         k = ba[offset + i++];
+         buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F];
+         buf[j++] = HEX_DIGITS[ k        & 0x0F];
+      }
+      return new String(buf);
+   }
+
+   /**
+    * <p>Returns a string of hexadecimal digits from a byte array. Each byte is
+    * converted to 2 hex symbols; zero(es) included. The argument is
+    * treated as a large little-endian integer and is returned as a
+    * large big-endian integer.</p>
+    *
+    * <p>This method calls the method with same name and three arguments 
as:</p>
+    *
+    * <pre>
+    *    toReversedString(ba, 0, ba.length);
+    * </pre>
+    *
+    * @param ba the byte array to convert.
+    * @return a string of hexadecimal characters (two for each byte)
+    * representing the designated input byte array.
+    */
+   public static String toReversedString(byte[] ba) {
+      return toReversedString(ba, 0, ba.length);
+   }
+
+   /**
+    * <p>Returns a string of hexadecimal digits from a byte array, starting at
+    * <code>offset</code> and consisting of <code>length</code> bytes. Each 
byte
+    * is converted to 2 hex symbols; zero(es) included.</p>
+    *
+    * <p>The byte array is treated as a large little-endian integer, and
+    * is returned as a large big-endian integer.</p>
+    *
+    * @param ba the byte array to convert.
+    * @param offset the index from which to start considering the bytes to
+    * convert.
+    * @param length the count of bytes, starting from the designated offset to
+    * convert.
+    * @return a string of hexadecimal characters (two for each byte)
+    * representing the designated input byte sub-array.
+    */
+   public static final String
+   toReversedString(byte[] ba, int offset, int length) {
+      char[] buf = new char[length * 2];
+      for (int i = offset+length-1, j = 0, k; i >= offset; ) {
+         k = ba[offset + i--];
+         buf[j++] = HEX_DIGITS[(k >>> 4) & 0x0F];
+         buf[j++] = HEX_DIGITS[ k        & 0x0F];
+      }
+      return new String(buf);
+   }
+
+   /**
+    * <p>Returns a byte array from a string of hexadecimal digits.</p>
+    *
+    * @param s a string of hexadecimal ASCII characters
+    * @return the decoded byte array from the input hexadecimal string.
+    */
+   public static byte[] toBytesFromString(String s) {
+      int limit = s.length();
+      byte[] result = new byte[((limit + 1) / 2)];
+      int i = 0, j = 0;
+      if ((limit % 2) == 1) {
+         result[j++] = (byte) fromDigit(s.charAt(i++));
+      }
+      while (i < limit) {
+         result[j  ]  = (byte) (fromDigit(s.charAt(i++)) << 4);
+         result[j++] |= (byte)  fromDigit(s.charAt(i++));
+      }
+      return result;
+   }
+
+   /**
+    * <p>Returns a byte array from a string of hexadecimal digits, interpreting
+    * them as a large big-endian integer and returning it as a large
+    * little-endian integer.</p>
+    *
+    * @param s a string of hexadecimal ASCII characters
+    * @return the decoded byte array from the input hexadecimal string.
+    */
+   public static byte[] toReversedBytesFromString(String s) {
+      int limit = s.length();
+      byte[] result = new byte[((limit + 1) / 2)];
+      int i = 0;
+      if ((limit % 2) == 1) {
+         result[i++] = (byte) fromDigit(s.charAt(--limit));
+      }
+      while (limit > 0) {
+         result[i  ]  = (byte)  fromDigit(s.charAt(--limit));
+         result[i++] |= (byte) (fromDigit(s.charAt(--limit)) << 4);
+      }
+      return result;
+   }
+
+   /**
+    * <p>Returns a number from <code>0</code> to <code>15</code> corresponding
+    * to the designated hexadecimal digit.</p>
+    *
+    * @param c a hexadecimal ASCII symbol.
+    */
+   public static int fromDigit(char c) {
+      if (c >= '0' && c <= '9') {
+         return c - '0';
+      } else if (c >= 'A' && c <= 'F') {
+         return c - 'A' + 10;
+      } else if (c >= 'a' && c <= 'f') {
+         return c - 'a' + 10;
+      } else
+         throw new IllegalArgumentException("Invalid hexadecimal digit: " + c);
+   }
+
+   /**
+    * <p>Returns a string of 8 hexadecimal digits (most significant digit 
first)
+    * corresponding to the unsigned integer <code>n</code>.</p>
+    *
+    * @param n the unsigned integer to convert.
+    * @return a hexadecimal string 8-character long.
+    */
+   public static String toString(int n) {
+      char[] buf = new char[8];
+      for (int i = 7; i >= 0; i--) {
+         buf[i] = HEX_DIGITS[n & 0x0F];
+         n >>>= 4;
+      }
+      return new String(buf);
+   }
+
+   /**
+    * <p>Returns a string of hexadecimal digits from an integer array. Each int
+    * is converted to 4 hex symbols.</p>
+    */
+   public static String toString(int[] ia) {
+      int length = ia.length;
+      char[] buf = new char[length * 8];
+      for (int i = 0, j = 0, k; i < length; i++) {
+         k = ia[i];
+         buf[j++] = HEX_DIGITS[(k >>> 28) & 0x0F];
+         buf[j++] = HEX_DIGITS[(k >>> 24) & 0x0F];
+         buf[j++] = HEX_DIGITS[(k >>> 20) & 0x0F];
+         buf[j++] = HEX_DIGITS[(k >>> 16) & 0x0F];
+         buf[j++] = HEX_DIGITS[(k >>> 12) & 0x0F];
+         buf[j++] = HEX_DIGITS[(k >>>  8) & 0x0F];
+         buf[j++] = HEX_DIGITS[(k >>>  4) & 0x0F];
+         buf[j++] = HEX_DIGITS[ k         & 0x0F];
+      }
+      return new String(buf);
+   }
+
+   /**
+    * <p>Returns a string of 16 hexadecimal digits (most significant digit 
first)
+    * corresponding to the unsigned long <code>n</code>.</p>
+    *
+    * @param n the unsigned long to convert.
+    * @return a hexadecimal string 16-character long.
+    */
+   public static String toString(long n) {
+      char[] b = new char[16];
+      for (int i = 15; i >= 0; i--) {
+         b[i] = HEX_DIGITS[(int)(n & 0x0FL)];
+         n >>>= 4;
+      }
+      return new String(b);
+   }
+
+   /**
+    * <p>Similar to the <code>toString()</code> method except that the Unicode
+    * escape character is inserted before every pair of bytes. Useful to
+    * externalise byte arrays that will be constructed later from such strings;
+    * eg. s-box values.</p>
+    *
+    * @throws ArrayIndexOutOfBoundsException if the length is odd.
+    */
+   public static String toUnicodeString(byte[] ba) {
+      return toUnicodeString(ba, 0, ba.length);
+   }
+
+   /**
+    * <p>Similar to the <code>toString()</code> method except that the Unicode
+    * escape character is inserted before every pair of bytes. Useful to
+    * externalise byte arrays that will be constructed later from such strings;
+    * eg. s-box values.</p>
+    *
+    * @throws ArrayIndexOutOfBoundsException if the length is odd.
+    */
+   public static final String
+   toUnicodeString(byte[] ba, int offset, int length) {
+      StringBuffer sb = new StringBuffer();
+      int i = 0;
+      int j = 0;
+      int k;
+      sb.append('\n').append("\"");
+      while (i < length) {
+         sb.append("\\u");
+
+         k = ba[offset + i++];
+         sb.append(HEX_DIGITS[(k >>> 4) & 0x0F]);
+         sb.append(HEX_DIGITS[ k        & 0x0F]);
+
+         k = ba[offset + i++];
+         sb.append(HEX_DIGITS[(k >>> 4) & 0x0F]);
+         sb.append(HEX_DIGITS[ k        & 0x0F]);
+
+         if ((++j % 8) == 0) {
+            sb.append("\"+").append('\n').append("\"");
+         }
+      }
+      sb.append("\"").append('\n');
+      return sb.toString();
+   }
+
+   /**
+    * <p>Similar to the <code>toString()</code> method except that the Unicode
+    * escape character is inserted before every pair of bytes. Useful to
+    * externalise integer arrays that will be constructed later from such
+    * strings; eg. s-box values.</p>
+    *
+    * @throws ArrayIndexOutOfBoundsException if the length is not a multiple 
of 4.
+    */
+   public static String toUnicodeString(int[] ia) {
+      StringBuffer sb = new StringBuffer();
+      int i = 0;
+      int j = 0;
+      int k;
+      sb.append('\n').append("\"");
+      while (i < ia.length) {
+         k = ia[i++];
+         sb.append("\\u");
+         sb.append(HEX_DIGITS[(k >>> 28) & 0x0F]);
+         sb.append(HEX_DIGITS[(k >>> 24) & 0x0F]);
+         sb.append(HEX_DIGITS[(k >>> 20) & 0x0F]);
+         sb.append(HEX_DIGITS[(k >>> 16) & 0x0F]);
+         sb.append("\\u");
+         sb.append(HEX_DIGITS[(k >>> 12) & 0x0F]);
+         sb.append(HEX_DIGITS[(k >>>  8) & 0x0F]);
+         sb.append(HEX_DIGITS[(k >>>  4) & 0x0F]);
+         sb.append(HEX_DIGITS[ k         & 0x0F]);
+
+         if ((++j % 4) == 0) {
+            sb.append("\"+").append('\n').append("\"");
+         }
+      }
+      sb.append("\"").append('\n');
+      return sb.toString();
+   }
+
+   public static byte[] toBytesFromUnicode(String s) {
+      int limit = s.length() * 2;
+      byte[] result = new byte[limit];
+      char c;
+      for (int i = 0; i < limit; i++) {
+         c = s.charAt(i >>> 1);
+         result[i] = (byte)(((i & 1) == 0) ? c >>> 8 : c);
+      }
+      return result;
+   }
+
+   /**
+    * <p>Dumps a byte array as a string, in a format that is easy to read for
+    * debugging. The string <code>m</code> is prepended to the start of each
+    * line.</p>
+    *
+    * <p>If <code>offset</code> and <code>length</code> are omitted, the whole
+    * array is used. If <code>m</code> is omitted, nothing is prepended to each
+    * line.</p>
+    *
+    * @param data the byte array to be dumped.
+    * @param offset the offset within <i>data</i> to start from.
+    * @param length the number of bytes to dump.
+    * @param m a string to be prepended to each line.
+    * @return a string containing the result.
+    */
+   public static String dumpString(byte[] data, int offset, int length, String 
m) {
+      if (data == null) {
+         return m + "null\n";
+      }
+      StringBuffer sb = new StringBuffer(length * 3);
+      if (length > 32) {
+         sb.append(m).append("Hexadecimal dump of ").append(length).append(" 
bytes...\n");
+      }
+      // each line will list 32 bytes in 4 groups of 8 each
+      int end = offset + length;
+      String s;
+      int l = Integer.toString(length).length();
+      if (l < 4) {
+         l = 4;
+      }
+      for ( ; offset < end; offset += 32) {
+         if (length > 32) {
+            s = "         " + offset;
+            sb.append(m).append(s.substring(s.length()-l)).append(": ");
+         }
+         int i = 0;
+         for ( ; i < 32 && offset + i + 7 < end; i += 8) {
+            sb.append(toString(data, offset + i, 8)).append(' ');
+         }
+         if (i < 32) {
+            for ( ; i < 32 && offset + i < end; i++) {
+               sb.append(byteToString(data[offset + i]));
+            }
+         }
+         sb.append('\n');
+      }
+      return sb.toString();
+   }
+
+   public static String dumpString(byte[] data) {
+      return (data == null) ? "null\n" : dumpString(data, 0, data.length, "");
+   }
+
+   public static String dumpString(byte[] data, String m) {
+      return (data == null) ? "null\n" : dumpString(data, 0, data.length, m);
+   }
+
+   public static String dumpString(byte[] data, int offset, int length) {
+      return dumpString(data, offset, length, "");
+   }
+
+   /**
+    * <p>Returns a string of 2 hexadecimal digits (most significant digit 
first)
+    * corresponding to the lowest 8 bits of <code>n</code>.</p>
+    *
+    * @param n the byte value to convert.
+    * @return a string of 2 hex characters representing the input.
+    */
+   public static String byteToString(int n) {
+      char[] buf = { HEX_DIGITS[(n >>> 4) & 0x0F], HEX_DIGITS[n & 0x0F] };
+      return new String(buf);
+   }
+
+   /**
+    * <p>Converts a designated byte array to a Base-64 representation, with the
+    * exceptions that (a) leading 0-byte(s) are ignored, and (b) the character
+    * '.' (dot) shall be used instead of "+' (plus).</p>
+    *
+    * <p>Used by SASL password file manipulation primitives.</p>
+    *
+    * @param buffer an arbitrary sequence of bytes to represent in Base-64.
+    * @return unpadded (without the '=' character(s)) Base-64 representation of
+    * the input.
+    */
+   public static final String toBase64(byte[] buffer) {
+      int len = buffer.length, pos = len % 3;
+      byte b0 = 0, b1 = 0, b2 = 0;
+      switch (pos) {
+      case 1:
+         b2 = buffer[0];
+         break;
+      case 2:
+         b1 = buffer[0];
+         b2 = buffer[1];
+         break;
+      }
+      StringBuffer sb = new StringBuffer();
+      int c;
+      boolean notleading = false;
+      do {
+         c = (b0 & 0xFC) >>> 2;
+         if (notleading || c != 0) {
+           sb.append(BASE64_CHARSET[c]);
+           notleading = true;
+         }
+         c = ((b0 & 0x03) << 4) | ((b1 & 0xF0) >>> 4);
+         if (notleading || c != 0) {
+           sb.append(BASE64_CHARSET[c]);
+           notleading = true;
+         }
+         c = ((b1 & 0x0F) << 2) | ((b2 & 0xC0) >>> 6);
+         if (notleading || c != 0) {
+           sb.append(BASE64_CHARSET[c]);
+           notleading = true;
+         }
+         c = b2 & 0x3F;
+         if (notleading || c != 0) {
+           sb.append(BASE64_CHARSET[c]);
+           notleading = true;
+         }
+         if (pos >= len) {
+           break;
+         } else {
+           try {
+             b0 = buffer[pos++];
+             b1 = buffer[pos++];
+             b2 = buffer[pos++];
+           } catch (ArrayIndexOutOfBoundsException x) {
+             break;
+           }
+         }
+      } while (true);
+
+      if (notleading) {
+        return sb.toString();
+      }
+      return "0";
+   }
+
+   /**
+    * <p>The inverse function of the above.</p>
+    *
+    * <p>Converts a string representing the encoding of some bytes in Base-64
+    * to their original form.</p>
+    *
+    * @param str the Base-64 encoded representation of some byte(s).
+    * @return the bytes represented by the <code>str</code>.
+    * @throws NumberFormatException if <code>str</code> is <code>null</code>, 
or
+    * <code>str</code> contains an illegal Base-64 character.
+    * @see #toBase64(byte[])
+    */
+   public static final byte[] fromBase64(String str) {
+      int len = str.length();
+      if (len == 0) {
+         throw new NumberFormatException("Empty string");
+      }
+      byte[] a = new byte[len + 1];
+      int i, j;
+      for (i = 0; i < len; i++) {
+         try {
+            a[i] = (byte) BASE64_CHARS.indexOf(str.charAt(i));
+         } catch (ArrayIndexOutOfBoundsException x) {
+            throw new NumberFormatException("Illegal character at #"+i);
+         }
+      }
+      i = len - 1;
+      j = len;
+      try {
+         while (true) {
+            a[j] = a[i];
+            if (--i < 0) {
+               break;
+            }
+            a[j] |= (a[i] & 0x03) << 6;
+            j--;
+            a[j] = (byte)((a[i] & 0x3C) >>> 2);
+            if (--i < 0) {
+               break;
+            }
+            a[j] |= (a[i] & 0x0F) << 4;
+            j--;
+            a[j] = (byte)((a[i] & 0x30) >>> 4);
+            if (--i < 0) {
+               break;
+            }
+            a[j] |= (a[i] << 2);
+            j--;
+            a[j] = 0;
+            if (--i < 0) {
+               break;
+            }
+         }
+      } catch (Exception ignored) {
+      }
+
+      try { // ignore leading 0-bytes
+         while(a[j] == 0) {
+            j++;
+         }
+      } catch (Exception x) {
+         return new byte[1]; // one 0-byte
+      }
+      byte[] result = new byte[len - j + 1];
+      System.arraycopy(a, j, result, 0, len - j + 1);
+      return result;
+   }
+
+   // BigInteger utilities ----------------------------------------------------
+
+   /**
+    * <p>Treats the input as the MSB representation of a number, and discards
+    * leading zero elements. For efficiency, the input is simply returned if no
+    * leading zeroes are found.</p>
+    *
+    * @param n the {@link BigInteger} to trim.
+    * @return the byte array representation of the designated {@link 
BigInteger}
+    * with no leading 0-bytes.
+    */
+   public static final byte[] trim(BigInteger n) {
+      byte[] in = n.toByteArray();
+      if (in.length == 0 || in[0] != 0) {
+         return in;
+      }
+      int len = in.length;
+      int i = 1;
+      while (in[i] == 0 && i < len) {
+         ++i;
+      }
+      byte[] result = new byte[len - i];
+      System.arraycopy(in, i, result, 0, len - i);
+      return result;
+   }
+
+   /**
+    * <p>Returns a hexadecimal dump of the trimmed bytes of a {@link 
BigInteger}.
+    * </p>
+    *
+    * @param x the {@link BigInteger} to display.
+    * @return the string representation of the designated {@link BigInteger}.
+    */
+   public static final String dump(BigInteger x) {
+      return dumpString(trim(x));
+   }
+}


Reply via email to