sync with tizen_2.0
[platform/framework/native/appfw.git] / inc / FSecDesEdeSecureRandom.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                FSecDesEdeSecureRandom.h
20  * @brief       This is the header file for the %DesEdeSecureRandom class.
21  *
22  * This header file contains the declarations of the %DesEdeSecureRandom class.
23  */
24 #ifndef _FSEC_DESEDE_SECURE_RANDOM_H_
25 #define _FSEC_DESEDE_SECURE_RANDOM_H_
26
27 #include <FSecISecureRandom.h>
28
29
30 namespace Tizen { namespace Security
31 {
32
33 /**
34  * @class       DesEdeSecureRandom
35  * @brief       This class provides a secure random object with the Data Encryption Standard in the Encrypt-Decrypt-Encrypt (DES-EDE) mode.
36  *
37  * @since       2.0
38  *
39  * The %DesEdeSecureRandom class generates a secure random object to deterministically seed cryptographic algorithms. The Data Encryption Standard (DES)
40  * method generates user-defined number of random bytes in the Encrypt-Decrypt-Encrypt mode. @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         DesSecureRandom
47  */
48 class _OSP_EXPORT_ DesEdeSecureRandom
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         DesEdeSecureRandom(void);
60
61         /**
62          * This destructor overrides Tizen::Base::Object::~Object().
63          *
64          * @since               2.0
65          */
66         virtual ~DesEdeSecureRandom(void);
67
68         /**
69          * Generates a user-defined number of random bytes.
70          *
71          * @since               2.0
72          *
73          * @return              A pointer to the Tizen::Base::ByteBuffer class that contains the output, @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 method has failed to operate with the OpenSSL library, or 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         DesEdeSecureRandom(const DesEdeSecureRandom& 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         DesEdeSecureRandom& operator =(const DesEdeSecureRandom& rhs);
99
100 private:
101         class _DesEdeSecureRandomImpl* __pDesEdeSecureRandomImpl;
102         friend  class _DesEdeSecureRandomImpl;
103
104 }; //DesEdeSecureRandom
105
106 } } //Tizen::Security
107
108 #endif // _FSEC_DESEDE_SECURE_RANDOM_H_