Merge "Update deprecated libprivilege-control API functions." into tizen
[platform/framework/native/appfw.git] / inc / FSecPkcsPkcs08AttributeValue.h
1 //
2 // Copyright (c) 2013 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                FSecPkcsPkcs08AttributeValue.h
19  * @brief               This is the header file for the %Pkcs08AttributeValue class.
20  *
21  * This header file contains the declarations of the %Pkcs08AttributeValue class.
22  */
23
24 #ifndef _FSEC_PKCS_PKCS_08_ATTRIBUTE_VALUE_H_
25 #define _FSEC_PKCS_PKCS_08_ATTRIBUTE_VALUE_H_
26
27 #include <FBaseByteBuffer.h>
28 #include <FBaseResult.h>
29 #include <FSecPkcsTypes.h>
30
31 namespace Tizen { namespace Security { namespace Pkcs
32 {
33
34 /**
35  * @class               Pkcs08AttributeValue
36  * @brief               This class implements the functionalities specified by the %Pkcs08AttributeValue class.
37  * 
38  * @since               2.1
39  *
40  * The %Pkcs08AttributeValue class implements the functionalities specified by the %Pkcs08AttributeValue class.
41  * The %Pkcs08AttributeValue object consists of an attribute value and a tag value.
42  *
43  */
44 class _OSP_EXPORT_ Pkcs08AttributeValue
45         : public Tizen::Base::Object
46 {
47 public:
48         /**
49          * The object is not fully constructed after this constructor is called. @n
50          * For full construction, the Construct() method must be called right after calling this constructor.
51          *
52          * @since       2.1
53          */
54         Pkcs08AttributeValue(void);
55
56         /**
57          * This destructor overrides Tizen::Base::Object::~Object().
58          *
59          * @since       2.1
60          */
61         virtual ~Pkcs08AttributeValue(void);
62
63         /**
64          * Initializes this instance of %Pkcs08AttributeValue with the specified Tizen::Base::ByteBuffer that contains the AttributeValue @n
65          * (contains tag, that is, Ans1_Type and the value).
66          *
67          * @since               2.1
68          *
69          * @return              An error code
70          * @param[in]   encodedData                             The DER encoded Tizen::Base::ByteBuffer of AttributeValue
71          * @exception   E_SUCCESS                               The method is successful.
72          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
73          */
74         result Construct(const Tizen::Base::ByteBuffer& encodedData);
75
76         /**
77          * Initializes this instance of %Pkcs08AttributeValue with the specified parameters. @n
78          * The %Construct() method initializes the attribute value instance based on the byte buffer passed.
79          *
80          * @since               2.1
81          *
82          * @return              An error code
83          * @param[in]   value                                   An instance of Tizen::Base::ByteBuffer holding raw value
84          * @param[in]   tag                                             A tag holding the tag type @n This tag number is assigned by ASN1 standards for 
85          *                                                                              basic data types.
86          * @exception   E_SUCCESS                               The method is successful.
87          * @exception   E_INVALID_ARG                   A specified input parameter is invalid.
88          */
89         result Construct(const Tizen::Base::ByteBuffer& value, Pkcs08TagValue tag);
90
91         /**
92          * Gets a reference to the Tizen::Base::ByteBuffer instance that contains the attribute value.
93          *
94          * @since               2.1
95          *
96          * @return              An instance of Tizen::Base::ByteBuffer containing raw value
97          * @remarks             The specific error code can be accessed using the GetLastResult() method.
98          */
99         const Tizen::Base::ByteBuffer& GetValue(void) const;
100
101         /**
102          * Gets the tag value of an attribute. @n
103          * This tag number is assigned by ASN1 standards for basic data types.
104          *
105          * @since               2.1
106          *
107          * @return              The tag value that is assigned by ASN1 standards for basic data types
108          */
109         Pkcs08TagValue GetTag(void) const;
110
111         /**
112          * Gets a pointer to Tizen::Base::ByteBuffer that contains the attribute value in encoded format. @n
113          * It is assumed that each Pkcs08Attribute will have only a single form of encoding, for example, ASN.1 DER.
114          *
115          * @since               2.1
116          *
117          * @return              A pointer to the Tizen::Base::ByteBuffer instance that contains the output, @n
118          *                              else @c null if an error occurs
119          * @exception   E_SUCCESS                               The method is successful.
120          * @exception   E_SYSTEM                                The method cannot proceed due to a severe system error.
121          * @remarks             The specific error code can be accessed using the GetLastResult() method.
122          */
123         Tizen::Base::ByteBuffer* GetEncodedDataN(void) const;
124
125 private:
126         // This copy constructor is intentionally declared as private to prohibit @n
127         // copying of objects by users.
128         //
129         // @since               2.1
130         Pkcs08AttributeValue(const Pkcs08AttributeValue& rhs);
131
132         // The implementation of this copy assignment operator is intentionally blank and @n
133         // declared as private to prohibit copying of objects.
134         //
135         // @since               2.1
136         Pkcs08AttributeValue& operator =(const Pkcs08AttributeValue& rhs);
137
138 private:
139         class _Pkcs08AttributeValueImpl* __pPkcs08AttributeValueImpl;
140         friend class _Pkcs08AttributeValueImpl;
141
142 }; //Pkcs08AttributeValue
143
144 }}} //Tizen::Security::Pkcs
145
146 #endif // _FSEC_PKCS_PKCS_08_ATTRIBUTE_VALUE_H_