Git Product home page Git Product logo

eccpem's Introduction

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-dev

Use git from the command-line to clone the source code:

$ git clone https://github.com/baloyan/eccpem.git
$ cd eccpem

To configure and build the project run the following commands:

$ mkdir build
$ cd build

$ cmake ..
$ make
$ sudo make install

Usage

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 -lcrypto

Run executable file:

$ ./myeccpem

See C++ example: cpp_gen_pem_files.cpp

Compile C++ code:

$ g++ -o myeccpem cpp_eccpem_test.cpp -leccpem -lssl -lcrypto

ECCPEM 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.

eccpem's People

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.