Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: skip git certification required #38

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions deps/gtest/download_gtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ GTEST_VERSION=googletest-release-${VERSION}.zip
GTEST_LINK=https://github.com/google/googletest/archive/release-${VERSION}.zip

if [[ ! -f ${GTEST_VERSION} ]]; then
wget -O ${GTEST_VERSION} ${GTEST_LINK}
fi
wget -O ${GTEST_VERSION} ${GTEST_LINK} --no-check-certificate
fi
24 changes: 14 additions & 10 deletions examples/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,29 @@ CXXFLAGS := $(CXX11FLAGS)$(OS_CXXFLAGS) -pthread -Wall -g -O2 -DSSL_LIB_INIT -I$
LDFLAGS := -L${ZROOT}/deps/root/lib -L${ZROOT}/root/lib
LIBS := -lcrypto -lrelic -lrelic_ec -lopenabe

all: test_kp test_cp test_pk test_km
all: test_kp test_cp test_pk test_km test_1

test_1: test_1.o
$(CXX) -o test_1 $(CXXFLAGS) $(LDFLAGS) test_1.cpp $(LIBS)

test_kp: test_kp.o
$(CXX) -o test_kp $(CXXFLAGS) $(LDFLAGS) test_kp.cpp $(LIBS)
$(CXX) -o test_kp $(CXXFLAGS) $(LDFLAGS) test_kp.cpp $(LIBS)

test_cp: test_cp.o
$(CXX) -o test_cp $(CXXFLAGS) $(LDFLAGS) test_cp.cpp $(LIBS)
$(CXX) -o test_cp $(CXXFLAGS) $(LDFLAGS) test_cp.cpp $(LIBS)

test_pk: test_pk.o
$(CXX) -o test_pk $(CXXFLAGS) $(LDFLAGS) test_pk.cpp $(LIBS)
$(CXX) -o test_pk $(CXXFLAGS) $(LDFLAGS) test_pk.cpp $(LIBS)

test_km: test_km.o
$(CXX) -o test_km $(CXXFLAGS) $(LDFLAGS) test_km.cpp $(LIBS)
$(CXX) -o test_km $(CXXFLAGS) $(LDFLAGS) test_km.cpp $(LIBS)

test:
./test_kp
./test_cp
./test_pk
./test_km
./test_kp
./test_cp
./test_pk
./test_km
./test_1

clean:
rm -rf *.o *.dSYM test_kp test_cp test_pk test_km
rm -rf *.o *.dSYM test_kp test_cp test_pk test_km test_1
49 changes: 49 additions & 0 deletions examples/test_1.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include <iostream>
#include <string>
#include <cassert>
#include <openabe/openabe.h>
#include <openabe/zsymcrypto.h>

using namespace std;
using namespace oabe;
using namespace oabe::crypto;

int main(int argc, char **argv) {
InitializeOpenABE();
cout << "Testing CP-ABE context" << endl;

OpenABECryptoContext cpabe("CP-ABE");
int pid1TEMP=40 ;
// double pid2TEMP=30 ;
int pid1GLUCUSE=100;
// double paid2GLUCUSE=300;
int pid1HR=77;
// double pid2HR=66;
string ct, pt1 = std::to_string(pid1TEMP & pid1GLUCUSE & pid1HR);
string pt2;

cpabe.generateParams();

cpabe.keygen("|doctor|family", "key0");

cpabe.encrypt("doctor and family", pt1, ct);

bool result = cpabe.decrypt("key0", ct, pt2);

assert(result && pt1 == pt2);

cout << "Recovered message: " << pt2 << endl;

ShutdownOpenABE();
if(pid1TEMP >37.5){
cout << "patined with id1 has a high temrature"<< endl;
}
if(pid1GLUCUSE >200){
cout << "patined with id1 has a high galcuse level"<< endl;
}
if(pid1HR >100 or pid1HR <60){
cout << "patined with id1 has a dangerus heart rate"<< endl;
}

return 0;
}
2 changes: 1 addition & 1 deletion src/zparser.yy
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
%name-prefix "oabe"

/* set the parser's class identifier */
%define api.parser.class {Parser}
%define parser_class_name {Parser}

/* keep track of the current position within the input */
%locations
Expand Down