578c720de8ce3cb0ebb2f454af4b35f5d97b933c
[platform/framework/native/appfw.git] / inc / FSecPkcsPkcs08Attribute.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                FSecPkcsPkcs08Attribute.h
19  * @brief               This is the header file for the %Pkcs08Attribute class.
20  *
21  * This header file contains the declarations of the %Pkcs08Attribute class.
22  */
23
24 #ifndef _FSEC_PKCS_PKCS_08_ATTRIBUTE_H_
25 #define _FSEC_PKCS_PKCS_08_ATTRIBUTE_H_
26
27 #include <FBaseByteBuffer.h>
28 #include <FBaseResult.h>
29 #include <FSecPkcsPkcs08AttributeValue.h>
30
31 namespace Tizen { namespace Security { namespace Pkcs
32 {
33
34 /**
35  * @class               Pkcs08Attribute
36  * @brief               This class implements the functionalities specified by the %Pkcs08Attribute class.
37  *
38  * @since               2.1
39  *
40  * The %Pkcs08Attribute class implements the functionalities specified by the %Pkcs08Attribute class. An Attribute object consists
41  *                                      of an attribute type (specified by an object identifier) and one or more attribute values. It acts as a
42  *                                      container for adding, inserting, removing, and encoding X.509 AttributeValue.
43  *
44  */
45
46 class _OSP_EXPORT_ Pkcs08Attribute
47         : public Tizen::Base::Object
48 {
49 public:
50         /**
51          * The object is not fully constructed after this constructor is called. @n
52          * For full construction, the Construct() method must be called right after calling this constructor.
53          *
54          * @since       2.1
55          */
56         Pkcs08Attribute(void);
57
58         /**
59          * This destructor overrides Tizen::Base::Object::~Object().
60          *
61          * @since       2.1
62          */
63         virtual ~Pkcs08Attribute(void);
64
65         /**
66          * Initializes this instance of %Pkcs08Attribute with the Tizen::Base::ByteBuffer that contains the X.509 attribute @n
67          * structure in ASN.1 DER format.
68          *
69          * @since               2.1
70          *
71          * @return              An error code
72          * @param[in]   encodedData                             The DER encoded Tizen::Base::ByteBuffer containing the X.509 attribute structure
73          * @exception   E_SUCCESS                                       The method is successful.
74          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
75          */
76         result Construct(const Tizen::Base::ByteBuffer& encodedData);
77
78         /**
79          * Initializes this instance of %Pkcs08Attribute with the specified attribute type.
80          *
81          * @since               2.1
82          *
83          * @return              An error code
84          * @param[in]   attributeType                   The object identifier of a particular X.509 attribute type @n Object IDs (for example, oid for name is 2.5.4.41) are defined by standard attribute bodies.
85          * @exception   E_SUCCESS                                       The method is successful.
86          * @exception   E_INVALID_ARG                   The specified input parameter is invalid.
87          */
88         result Construct(const Tizen::Base::String& attributeType);
89
90         /**
91          * Gets the attribute type. @n
92          * The %GetAttributeType() method implements GetAttributeType that returns the attribute type of this attribute instance.
93          *
94          * @since               2.1
95          *
96          * @return              Containing the object ID of attribute type in string format like 2.5.4.41
97          *
98          */
99         Tizen::Base::String GetAttributeType(void) const;
100
101         /**
102          * Adds an attribute value in the attribute value list.
103          *
104          * @since               2.1
105          *
106          * @return              An error code
107          * @param[in]   attributeValue                  An instance of Pkcs08AttributeValue to add an attribute in the list
108          */
109         result AddAttributeValue(const Pkcs08AttributeValue& attributeValue);
110
111         /**
112          * Removes an attribute value from the attribute value list.
113          *
114          * @since               2.1
115          *
116          * @return              An error code
117          * @param[in]   attributeValue                  An instance of Pkcs08AttributeValue to remove an attribute from the list
118          */
119         result RemoveAttributeValue(const Pkcs08AttributeValue& attributeValue);
120
121         /**
122          * Returns an array list containing the attribute values of type Pkcs08AttributeValue.
123          *
124          * @since               2.1
125          *
126          * @return              A reference to an ArrayList containing the list of attribute values
127          */
128         const Tizen::Base::Collection::ArrayList& GetAttributeValues(void) const;
129
130         /**
131          * Gets the encoded form of Pkcs08Attribute.
132          * It is assumed that each %Pkcs08Attribute will have only a single form of encoding, for example ASN.1 DER.
133          *
134          * @since               2.1
135          *
136          * @return              A pointer to the Tizen::Base::ByteBuffer class that contains the output, @n
137          *                                              else @c null if an error occurs
138          *
139          * @exception   E_SUCCESS                                               The method is successful.
140          * @exception   E_SYSTEM                                                The method cannot proceed due to a severe system error.
141          * @remarks             The specific error code can be accessed using the GetLastResult() method.
142          */
143         Tizen::Base::ByteBuffer* GetEncodedDataN(void) const;
144
145 private:
146         // This copy constructor is intentionally declared as private to prohibit @n
147         // copying of objects by users.
148         //
149         // @since               2.1
150         Pkcs08Attribute(const Pkcs08Attribute& rhs);
151
152         // The implementation of this copy assignment operator is intentionally blank and @n
153         // declared as private to prohibit copying of objects.
154         //
155         // @since               2.1
156         Pkcs08Attribute& operator =(const Pkcs08Attribute& rhs);
157
158 private:
159         class _Pkcs08AttributeImpl* __pPkcs08AttributeImpl;
160         friend class _Pkcs08AttributeImpl;
161
162 }; //Pkcs08Attribute
163
164 }}} // Tizen::Security::Pkcs
165
166 #endif // _FSEC_PKCS_PKCS_08_ATTRIBUTE_H_