|
From: <pe...@us...> - 2004-03-08 17:30:37
|
Update of /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/channels In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32741/src/test/org/neuclear/commons/crypto/channels Modified Files: DigestChannelTest.java SigningChannelTest.java Log Message: Added CipherChannel and the beginnings of a Base32EncodingChannel. The AbstractCryptoChannel now is implemented with a pipe. You can get a readable channel with the source() method. To pipe a ReadableByteChannel or another instance of AbstractCryptoChannel into the channel you can now use the pipe() methods. Index: DigestChannelTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/channels/DigestChannelTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DigestChannelTest.java 6 Mar 2004 20:50:28 -0000 1.1 --- DigestChannelTest.java 8 Mar 2004 17:13:54 -0000 1.2 *************** *** 27,36 **** } ! public void testDigest() throws NoSuchAlgorithmException, IOException { for (int i=0;i<TESTSTRINGS.length;i++){ assertDigestEquals(TESTSTRINGS[i]); } } ! public void testFileDigest() throws NoSuchAlgorithmException, IOException { File cd=new File("src/java/org/neuclear/commons/crypto"); File files[]=cd.listFiles(); --- 27,36 ---- } ! public void testDigest() throws NoSuchAlgorithmException, IOException, CryptoException { for (int i=0;i<TESTSTRINGS.length;i++){ assertDigestEquals(TESTSTRINGS[i]); } } ! public void testFileDigest() throws NoSuchAlgorithmException, IOException, CryptoException { File cd=new File("src/java/org/neuclear/commons/crypto"); File files[]=cd.listFiles(); *************** *** 41,45 **** } } ! public String getChannelDigest(String data) throws NoSuchAlgorithmException, IOException { DigestChannel ch=new DigestChannel(); ByteBuffer buf=ByteBuffer.wrap(data.getBytes()); --- 41,45 ---- } } ! public String getChannelDigest(String data) throws NoSuchAlgorithmException, IOException, CryptoException { DigestChannel ch=new DigestChannel(); ByteBuffer buf=ByteBuffer.wrap(data.getBytes()); *************** *** 50,59 **** return new String(CryptoTools.digest(data)); } ! public void assertDigestEquals(String data) throws NoSuchAlgorithmException, IOException { String digest=getChannelDigest(data); assertEquals("Digest Length",20,digest.length()); assertEquals("Digest Match",getNormalDigest(data),digest); } ! public String getChannelDigest(File file) throws NoSuchAlgorithmException, IOException { DigestChannel ch=new DigestChannel(); FileChannel fch=new FileInputStream(file).getChannel(); --- 50,59 ---- return new String(CryptoTools.digest(data)); } ! public void assertDigestEquals(String data) throws NoSuchAlgorithmException, IOException, CryptoException { String digest=getChannelDigest(data); assertEquals("Digest Length",20,digest.length()); assertEquals("Digest Match",getNormalDigest(data),digest); } ! public String getChannelDigest(File file) throws NoSuchAlgorithmException, IOException, CryptoException { DigestChannel ch=new DigestChannel(); FileChannel fch=new FileInputStream(file).getChannel(); *************** *** 73,77 **** return new String(dig.digest()); } ! public void assertDigestEquals(File file) throws NoSuchAlgorithmException, IOException { String digest=getChannelDigest(file); assertEquals("Digest Length",20,digest.length()); --- 73,77 ---- return new String(dig.digest()); } ! public void assertDigestEquals(File file) throws NoSuchAlgorithmException, IOException, CryptoException { String digest=getChannelDigest(file); assertEquals("Digest Length",20,digest.length()); Index: SigningChannelTest.java =================================================================== RCS file: /cvsroot/neuclear/neuclear-commons/src/test/org/neuclear/commons/crypto/channels/SigningChannelTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SigningChannelTest.java 6 Mar 2004 21:53:51 -0000 1.2 --- SigningChannelTest.java 8 Mar 2004 17:13:54 -0000 1.3 *************** *** 4,8 **** import org.neuclear.commons.crypto.CryptoTools; import org.neuclear.commons.crypto.CryptoException; ! import org.neuclear.commons.test.JunitTools; import java.security.*; --- 4,8 ---- import org.neuclear.commons.crypto.CryptoTools; import org.neuclear.commons.crypto.CryptoException; ! import java.security.*; |