Update contrib.
2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
15 * Random generator interface
26 #ifndef __CRYPTOAPI_RANDOMPLUGIN_H__
27 #define __CRYPTOAPI_RANDOMPLUGIN_H__
29 #include <cryptospi/cryptoplugin.h>
34 A pseudo-random number generator (PRNG).
35 Generates random numbers derived from entropy obtained from another
36 source, usually a hardware random number generator or if unavailable,
37 from a combination variety of unpredictable system variables, added
38 to an entropy pool which is used for seeding. This might include
39 keypresses generated by a user, hardware interrupts, etc.
41 class MRandom : public MPlugin
45 * Implementations of this method should fill the passed
46 * buffer with the generated pseudo-random data up to the
47 * current length, discarding any current contents. The
48 * implementations should leave with KErrNotSecure when
49 * the generated random data is not secure enough.
51 * @param aDest The buffer to fill with random data
52 * @leave KErrNotSecure Random data generated is not
53 * secure enough for crytographic operations
54 * otherwise, leaves with any other system wide error code.
57 virtual void GenerateRandomBytesL(TDes8& aDest) = 0;
61 class MAsyncRandom : public MPlugin
65 * Implementations of this method should fill the passed
66 * buffer with the generated pseudo-random data up to the
67 * current length, discarding any current contents. The
68 * implementations should leave with KErrNotSecure when
69 * the generated random data is not secure enough.
71 * @param aDest The buffer to fill with random data
72 * @param aStatus The argument to carry the asynchonous request completion
73 * status to notify the client when buffer is filled with random data.
74 * @leave KErrNotSecure Random data generated is not
75 * secure enough for crytographic operations
76 * otherwise, leaves with any other system wide error code.
79 virtual void GenerateRandomBytesL(TDes8& aDest, TRequestStatus& aStatus) = 0;
82 Cancel an outstanding request
84 virtual void Cancel() = 0;
89 #endif // __CRYPTOAPI_RANDOMPLUGIN_H__