|
From: <pe...@us...> - 2003-12-06 00:17:07
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store In directory sc8-pr-cvs1:/tmp/cvs-serv4604/src/java/org/neuclear/store Modified Files: EncryptedFileStore.java FileStore.java Log Message: Updated various areas in NSTools. Updated URI Validation in particular to support new expanded format Updated createUniqueID and friends to be a lot more unique and more efficient. In CryptoTools updated getRandom() to finally use a SecureRandom. Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is. Index: EncryptedFileStore.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/EncryptedFileStore.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** EncryptedFileStore.java 21 Nov 2003 04:45:14 -0000 1.14 --- EncryptedFileStore.java 6 Dec 2003 00:17:04 -0000 1.15 *************** *** 2,5 **** --- 2,12 ---- * $Id$ * $Log$ + * Revision 1.15 2003/12/06 00:17:04 pelle + * Updated various areas in NSTools. + * Updated URI Validation in particular to support new expanded format + * Updated createUniqueID and friends to be a lot more unique and more efficient. + * In CryptoTools updated getRandom() to finally use a SecureRandom. + * Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is. + * * Revision 1.14 2003/11/21 04:45:14 pelle * EncryptedFileStore now works. It uses the PBECipher with DES3 afair. *************** *** 180,191 **** import org.neuclear.commons.NeuClearException; - import org.neuclear.commons.crypto.CryptoTools; import org.neuclear.commons.crypto.CryptoException; import org.neuclear.id.NSTools; import org.neuclear.id.SignedNamedObject; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; - import javax.crypto.Cipher; import java.io.*; --- 187,198 ---- import org.neuclear.commons.NeuClearException; import org.neuclear.commons.crypto.CryptoException; + import org.neuclear.commons.crypto.CryptoTools; import org.neuclear.id.NSTools; import org.neuclear.id.SignedNamedObject; + import javax.crypto.Cipher; import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; import java.io.*; *************** *** 206,210 **** outputFile.getParentFile().mkdirs(); try { ! return new CipherOutputStream(new FileOutputStream(outputFile), CryptoTools.makePBECipher(Cipher.ENCRYPT_MODE,obj.getName().toCharArray())); } catch (Exception e) { throw new CryptoException(e); --- 213,217 ---- outputFile.getParentFile().mkdirs(); try { ! return new CipherOutputStream(new FileOutputStream(outputFile), CryptoTools.makePBECipher(Cipher.ENCRYPT_MODE, obj.getName().toCharArray())); } catch (Exception e) { throw new CryptoException(e); *************** *** 219,223 **** throw new NeuClearException("NeuClear: " + name + " doesnt exist"); try { ! return new CipherInputStream(new FileInputStream(fin), CryptoTools.makePBECipher(Cipher.DECRYPT_MODE,name.toCharArray())); } catch (Exception e) { throw new CryptoException(e); --- 226,230 ---- throw new NeuClearException("NeuClear: " + name + " doesnt exist"); try { ! return new CipherInputStream(new FileInputStream(fin), CryptoTools.makePBECipher(Cipher.DECRYPT_MODE, name.toCharArray())); } catch (Exception e) { throw new CryptoException(e); *************** *** 228,232 **** protected final String getFileName(final String name) throws NeuClearException { final String deURLizedName = NSTools.normalizeNameURI(name); ! final byte[] hash = CryptoTools.formatAsURLSafe(CryptoTools.digest256(deURLizedName.getBytes())).getBytes(); //if (true) return new String(hash); final int partlength = hash.length / 8; --- 235,239 ---- protected final String getFileName(final String name) throws NeuClearException { final String deURLizedName = NSTools.normalizeNameURI(name); ! final byte[] hash = CryptoTools.formatAsBase36(CryptoTools.digest256(deURLizedName.getBytes())).getBytes(); //if (true) return new String(hash); final int partlength = hash.length / 8; Index: FileStore.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/FileStore.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** FileStore.java 21 Nov 2003 04:45:16 -0000 1.15 --- FileStore.java 6 Dec 2003 00:17:04 -0000 1.16 *************** *** 2,5 **** --- 2,12 ---- * $Id$ * $Log$ + * Revision 1.16 2003/12/06 00:17:04 pelle + * Updated various areas in NSTools. + * Updated URI Validation in particular to support new expanded format + * Updated createUniqueID and friends to be a lot more unique and more efficient. + * In CryptoTools updated getRandom() to finally use a SecureRandom. + * Changed CryptoTools.getFormatURLSafe to getBase36 because that is what it really is. + * * Revision 1.15 2003/11/21 04:45:16 pelle * EncryptedFileStore now works. It uses the PBECipher with DES3 afair. *************** *** 232,236 **** protected String getFileName(final String name) throws NeuClearException { ! return NSTools.url2path(name) + "/root.id"; } --- 239,243 ---- protected String getFileName(final String name) throws NeuClearException { ! return NSTools.name2path(name) + "/root.id"; } |