KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > security > SecureRandomSpi


1 /*
2  * @(#)SecureRandomSpi.java 1.11 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7  
8 package java.security;
9
10 /**
11  * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>)
12  * for the <code>SecureRandom</code> class.
13  * All the abstract methods in this class must be implemented by each
14  * service provider who wishes to supply the implementation
15  * of a cryptographically strong pseudo-random number generator.
16  *
17  * @version 1.11, 12/19/03
18  *
19  * @see SecureRandom
20  * @since 1.2
21  */

22
23 public abstract class SecureRandomSpi implements java.io.Serializable JavaDoc {
24
25     private static final long serialVersionUID = -2991854161009191830L;
26
27     /**
28      * Reseeds this random object. The given seed supplements, rather than
29      * replaces, the existing seed. Thus, repeated calls are guaranteed
30      * never to reduce randomness.
31      *
32      * @param seed the seed.
33      */

34     protected abstract void engineSetSeed(byte[] seed);
35
36     /**
37      * Generates a user-specified number of random bytes.
38      *
39      * @param bytes the array to be filled in with random bytes.
40      */

41     protected abstract void engineNextBytes(byte[] bytes);
42
43     /**
44      * Returns the given number of seed bytes. This call may be used to
45      * seed other random number generators.
46      *
47      * @param numBytes the number of seed bytes to generate.
48      *
49      * @return the seed bytes.
50      */

51      protected abstract byte[] engineGenerateSeed(int numBytes);
52 }
53
Popular Tags