|
Open Model Railroad Network (OpenMRN)
|
Go to the source code of this file.
Classes | |
| class | MD |
| Helper class to do hashing algorithms via OpenSSL library. More... | |
Macros | |
| #define | ASSERT_EQ(expected, actual) |
Functions | |
| void | CCMEncrypt (const std::string &aes_key, const std::string &iv, const std::string &auth_data, const std::string &plain, std::string *cipher, std::string *tag) |
| Performs authenticated encryption using AES-CCM. | |
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Helper function to perform encryption/authentication/decryption using AES-CCM algorithm with OpenSSL crypt library.
In order to use this function, you need to install libssl-dev package and add to the makefile of your application target to link against it:
SYSLIBRARIESEXTRA+=-lcrypto
Definition in file OpenSSLAesCcm.hxx.
| #define ASSERT_EQ | ( | expected, | |
| actual | |||
| ) |
Definition at line 50 of file OpenSSLAesCcm.hxx.
| void CCMEncrypt | ( | const std::string & | aes_key, |
| const std::string & | iv, | ||
| const std::string & | auth_data, | ||
| const std::string & | plain, | ||
| std::string * | cipher, | ||
| std::string * | tag | ||
| ) |
Performs authenticated encryption using AES-CCM.
| aes_key | is the 256-bit key. |
| iv | is the unique initialization vector, must be 11 bytes long. |
| auth_data | is plaintext additional authenticated data. |
| plain | will be encrypted. |
| cipher | is the output of the encryption. |
| tag | is the output of the signature. Will use 16 bytes. |
Definition at line 72 of file OpenSSLAesCcm.hxx.