From: <ed...@bo...> - 2003-08-23 10:36:01
|
edwin 03/08/23 06:35:58 Modified: openpgp/src/cryptix/openpgp/test/all TestOpenPGP.java Added: openpgp/src/cryptix/openpgp/test/interop PGP8Interop.java Removed: openpgp/src/cryptix/openpgp/test/interop PGP8ReadKeyAndDecryptTest.java Log: Rename the PGP8 tests to PGP8Interop.java. Re-enable all tests that got accidentally disabled. Revision Changes Path 1.15 +4 -4 projects/openpgp/src/cryptix/openpgp/test/all/TestOpenPGP.java Index: TestOpenPGP.java =================================================================== RCS file: /home/cryptix-cvs/cvsroot/projects/openpgp/src/cryptix/openpgp/test/all/TestOpenPGP.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -r1.14 -r1.15 --- TestOpenPGP.java 23 Aug 2003 10:14:09 -0000 1.14 +++ TestOpenPGP.java 23 Aug 2003 10:35:57 -0000 1.15 @@ -1,4 +1,4 @@ -/* $Id: TestOpenPGP.java,v 1.14 2003/08/23 10:14:09 edwin Exp $ +/* $Id: TestOpenPGP.java,v 1.15 2003/08/23 10:35:57 edwin Exp $ * * Copyright (C) 1999-2001 The Cryptix Foundation Limited. * All rights reserved. @@ -27,8 +27,8 @@ public TestSuite suite() { TestSuite all = new TestSuite("All OpenPGP tests"); - all.addTestSuite(cryptix.openpgp.test.interop.PGP8ReadKeyAndDecryptTest.class); -/* all.addTestSuite(cryptix.openpgp.test.interop.ZLibEOFTest.class); + all.addTestSuite(cryptix.openpgp.test.interop.PGP8Interop.class); + all.addTestSuite(cryptix.openpgp.test.interop.ZLibEOFTest.class); all.addTestSuite(cryptix.openpgp.test.util.PGPCompareTest.class); all.addTestSuite(cryptix.openpgp.test.util.PGPCRCTest.class); all.addTestSuite(cryptix.openpgp.test.util.PGPMPITest.class); @@ -44,7 +44,7 @@ all.addTestSuite(cryptix.openpgp.test.provider.PGPUserIDPrincipalBuilderTest.class); all.addTestSuite(cryptix.openpgp.test.net.HkpTest.class); all.addTestSuite(cryptix.openpgp.test.net.PGPKeyServerImplTest.class); -*/ return all; + return all; } 1.1 projects/openpgp/src/cryptix/openpgp/test/interop/PGP8Interop.java Index: PGP8Interop.java =================================================================== /* $Id: PGP8Interop.java,v 1.1 2003/08/23 10:35:58 edwin Exp $ * * Copyright (C) 1999-2002 The Cryptix Foundation Limited. * All rights reserved. * * Use, modification, copying and distribution of this software is subject * the terms and conditions of the Cryptix General Licence. You should have * received a copy of the Cryptix General License along with this library; * if not, you can download a copy from http://www.cryptix.org/ . */ package cryptix.openpgp.test.interop; import cryptix.message.*; import cryptix.openpgp.*; import cryptix.pki.*; import junit.framework.TestCase; import junit.framework.TestSuite; import java.io.*; import java.util.*; public class PGP8Interop extends TestCase { private static final String FS = System.getProperty("file.separator"); private final File _testdir; public PGP8Interop(String name) { super(name); String td = System.getProperty("CRYPTIX_OPENPGP_TESTDIR"); if(td == null || "".equals(td) ) { _testdir = new File("." + FS + "testdata"); } else { _testdir = new File(td + FS + "testdata"); } } protected void setUp() { } protected void tearDown() { } public void testPGP8Interop() throws Exception { FileInputStream in; Collection msgs; KeyBundleMessage kbm; EncryptedMessage em; LiteralMessage lm; SignedMessage sm; Iterator it; KeyBundle prvDHDSS, pubDHDSS, prvRSAleg, pubRSAleg, prvRSAnew, pubRSAnew; MessageFactory mf = MessageFactory.getInstance("OpenPGP"); in = new FileInputStream(new File(_testdir, "PGP8_testkey_DHDSS.asc")); msgs = mf.generateMessages(in); it = msgs.iterator(); kbm = (KeyBundleMessage)it.next(); prvDHDSS = kbm.getKeyBundle(); kbm = (KeyBundleMessage)it.next(); pubDHDSS = kbm.getKeyBundle(); in.close(); in = new FileInputStream(new File(_testdir, "PGP8_testkey_RSA_legacy.asc")); msgs = mf.generateMessages(in); it = msgs.iterator(); kbm = (KeyBundleMessage)it.next(); prvRSAleg = kbm.getKeyBundle(); kbm = (KeyBundleMessage)it.next(); pubRSAleg = kbm.getKeyBundle(); in.close(); in = new FileInputStream(new File(_testdir, "PGP8_testkey_RSA_new.asc")); msgs = mf.generateMessages(in); it = msgs.iterator(); kbm = (KeyBundleMessage)it.next(); prvRSAnew = kbm.getKeyBundle(); kbm = (KeyBundleMessage)it.next(); pubRSAnew = kbm.getKeyBundle(); in.close(); in = new FileInputStream(new File(_testdir, "PGP8_enc_DHDSS_sig_RSAleg.asc")); msgs = mf.generateMessages(in); it = msgs.iterator(); em = (EncryptedMessage)msgs.iterator().next(); sm = (SignedMessage)em.decrypt(prvDHDSS, "TestingPassphrase".toCharArray()); assertTrue("Correctly signed", sm.verify(pubRSAleg)); lm = (LiteralMessage)sm.getContents(); assertEquals("Decrypted data", "Hello", lm.getTextData()); in = new FileInputStream(new File(_testdir, "PGP8_enc_RSAnew_sig_DHDSS.asc")); msgs = mf.generateMessages(in); it = msgs.iterator(); em = (EncryptedMessage)msgs.iterator().next(); sm = (SignedMessage)em.decrypt(prvRSAnew, "TestingPassphrase".toCharArray()); assertTrue("Correctly signed", sm.verify(pubDHDSS)); lm = (LiteralMessage)sm.getContents(); assertEquals("Decrypted data", "Hello", lm.getTextData()); in = new FileInputStream(new File(_testdir, "PGP8_enc_RSAleg_sig_RSAnew.asc")); msgs = mf.generateMessages(in); it = msgs.iterator(); em = (EncryptedMessage)msgs.iterator().next(); sm = (SignedMessage)em.decrypt(prvRSAleg, "TestingPassphrase".toCharArray()); assertTrue("Correctly signed", sm.verify(pubRSAnew)); lm = (LiteralMessage)sm.getContents(); assertEquals("Decrypted data", "Hello", lm.getTextData()); } } |