sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FSecDesSecureRandom.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file                        FSecDesSecureRandom.h
20  * @brief               This is the header file for the %DesSecureRandom class.
21  *
22  * This header file contains the declarations of the %DesSecureRandom class.
23  */
24 #ifndef _FSEC_DES_SECURE_RANDOM_H_
25 #define _FSEC_DES_SECURE_RANDOM_H_
26
27 #include <FSecISecureRandom.h>
28
29
30 namespace Tizen { namespace Security
31 {
32
33 /**
34  *      @class          DesSecureRandom
35  *      @brief          This class provides a secure random object with Data Encryption Standard (DES) method.
36  *
37  *      @since          2.0
38  *
39  *  The %DesSecureRandom class generates a secure random object that can be used to seed deterministic, cryptographic algorithms.
40  *  The DES method generates a user-defined number of random bytes. @n
41  *
42  * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/security/key_mgmt_and_csprng.htm">Key Management and CSPRNG</a>.
43  *
44  *      @see    ISecureRandom
45  *      @see    AesSecureRandom
46  *      @see    DesEdeSecureRandom
47  */
48 class _OSP_EXPORT_ DesSecureRandom
49         : public virtual ISecureRandom
50         , public Tizen::Base::Object
51 {
52
53 public:
54         /**
55          *      This is the default constructor for this class.
56          *
57          * @since       2.0
58          */
59         DesSecureRandom(void);
60
61         /**
62          * This destructor overrides Tizen::Base::Object::~Object().
63          *
64          * @since       2.0
65          */
66         virtual ~DesSecureRandom(void);
67
68         /**
69          *      Generates a user-specified number of random bytes.
70          *
71          *      @since           2.0
72          *
73          *      @return         A pointer to the Tizen::Base::ByteBuffer class, @n
74          *                                      else @c null if an error occurs
75          *      @param[in]      numBytes                                The number of random bytes to generate
76          *      @exception      E_SUCCESS                               The method is successful.
77          *      @exception      E_OUT_OF_MEMORY                 The memory is insufficient.
78          *      @exception      E_INVALID_ARG                   The specified @c numBytes is @c 0 or negative.
79          *  @exception  E_SYSTEM                                A system error has occurred. @n
80          *                                      The Tizen::Base::ByteBuffer operation has failed.
81          */
82         virtual Tizen::Base::ByteBuffer* GenerateRandomBytesN(int numBytes);
83
84 private:
85
86         //
87         // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
88         //
89         // @since 2.0
90         //
91         DesSecureRandom(const DesSecureRandom& rhs);
92
93         //
94         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
95         //
96         // @since 2.0
97         //
98         DesSecureRandom& operator =(const DesSecureRandom& rhs);
99
100 private:
101         class _DesSecureRandomImpl* __pDesSecureRandomImpl;
102         friend class _DesSecureRandomImpl;
103
104 }; //DesSecureRandom
105
106 } } //Tizen::Security
107
108 #endif // _FSEC_DES_SECURE_RANDOM_H_