# OpenSSE's Cryptographic Toolkit
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL%20v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)
[![build status](https://badges.herokuapp.com/travis/OpenSSE/crypto-tk?branch=master&label=gcc%20build&env=COMPILER=gcc)](https://travis-ci.org/OpenSSE/crypto-tk)
[![build status](https://badges.herokuapp.com/travis/OpenSSE/crypto-tk?branch=master&label=clang%20build&env=COMPILER=clang)](https://travis-ci.org/OpenSSE/crypto-tk)
[![static analysis](https://badges.herokuapp.com/travis/OpenSSE/crypto-tk?branch=master&label=static%20analysis&env=STATIC_ANALYSIS=true)](https://travis-ci.org/OpenSSE/crypto-tk)
[![Coverity](https://img.shields.io/coverity/scan/17513.svg)](https://scan.coverity.com/projects/opensse-crypto-tk)
[![Coverage Status](https://coveralls.io/repos/github/OpenSSE/crypto-tk/badge.svg)](https://coveralls.io/github/OpenSSE/crypto-tk)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/1412/badge)](https://bestpractices.coreinfrastructure.org/projects/1412)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5149d1eb77224a6e981d1b2f46bfb012)](https://www.codacy.com/app/rbost/crypto-tk?utm_source=github.com&utm_medium=referral&utm_content=OpenSSE/crypto-tk&utm_campaign=Badge_Grade)
[![CodeFactor](https://www.codefactor.io/repository/github/opensse/crypto-tk/badge)](https://www.codefactor.io/repository/github/opensse/crypto-tk)
The searchable encryption protocols rely on high level cryptographic features such as pseudo-random functions, hash functions, encryption schemes, or incremental set hashing. The cryptographic layer provides interfaces and implementations of these features.
## Why a new crypto library
A lot of great crypto libraries exist out there (_e.g._ [libsodium](https://github.com/jedisct1/libsodium)). Unfortunately, they do not offer the level of abstraction needed to implement searchable encryption schemes easily. Indeed, cryptographic objects such as pseudo-random functions, trapdoor permutations, pseudo-random generators, _etc_, are building blocks of such constructions, and OpenSSL or libsodium do not offer interfaces to such objects.
This library provides these APIs so that the SSE implementer has consistent high-level crypto interfaces and does not have to care about the inner implementation of the blocks.
## Disclaimer
This is code for a **research project**. It **should not be used in practice**: the code lacks good C/C++ security practice, and it has never been externally reviewed.
## Getting the Code
You can get the code by cloning the code repository from GitHub. When you do so, be sure to also pull the submodules, or otherwise, nothing will compile:
```sh
git clone https://github.com/OpenSSE/crypto-tk.git
cd crypto-tk
git submodule update --init --recursive
```
## Building
Building is done using CMake. The minimum required version is CMake 3.1.
### Dependencies
`libsse_crypto` uses the following dependencies
- [libsodium](https://download.libsodium.org/doc/). libsodium version >=1.0.16 is necessary.
- [RELIC](https://github.com/relic-toolkit/relic) Some features (puncturable encryption) are based on cryptographic pairings. These are implemented using the RELIC toolkit. RELIC has many compilation options. The current code has been tested against RELIC v0.5.0. To install RELIC in that version, you can do the following:
```sh
git clone -b relic-toolkit-0.5.0 https://github.com/relic-toolkit/relic.git
cd relic
mkdir build; cd build
cmake -G "Unix Makefiles" -DMULTI=PTHREAD -DCOMP="-O3 -funroll-loops -fomit-frame-pointer -finline-small-functions -march=native -mtune=native" -DARCH="X64" -DRAND="UDEV" -DWITH="BN;DV;FP;FPX;EP;EPX;PP;PC;MD" -DCHECK=off -DVERBS=off -DDEBUG=off -DBENCH=0 -DTESTS=1 -DARITH=gmp -DFP_PRIME=254 -DFP_QNRES=off -DFP_METHD="INTEG;INTEG;INTEG;MONTY;LOWER;SLIDE" -DFPX_METHD="INTEG;INTEG;LAZYR" -DPP_METHD="LAZYR;OATEP" -DBN_PRECI=256 -DFP_QNRES=on ../.
make
make install
```
You can also replace the `-DARITH=gmp` option by `-DARITH=x64-asm-254` (for better performance) or `-DARITH=easy` (to get rid of the gmp dependency). Note that the first two depend on [gmp](https://gmplib.org).
#### Optional Dependencies
- [OpenSSL](https://www.openssl.org)'s cryptographic library (`libcrypto`). The trapdoor permutation is based on RSA, and `libsse_crypto` can use OpenSSL to implement RSA. The code has been compiled and tested using OpenSSL 1.0.2. Note that this part of the code is now deprecated and is incompatible with OpenSSL 1.1.0 APIs.
### Compiler
`libsse_crypto` needs a compiler supporting C++11.
You can easily check that `libsse_crypto` is successfully built on Ubuntu 14 LTS with gcc 4.8 using Travis.
It has also been successfully built and tested on Ubuntu 16 LTS using both clang (versions 3.8, 4.0 and 5.0) and gcc (versions 4.8, 4.9 and 5.0) and on Mac OS X.12 using clang 9.0.0.
### Setting up your system
Here is what is necessary to set your system up from scratch, and build `libsse_crypto` (you will need to build RELIC first though).
#### Ubuntu 14.04 LTS
```sh
[sudo] add-apt-repository ppa:ubuntu-toolchain-r/test
[sudo] apt-get update
[sudo] apt-get install build-essential cmake3 libtool libssl-dev libgmp-dev
```
To install the three dependencies, you can either follow the instructions of their website (in particular for libsodium), or use the embedded install scripts. These might have to be modified to fit your needs (e.g. if you do not want to install RELIC system-wide, or if you are not a sudoer).
To do so, move to directory `install_dependencies`, and run `./install_sodium.sh` to download and install libsodium 1.0.16 and `./install_relic_easy.sh` to install RELIC with the `easy` arithmetic.
If you want to use the gmp arithmetic or the x64 assembly arithmetic, run respectively `./install_relic_gmp.sh` and `./install_relic_asm.sh`.
#### Ubuntu 16.04 LTS
```sh
[sudo] apt-get update
[sudo] apt-get install build-essential cmake libtool libssl-dev libgmp-dev
```
You can then install libsodium as for Ubuntu 14.
For RELIC, use one of the scripts `install_relic_easy.sh`, `install_relic_gmp.sh`, or `install_relic_x64_asm.sh` depending on the arithmetic you prefer.
#### Mac OS
```sh
[sudo] xcode-select --install
```
If you still haven't, you should get [Homebrew](https://brew.sh/).
You will actually need it to install dependencies:
```sh
brew install cmake openssl gmp libsodium
```
You will only need to install RELIC, which can be done following the instructions found above, or use one of the scripts `install_relic_easy.sh`, `install_relic_gmp.sh`, or `install_relic_x64_asm.sh` depending on the arithmetic you prefer.
### Basic build
To build all of the targets with the default configuration in the `build` directory, run the following commands:
```sh
mkdir build && cd build
cmake ..
make
```
### Targets
The following targets can be built:
- `debug_crypto`: the executable constructed from the `main.cpp` file. It must be used as a debugging tool (to develop new features).
- `check`: unit tests. It uses [Google Test](https://github.com/google/googletest).
- `test`: runs the unit tests produced by the previous target.
- `sse_crypto`: the compiled library.
To only build the library, call `make sse_crypto` instead of just `make`.
### Build Configuration and Options
As the library builds using CMake, the configuration is highly configurable.
Like other CMake-based projects, options are set by passing `-DOPTION_NAME=value` to the `cmake` command.
For example, for a debug build, use `-DCMAKE_BUILD_TYPE=Debug`.
Also, you can change the compiler used for the project by setting the `CC` and `CXX` environment variables.
For example, if you wish to use Clang, you can set the project up with the following command
`CC=clang CXX=clang++ cmake ..`.
#### Options
This project's CMake takes the following options:
- `ENABLE_COVERAGE=On|Off`: Respectively enables and disable th
没有合适的资源?快使用搜索试试~ 我知道了~
用于可搜索加密的加密工具包。.zip
共123个文件
cpp:40个
hpp:21个
h:16个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 9 浏览量
2023-03-28
13:22:39
上传
评论
收藏 334KB ZIP 举报
温馨提示
用于可搜索加密的加密工具包。.zip
资源推荐
资源详情
资源评论
收起资源包目录
用于可搜索加密的加密工具包。.zip (123个子文件)
bignum.c 56KB
aez.c 30KB
rsa.c 19KB
pkparse.c 15KB
asn1write.c 11KB
asn1parse.c 9KB
base64.c 8KB
rsa_io.c 8KB
pem.c 5KB
pk.c 3KB
pk_wrap.c 3KB
StandaloneFuzzTargetMain.c 2KB
.clang-format 3KB
.clang-tidy 2KB
FindSodium.cmake 10KB
FindLibGmp.cmake 2KB
test_mbedtls.cpp 32KB
test_tdp.cpp 30KB
main.cpp 27KB
tdp_impl_mbedtls.cpp 27KB
relic_api.cpp 20KB
test_ppke.cpp 20KB
test_rcprf.cpp 20KB
tdp_impl_openssl.cpp 20KB
GMPpke.cpp 14KB
test_prg.cpp 12KB
tdp.cpp 11KB
hashing.cpp 10KB
prp.cpp 9KB
cipher.cpp 7KB
prg.cpp 7KB
utils.cpp 7KB
bench_tdp.cpp 6KB
test_hmac.cpp 6KB
test_prf.cpp 5KB
test_prp.cpp 5KB
test_set_hash.cpp 5KB
puncturable_enc.cpp 5KB
set_hash.cpp 4KB
encryption.cpp 4KB
bench_rcprf.cpp 4KB
hash.cpp 3KB
bench_set_hash.cpp 3KB
test_utility.cpp 3KB
strstrn.cpp 2KB
prf.cpp 2KB
wrapper.cpp 2KB
rcprf.cpp 1KB
checks.cpp 1KB
blake2b.cpp 1KB
sha512.cpp 1KB
benchmarks.cpp 1KB
hmac.cpp 1KB
random.cpp 1KB
key.cpp 860B
util.cpp 20B
.gitignore 550B
.gitignore 33B
.gitmodules 497B
blake2_kat.h 156KB
bn_mul.h 34KB
check_config.h 26KB
bignum.h 26KB
relic_api.h 19KB
config.h 19KB
asn1.h 11KB
pk.h 9KB
asn1write.h 9KB
rsa.h 9KB
pem.h 5KB
rsa_io.h 4KB
base64.h 3KB
common.h 2KB
pk_internal.h 2KB
aez.h 1KB
rcprf.hpp 76KB
tdp.hpp 32KB
prg.hpp 20KB
wrapper.hpp 14KB
GMPpke.hpp 13KB
prf.hpp 11KB
key.hpp 11KB
prp.hpp 9KB
puncturable_enc.hpp 8KB
cipher.hpp 8KB
hmac.hpp 8KB
set_hash.hpp 6KB
hash.hpp 5KB
tdp_impl_mbedtls.hpp 5KB
tdp_impl_openssl.hpp 5KB
tdp_impl.hpp 4KB
random.hpp 3KB
util.hpp 2KB
utils.hpp 1KB
blake2b.hpp 1KB
sha512.hpp 1KB
Doxyfile.in 105KB
OpenSSECryptConfig.cmake.in 294B
settings.json 1KB
launch.json 752B
共 123 条
- 1
- 2
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功