ECCPEM
Do you want to generate Elliptic Curve Cryptography (ECC) key pairs (public and private keys), write them to a .PEM file,
or read them from a .PEM file in C/C++ programming languages?
The ECCPEM library makes it super easy just invoking one function and the job is done!
Build
Before installing the project, make sure you have installed the minimum requirements: the Cmake and OpenSSL libraries.
$ sudo apt-get instal cmake libssl-devUse git from the command-line to clone the source code:
$ git clone https://github.com/baloyan/eccpem.git
$ cd eccpemTo configure and build the project run the following commands:
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make installUsage
Create a eccpem_test.c file and write the following code:
#include <eccpem/eccpem.h>
#include <stdio.h>
int main() {
const char* pubkey_file = "pub_key.pem";
const char* privkey_file = "priv_key.pem";
const char* ec_type = "secp256k1";
const int error_code = CreateECCKeysPemFiles(ec_type, pubkey_file, privkey_file);
if (error_code == 1) {
printf("Generation of ECC key pairs was successful.\n");
} else {
printf("Generation of ECC key pairs filed.\n");
}
return 0;
}Compile the above code:
$ gcc -o myeccpem eccpem_test.c -leccpem -lssl -lcryptoRun executable file:
$ ./myeccpemSee C++ example: cpp_gen_pem_files.cpp
Compile C++ code:
$ g++ -o myeccpem cpp_eccpem_test.cpp -leccpem -lssl -lcryptoECCPEM API
For detailed ECCPEM API documentation take a look at eccpem/docs
Contributions
Contributions can be made by submitting GitHub pull requests to this repository. In general, the ECCPEM source code follows Google's C++ style guide. (Yes, it is for C++, but please follow the rules for C language as well).
License
All contributions are made under the MIT license. See LICENSE.

