KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > lightcrypto > test > KeyTest


1 /*
2   Name: net.sourceforge.lightcrypto.test.KeyTest
3   Licensing: LGPL (lesser GNU Public License)
4   API: Bouncy Castle (http://www.bouncycastle.org) lightweight API
5
6   Disclaimer:
7
8   COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND,
9   EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE
10   IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE
11   RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE
12   PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR)
13   ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY
14   CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED
15   HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
16
17   (C) Copyright 2003 Gert Van Ham
18
19 */

20
21 package net.sourceforge.lightcrypto.test;
22
23 import junit.framework.TestCase;
24 import net.sourceforge.lightcrypto.Key;
25 import net.sourceforge.lightcrypto.SafeObject;
26
27 /**
28  * A collection of key tests
29  * <P>
30  * These tests can be run using JUnit (http://www.junit.org)
31  *
32  * @author Gert Van Ham
33  * @author hamgert@users.sourceforge.net
34  * @author http://jcetaglib.sourceforge.net
35  * @version $Id: KeyTest.java,v 1.2 2003/10/05 11:41:29 hamgert Exp $
36  */

37
38 public class KeyTest extends TestCase {
39     /**
40      * test key generation
41      *
42      * @throws Exception
43      */

44     public void testGenerateKey() throws Exception JavaDoc {
45         Key.generatekey(RunTest.TEMPFOLDER + "tempkey.key",new StringBuffer JavaDoc("password"), new StringBuffer JavaDoc("123456789"));
46     }
47
48     /**
49      * test key loading
50      *
51      * @throws Exception
52      */

53     public void testLoadKey() throws Exception JavaDoc {
54         SafeObject k = new SafeObject();
55         k = Key.loadkey(RunTest.TEMPFOLDER + "tempkey.key",new StringBuffer JavaDoc("password"));
56     }
57 }
58
Popular Tags