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 FSecCryptoIKeyExchange.h
20 * @brief This is the header file for the %IKeyExchange interface.
22 * This header file contains the declarations of the %IKeyExchange interface.
24 #ifndef _FSEC_CRYPTO_IKEY_EXCHANGE_H_
25 #define _FSEC_CRYPTO_IKEY_EXCHANGE_H_
27 #include <FBaseByteBuffer.h>
28 #include <FSecCryptoTypes.h>
29 #include <FSecKeyPair.h>
30 #include <FSecIKeyParameters.h>
32 namespace Tizen { namespace Security { namespace Crypto
36 * @interface IKeyExchange
37 * @brief This interface provides methods for the Key Exchange algorithm.
41 * The %IKeyExchange interface provides methods to exchange secure keys between two communicating users. @n
43 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/security/key_exchange_algorithm.htm">Key exchanging</a>.
45 * @see KeyPairGenerator
47 class _OSP_EXPORT_ IKeyExchange
52 * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes @n
53 * are called when the destructor of this interface is called.
57 virtual ~IKeyExchange(void) {}
60 * Initializes this instance of %IKeyExchange with the specified key parameters.
64 * @return An error code
65 * @param[in] keyParameters The domain parameters of the key exchange algorithm that needs to instantiate
66 * @exception E_SUCCESS The method is successful.
67 * @exception E_INVALID_ARG The specified input parameter is invalid.
68 * @exception E_OUT_OF_MEMORY The memory is insufficient.
69 * @remarks The key parameters can be @c null depending on the underlying key exchange algorithm.
71 virtual result Construct(const Tizen::Security::IKeyParameters& keyParameters) = 0;
74 * Generates the final version of the shared secret amongst the two parties.
78 * @return A pointer to the Tizen::Base::ByteBuffer class that contains the generated secret key, @n
79 * else @c null if the method fails to generate the secret key
80 * @param[in] privateKey The private key component of the first party to instantiate
81 * @param[in] publicKey The public key component of the second party to instantiate
82 * @exception E_SUCCESS The method is successful.
83 * @exception E_INVALID_ARG A specified input parameter is invalid.
84 * @exception E_OUT_OF_MEMORY The memory is insufficient.
85 * @exception E_SYSTEM A system error has occurred. @n
86 * The method has failed to operate with the openssl library, or
87 * the Tizen::Base::ByteBuffer operation has failed.
88 * @remarks The specific error code can be accessed using the GetLastResult() method.
90 virtual Tizen::Base::ByteBuffer* GenerateSecretN(Tizen::Security::IPrivateKey& privateKey, Tizen::Security::IPublicKey& publicKey) = 0;
95 // This method is for internal use only. Using this method can cause behavioral, security-related,
96 // and consistency-related issues in the application.
98 // This method is reserved and may change its name at any time without prior notice.
102 virtual void IKeyExchange_Reserved1(void) {}
105 // This method is for internal use only. Using this method can cause behavioral, security-related,
106 // and consistency-related issues in the application.
108 // This method is reserved and may change its name at any time without prior notice.
112 virtual void IKeyExchange_Reserved2(void) {}
115 // This method is for internal use only. Using this method can cause behavioral, security-related,
116 // and consistency-related issues in the application.
118 // This method is reserved and may change its name at any time without prior notice.
122 virtual void IKeyExchange_Reserved3(void) {}
126 } } } //Tizen::Security::Crypto
128 #endif //_FSEC_CRYPTO_IKEY_EXCHANGE_H_