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