Jul 17

Once you have generated a SecretKey you can use it’s getEncoded() method to generate a byte array that can be used to recreate the key.

        // Use the following to initially create a random key

        KeyGenerator keyGen = KeyGenerator.getInstance("AES");
        SecretKey key = keyGen.generateKey();

        // Then use the following to get the 

        byte[] encoded = key.getEncoded();

        // byte array could now be saved for later use to recreate key

To then recreate your key using the byte array, you can use the following:

        SecretKey key = new SecretKeySpec(encoded, "AES");

written by objects \\ tags: , , , , ,

Jul 16

Got the following error while trying to run gitosis-init on Ununtu 9.04. After a bit of searching found it was a known bug. Workaround is to edit /usr/bin/gitosis-init to use python 2.5 instead of python 2.6.

mick@builder:/srv/gitosis$ sudo -H -u gitosis /usr/bin/gitosis-init < /tmp/id_rsa.pub
Traceback (most recent call last):
  File "/usr/bin/gitosis-init", line 5, in 
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 2562, in 
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 626, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 524, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: gitosis==0.2
mick@builder:/srv/gitosis$ /usr/bin/python2.

written by objects \\ tags: , , ,

Jul 16

By default ant looks for a build file name build.xml if one is not explicitly specified. To specify an alternate build file name you need to use the -buildfile command line option. For example to execute the compile target in the build file name mybuild.xml you would run:
ant -buildfile mybuild.xml compile

written by objects \\ tags: ,