KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > lightcrypto > Clean


1 /*
2   Name: net.sourceforge.lightcrypto.Clean
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;
22
23 /**
24  * Utitlity to clean byte arrays & stringbuffers
25  *
26  * @author Gert Van Ham
27  * @author hamgert@users.sourceforge.net
28  * @author http://jcetaglib.sourceforge.net
29  * @version $Id: Clean.java,v 1.2 2003/10/05 11:41:29 hamgert Exp $
30  */

31
32 public class Clean {
33     /**
34     * zero out the passed in byte array
35     *
36     * @param bytes common byte array
37     **/

38     static public void blank(
39         byte[] bytes)
40     {
41         for (int t = 0; t < bytes.length; t++)
42         {
43             bytes[t] = 0;
44         }
45     } // blank()
46

47    /**
48     * zero out the passed in StringBuffer
49     *
50     * @param stringbuffer StringBuffer[]
51     **/

52     static public void blank(
53         StringBuffer JavaDoc stringbuffer)
54     {
55             if (stringbuffer != null) {
56                 stringbuffer.delete(0,stringbuffer.length());
57             }
58     } // blank()
59
}
60
Popular Tags