The Internet of Things (IoT) has changed our lives drastically. Customers, regulatory bodies, and industrial partners are driving us to use IoT. Although IoT provides new opportunities, security remains a key concern while providing various services. It is especially challenging how the data generated from IoT devices can be protected from potential security attacks and how to safeguard the exchange of these data while transiting through different nodes and gateways. In this research, we aim to ensure a safe IoT environment by proposing an efficient key management technique that uses a combination of symmetric and asymmetric cryptosystem to obtain the speed of the former as well as the security benefits of the latter. Our proposal considers a set of Smart Objects (SO) capable of key registration, generation and distribution for IoT data transmission. We used the open-source Message Queuing Telemetry Transport (MQTT) protocol to facilitate communications between the source and the destination nodes. The suitability of the proposed approach is measured experimentally and the results are comparable to existing works with respect to key conversion time, algorithm execution time, number of reuse connections, and bandwidth utilization.