|
From: <pe...@us...> - 2003-11-18 23:35:49
|
Update of /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store In directory sc8-pr-cvs1:/tmp/cvs-serv4327/src/java/org/neuclear/store Modified Files: EncryptedFileStore.java FileStore.java Log Message: Payment Web Application is getting there. Index: EncryptedFileStore.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/EncryptedFileStore.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** EncryptedFileStore.java 18 Nov 2003 19:23:58 -0000 1.11 --- EncryptedFileStore.java 18 Nov 2003 23:35:45 -0000 1.12 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * Revision 1.12 2003/11/18 23:35:45 pelle + * Payment Web Application is getting there. + * * Revision 1.11 2003/11/18 19:23:58 pelle * Missed this in latest checkin *************** *** 161,175 **** package org.neuclear.store; - import org.neuclear.id.builders.NamedObjectBuilder; - import org.neuclear.id.NSTools; - import org.neuclear.id.SignedNamedObject; - import org.neuclear.commons.crypto.CryptoTools; import org.neuclear.commons.NeuClearException; import javax.crypto.CipherOutputStream; - import javax.crypto.Cipher; - import javax.crypto.NoSuchPaddingException; import java.io.*; - import java.security.NoSuchAlgorithmException; --- 164,175 ---- package org.neuclear.store; import org.neuclear.commons.NeuClearException; + import org.neuclear.commons.crypto.CryptoTools; + import org.neuclear.id.NSTools; + import org.neuclear.id.builders.NamedObjectBuilder; + import javax.crypto.CipherInputStream; import javax.crypto.CipherOutputStream; import java.io.*; *************** *** 188,216 **** File outputFile = new File(outputFilename); outputFile.getParentFile().mkdirs(); ! try { ! Cipher cipher = Cipher.getInstance("AES"); ! //TODO Initialise cipher with key ! return new CipherOutputStream(new FileOutputStream(outputFile),cipher); ! ! ! } catch (NoSuchAlgorithmException e) { ! throw new NeuClearException(e); ! } catch (NoSuchPaddingException e) { ! throw new NeuClearException(e); ! } ! } ! protected FileInputStream getInputStream(String name) throws FileNotFoundException, NeuClearException { String inputFilename = base + getFileName(name); System.out.println("Loading from: " + inputFilename); File fin = new File(inputFilename); if (!fin.exists()) ! throw new NeuClearException("NeuClear: "+name+" doesnt exist"); ! //TODO add CipherInputStream ! return new FileInputStream(fin); } ! protected String getFileName(String name) throws NeuClearException { String deURLizedName = NSTools.normalizeNameURI(name); byte hash[] = CryptoTools.formatAsURLSafe(CryptoTools.digest512(deURLizedName.getBytes())).getBytes(); --- 188,205 ---- File outputFile = new File(outputFilename); outputFile.getParentFile().mkdirs(); ! return new CipherOutputStream(new FileOutputStream(outputFile), CryptoTools.getCipher(CryptoTools.digest256(obj.getName().getBytes()), true)); } ! ! protected InputStream getInputStream(String name) throws FileNotFoundException, NeuClearException { String inputFilename = base + getFileName(name); System.out.println("Loading from: " + inputFilename); File fin = new File(inputFilename); if (!fin.exists()) ! throw new NeuClearException("NeuClear: " + name + " doesnt exist"); ! return new CipherInputStream(new FileInputStream(fin), CryptoTools.getCipher(CryptoTools.digest256(name.getBytes()), false)); } ! protected String getFileName(String name) throws NeuClearException { String deURLizedName = NSTools.normalizeNameURI(name); byte hash[] = CryptoTools.formatAsURLSafe(CryptoTools.digest512(deURLizedName.getBytes())).getBytes(); Index: FileStore.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-id/src/java/org/neuclear/store/FileStore.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** FileStore.java 18 Nov 2003 19:23:58 -0000 1.12 --- FileStore.java 18 Nov 2003 23:35:46 -0000 1.13 *************** *** 2,5 **** --- 2,8 ---- * $Id$ * $Log$ + * Revision 1.13 2003/11/18 23:35:46 pelle + * Payment Web Application is getting there. + * * Revision 1.12 2003/11/18 19:23:58 pelle * Missed this in latest checkin *************** *** 159,164 **** import org.neuclear.id.verifier.VerifyingReader; import org.neuclear.xml.XMLException; - import org.neuclear.xml.XMLTools; - import org.neuclear.xml.xmlsec.XMLSecTools; import java.io.*; --- 162,165 ---- *************** *** 185,189 **** File outputFile = new File(outputFilename); outputFile.getParentFile().mkdirs(); ! OutputStream out=new FileOutputStream(outputFile); return out; } --- 186,190 ---- File outputFile = new File(outputFilename); outputFile.getParentFile().mkdirs(); ! OutputStream out = new FileOutputStream(outputFile); return out; } *************** *** 205,214 **** } ! protected FileInputStream getInputStream(String name) throws FileNotFoundException, NeuClearException { String inputFilename = base + getFileName(name); System.out.println("Loading from: " + inputFilename); File fin = new File(inputFilename); if (!fin.exists()) ! throw new NeuClearException("NeuClear: "+name+" doesnt exist"); return new FileInputStream(fin); --- 206,215 ---- } ! protected InputStream getInputStream(String name) throws FileNotFoundException, NeuClearException { String inputFilename = base + getFileName(name); System.out.println("Loading from: " + inputFilename); File fin = new File(inputFilename); if (!fin.exists()) ! throw new NeuClearException("NeuClear: " + name + " doesnt exist"); return new FileInputStream(fin); *************** *** 217,221 **** protected String getFileName(String name) throws NeuClearException { ! return NSTools.url2path(name)+"/root.id"; } --- 218,222 ---- protected String getFileName(String name) throws NeuClearException { ! return NSTools.url2path(name) + "/root.id"; } |