2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 * @file FSecPublicKey.h
20 * @brief This is the header file for the %PublicKey class.
22 * This header file contains the declarations of the %PublicKey class.
24 #ifndef _FSEC_PUBLIC_KEY_H_
25 #define _FSEC_PUBLIC_KEY_H_
28 #include <FSecIPublicKey.h>
31 namespace Tizen { namespace Security
36 * @brief This class specifies the RSA public key.
40 * The %PublicKey class manages a public key, which is used in asymmetric ciphers.
41 * The RSA algorithm encrypts the data using the public key. @n
43 * 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>.
47 * @see IKeyPairGenerator
49 class _OSP_EXPORT_ PublicKey
51 , public virtual IPublicKey
52 , public Tizen::Base::Object
56 * This is the default constructor for this class.
63 * This destructor overrides Tizen::Base::Object::~Object().
67 virtual ~PublicKey(void);
70 * Gets the name of the primary encoding format of the current instance of %PublicKey.
74 * @return The primary encoding format of the key
76 virtual Tizen::Base::String GetFormat(void) const;
79 * Gets the public key in its primary encoding format.
83 * @return A pointer to the Tizen::Base::ByteBuffer class, @n
84 * else @c null if an error occurs
85 * @exception E_SUCCESS The method is successful.
86 * @exception E_OUT_OF_MEMORY The memory is insufficient.
87 * @remarks The specific error code can be accessed using the GetLastResult() method.
89 virtual Tizen::Base::ByteBuffer* GetEncodedN(void) const;
92 * Sets the public key buffer.
96 * @return An error code
97 * @param[in] keyBuffer An instance of Tizen::Base::ByteBuffer
98 * @exception E_SUCCESS The method is successful.
99 * @exception E_INVALID_ARG The specified @c keyBuffer is invalid.
100 * @remarks Only ASN.1 encoding format is supported for input buffer.
102 virtual result SetKey(const Tizen::Base::ByteBuffer& keyBuffer);
107 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
111 PublicKey(const PublicKey& rhs);
114 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
118 PublicKey& operator =(const PublicKey& rhs);
121 Tizen::Base::String __algorithm;
122 Tizen::Base::String __encodedFormat;
123 Tizen::Base::ByteBuffer __keyBytes;
125 class _PublicKeyImpl* __pPublicKeyImpl;
126 friend class _PublicKeyImpl;
130 } } //Tizen::Security
132 #endif //_FSEC_PUBLIC_KEY_H_