tiny-ECDH-c-master.zip

  • Niloooooooooofar
    了解作者
  • C/C++
    开发工具
  • 13KB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 0
    下载次数
  • 2021-03-02 23:24
    上传日期
ECC code - taken from others
tiny-ECDH-c-master.zip
  • tiny-ECDH-c-master
  • ecdh.c
    28.7KB
  • LICENSE
    1.2KB
  • ecdh.h
    3KB
  • README.md
    3.2KB
  • ecdh_example.c
    4KB
内容介绍
### Tiny ECDH / ECC in C This is a small and portable implementation of the [Elliptic-Curve Diffie-Hellman key agreement algorithm](https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93Hellman) written in C. Description from Wikipedia: > Elliptic-curve Diffie–Hellman (ECDH) is an anonymous key agreement protocol that allows two parties, each having an elliptic-curve public–private key pair, to establish a shared secret over an insecure channel. This shared secret may be directly used as a key, or to derive another key. The key, or the derived key, can then be used to encrypt subsequent communications using a symmetric-key cipher. It is a variant of the Diffie–Hellman protocol using elliptic-curve cryptography. ` You can choose between 10 standard NIST curves of different sizes. 5 pseudo-random curves and 5 Koblitz curves providing from 80 to 256 bits symmetrically equivalent security. See [ecdh.h](https://github.com/kokke/tiny-ECDH-c/blob/master/ecdh.h) for clarification. You can define the macro `ECDH_COFACTOR_VARIANT` in [ecdh.c](https://github.com/kokke/tiny-ECDH-c/blob/master/ecdh.c) to enable the [co-factor variant of ECDH](https://crypto.stackexchange.com/questions/18222/difference-between-ecdh-with-cofactor-key-and-ecdh-without-cofactor-key) for safe non-ephemeral use. The API is very simple and looks like this (I am using C99 `<stdint.h>`-style annotated types): ```C /* NOTE: assumes private is filled with random data before calling */ int ecdh_generate_keys(uint8_t* public, uint8_t* private); /* input: own private key + other party's public key, output: shared secret */ int ecdh_shared_secret(const uint8_t* private, const uint8_t* others_pub, uint8_t* output); ``` You need to provide random data for the private key yourself, for the key generation process. See [ecdh_example.c](https://github.com/kokke/tiny-ECDH-c/blob/master/ecdh_example.c) for an example of how to use the library. There is no built-in protection from out-of-bounds memory access errors as a result of malicious input. The two functions ecdh_shared_secret() and ecdh_generate_keys() expect inputs of a certain length. See [ecdh.h](https://github.com/kokke/tiny-ECDH-c/blob/master/ecdh.h) for clarification. The module allocates no RAM internally and takes up 2.1K ROM when compiled for ARM (1.4K for Thumb but YMMV). A keypair requires between 72 and 216 bytes of RAM depending on which curve you choose (i.e. how big the underlying base field is). It is the smallest implementation of ECC in C I've seen yet, but do contact me if you know of something smaller (or have improvements to the code here). ```C $ arm-none-eabi-gcc -Os -c ecdh.c -mthumb $ size ecdh.o text data bss dec hex filename 1413 0 0 1413 585 ecdh.o ``` I am using the Free Software Foundation, ARM GCC compiler: $ arm-none-eabi-gcc --version arm-none-eabi-gcc (4.8.4-1+11-1) 4.8.4 20141219 (release) Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. All material in this repository is in the public domain. ### TODO: - Implement ECDSA signing and verifification.
评论
    相关推荐
    • ECC.rar
      基于Openssl的ECC加密程序,实现简短数据加密
    • ECC_TEST.rar
      椭圆曲线(ECC)算法是一种公钥算法,它比流行的RSA算法有很多优点: 1)安全性能更高 , 如160位ECC与1024位RSA、DSA有相同的安全强度。 2)计算量小,处理速度快, 在私钥的处理速度上(解密和签名),ECC比...
    • ECC.zip
      python实现椭圆曲线加密算法,联合开发网还真是挺好的
    • micro-ecc.zip
      A small and fast ECDH and ECDSA implementation for 8-bit, 32-bit, and 64-bit processors.
    • micro-ecc.zip
      ECDH and ECDSA for 8-bit, 32-bit, and 64-bit processors.
    • js4ecdh.rar基于javascript的ecc的会话密钥协商
      代码搬运工: 附件中代码为javascript的ecc算法支持, 会话密钥协商工具类, 在使用过程中椭圆曲线Elliptic Curve parameters需要指定;一般使用 secp256r1
    • micro-ecc-master.zip
      microECC,一个开源的ECC处理库,具有很强的运算速度,在嵌入式领域应用广发。
    • ecc_encode.tar.gz
      依赖openssl库,基于ECDSA公私钥,利用ECDH,HMAC和AES组合加密技术,实现类似的非对称加解密算法
    • SIM800C_MQTT.rar
      使用SIM800C模块,使用MQTT协议,连接中国移动onenet平台,能实现数据的订阅、发布、存储等