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