2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 * @file FSecPrivateKey.h
19 * @brief This is the header file for the %PrivateKey class.
21 * This header file contains the declarations of the %PrivateKey class.
23 #ifndef _FSEC_PRIVATE_KEY_H_
24 #define _FSEC_PRIVATE_KEY_H_
27 #include <FSecIPrivateKey.h>
30 namespace Tizen { namespace Security
35 * @brief This class specifies the RSA private key.
39 * The %PrivateKey class manages a private key, which is used in asymmetric ciphers. The RSA algorithm decrypts the data using the private key. @n
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>.
45 * @see IKeyPairGenerator
47 class _OSP_EXPORT_ PrivateKey
49 , public virtual IPrivateKey
50 , public Tizen::Base::Object
55 * This is the default constructor for this class.
62 * This destructor overrides Tizen::Base::Object::~Object().
66 virtual ~PrivateKey(void);
69 * Gets the name of the primary encoding format of the current instance of %PrivateKey.
73 * @return The primary encoding format of a key
75 virtual Tizen::Base::String GetFormat(void) const;
78 * Gets the private key in its primary encoding format.
82 * @return A pointer to the Tizen::Base::ByteBuffer class, @n
83 * else @c null if an error occurs
84 * @exception E_SUCCESS The method is successful.
85 * @exception E_OUT_OF_MEMORY The memory is insufficient.
86 * @remarks The specific error code can be accessed using the GetLastResult() method.
88 virtual Tizen::Base::ByteBuffer* GetEncodedN(void) const;
91 * Sets the private key buffer.
95 * @return An error code
96 * @param[in] keyBuffer An instance of Tizen::Base::ByteBuffer
97 * @exception E_SUCCESS The method is successful.
98 * @exception E_INVALID_ARG The specified @c keyBuffer is invalid.
99 * @remarks Only ASN.1 encoding format is supported for input buffer.
101 virtual result SetKey(const Tizen::Base::ByteBuffer& keyBuffer);
106 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
110 PrivateKey(const PrivateKey& rhs);
113 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
117 PrivateKey& operator =(const PrivateKey& rhs);
120 Tizen::Base::String __algorithm;
121 Tizen::Base::String __encodedFormat;
122 Tizen::Base::ByteBuffer __keyBytes;
124 class _PrivateKeyImpl* __pPrivateKeyImpl;
125 friend class _PrivateKeyImpl;
129 } } // Tizen::Security
131 #endif //_FSEC_PRIVATE_KEY_H_