Skip to content

Commit

Permalink
proxy reencryption with cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
geghamjivanyan committed Feb 5, 2024
1 parent 17d28e2 commit 2c6c86a
Show file tree
Hide file tree
Showing 1,255 changed files with 336,862 additions and 1 deletion.
71 changes: 71 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
cmake_minimum_required(VERSION 3.1)
project(ProxyLib)
include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)

set(MBED_TLS_VERSION 2.7.5)

ExternalProject_Add(mbed_tls
URL https://github.com/ARMmbed/mbedtls/archive/mbedtls-${MBED_TLS_VERSION}.tar.gz
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/mbed_tls
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/mbed_tls/build
CMAKE_CACHE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=true
)
ExternalProject_Get_Property(mbed_tls install_dir)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include_directories(src src/include ${install_dir}/build/include include ${gtest_SOURCE_DIR}/include ${gtest_SOURCE_DIR})

set(PROXYLIB_SOURCES
src/Context.cpp
src/BigNumber.cpp
src/ErrorWrapper.cpp
src/Point.cpp
src/helpers.cpp
src/Proxy_C.cpp)

set(PROJECT_TESTS ${PROJECT_NAME}_tests)
add_library(${PROJECT_NAME} ${PROXYLIB_SOURCES})
target_link_libraries(${PROJECT_NAME})
add_dependencies(${PROJECT_NAME} mbed_tls)

add_custom_target(lib ALL
COMMAND ar -x ${install_dir}/build/lib/libmbedcrypto.a
COMMAND ar -x $<TARGET_FILE:${PROJECT_NAME}>
COMMAND ar -qc $<TARGET_FILE:${PROJECT_NAME}> *.o
COMMAND rm -f *.o
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
DEPENDS mbed_tls ${PROJECT_NAME}
)

enable_testing()
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -j4)

add_executable(big_number_test
src/tests/big_number_test.cpp
src/tests/test_main.cpp
)

# Standard linking to gtest stuff.
target_link_libraries(big_number_test gtest gtest_main ${PROJECT_NAME} pthread)

add_test(big_number_test big_number_test)

add_executable(re_encryption_test
src/tests/re_encryption_test.cpp
src/tests/test_main.cpp
)

# Standard linking to gtest stuff.
target_link_libraries(re_encryption_test gtest gtest_main ${PROJECT_NAME} pthread)

add_test(c_interface_test c_interface_test)

add_executable(c_interface_test
src/tests/c_interface_test.cpp
src/tests/test_main.cpp
)

# Standard linking to gtest stuff.
target_link_libraries(c_interface_test gtest gtest_main ${PROJECT_NAME} pthread)

35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
# Proxy-ReEncryption-JSProxy-ReEncryption-CPP
# KMSChain for C++

We provide "Encryption & Key Management" service in operation with open sourced libraries with support for Javascript, Python, Go, Rust, Java, C++ languages.

Our goal is to enable developers to build ’privacy by design’, end-to-end secured applications, without any technical complexities.

This C++ library is our main low level algorithmic implementation, which is embedded in all our other SDK libraries and web services.

# C Interface
Most of the programming languages and low level API's don't have C++ integration capability, so for being platform and programing
language agnostic, we are providing low level C interface for using KMSChain's encryption on any platform and with any programming language.

[`inculde/CryptoMagic_C.h`](inculde/CryptoMagic_C.h) is a single header file which contains all our API functions for having fully functional
proxy re-encryption and key management system for your application.

```cpp
#include "CryptoMagic_C.h"
....
....
cryptomagic_init();
void * cm = cryptomagic_new();
.....
.....
cryptomagic_clean(cm);
```
As a low level interface, we are providing memory allocation and de-allocation functions for each object.
# Building
For building project as a static library, you will need to `install OpenSSL`, because currently we are using OpenSSL as a cryptographic backend.
```bash
mkdir build
cd build && cmake ..
make
```
Binary file added build/big_number_test
Binary file not shown.
Binary file added build/c_interface_test
Binary file not shown.
Binary file added build/mbed_tls/build/bin/aescrypt2
Binary file not shown.
Binary file added build/mbed_tls/build/bin/benchmark
Binary file not shown.
Binary file added build/mbed_tls/build/bin/cert_app
Binary file not shown.
Binary file added build/mbed_tls/build/bin/cert_req
Binary file not shown.
Binary file added build/mbed_tls/build/bin/cert_write
Binary file not shown.
Binary file added build/mbed_tls/build/bin/crl_app
Binary file not shown.
Binary file added build/mbed_tls/build/bin/crypt_and_hash
Binary file not shown.
Binary file added build/mbed_tls/build/bin/dh_client
Binary file not shown.
Binary file added build/mbed_tls/build/bin/dh_genprime
Binary file not shown.
Binary file added build/mbed_tls/build/bin/dh_server
Binary file not shown.
Binary file added build/mbed_tls/build/bin/dtls_client
Binary file not shown.
Binary file added build/mbed_tls/build/bin/dtls_server
Binary file not shown.
Binary file added build/mbed_tls/build/bin/gen_entropy
Binary file not shown.
Binary file added build/mbed_tls/build/bin/gen_key
Binary file not shown.
Binary file added build/mbed_tls/build/bin/gen_random_ctr_drbg
Binary file not shown.
Binary file added build/mbed_tls/build/bin/gen_random_havege
Binary file not shown.
Binary file added build/mbed_tls/build/bin/generic_sum
Binary file not shown.
Binary file added build/mbed_tls/build/bin/hello
Binary file not shown.
Binary file added build/mbed_tls/build/bin/key_app
Binary file not shown.
Binary file added build/mbed_tls/build/bin/mini_client
Binary file not shown.
Binary file added build/mbed_tls/build/bin/mpi_demo
Binary file not shown.
Binary file added build/mbed_tls/build/bin/pem2der
Binary file not shown.
Binary file added build/mbed_tls/build/bin/pk_decrypt
Binary file not shown.
Binary file added build/mbed_tls/build/bin/pk_encrypt
Binary file not shown.
Binary file added build/mbed_tls/build/bin/pk_sign
Binary file not shown.
Binary file added build/mbed_tls/build/bin/pk_verify
Binary file not shown.
Binary file added build/mbed_tls/build/bin/req_app
Binary file not shown.
Binary file added build/mbed_tls/build/bin/rsa_decrypt
Binary file not shown.
Binary file added build/mbed_tls/build/bin/rsa_encrypt
Binary file not shown.
Binary file added build/mbed_tls/build/bin/rsa_genkey
Binary file not shown.
Binary file added build/mbed_tls/build/bin/rsa_sign
Binary file not shown.
Binary file added build/mbed_tls/build/bin/rsa_verify
Binary file not shown.
Binary file added build/mbed_tls/build/bin/selftest
Binary file not shown.
Binary file added build/mbed_tls/build/bin/ssl_cert_test
Binary file not shown.
Binary file added build/mbed_tls/build/bin/ssl_client1
Binary file not shown.
Binary file added build/mbed_tls/build/bin/ssl_client2
Binary file not shown.
Binary file added build/mbed_tls/build/bin/ssl_fork_server
Binary file not shown.
Binary file added build/mbed_tls/build/bin/ssl_mail_client
Binary file not shown.
Binary file added build/mbed_tls/build/bin/ssl_pthread_server
Binary file not shown.
Binary file added build/mbed_tls/build/bin/ssl_server
Binary file not shown.
Binary file added build/mbed_tls/build/bin/strerror
Binary file not shown.
Binary file added build/mbed_tls/build/bin/udp_proxy
Binary file not shown.
Loading

0 comments on commit 2c6c86a

Please sign in to comment.