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

refactor repo · new ux · prove circuits · new sdk #177

Merged
merged 130 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
6ef165c
add assertion in splitSignalsToWords
remicolin Jul 26, 2024
3d4f30e
fix nullifier generation and implement leaf hasher in register circuits
remicolin Jul 26, 2024
db98b2f
refactor circuit names
remicolin Jul 26, 2024
de8b374
add artifacts
remicolin Jul 26, 2024
7cedeb8
Merge branch 'dev' of https://github.com/zk-passport/openpassport int…
remicolin Aug 17, 2024
03fed2c
rename circuits
remicolin Aug 17, 2024
255b2cc
update build_circuits.sh
remicolin Aug 17, 2024
9fa4196
rename ofac circuits
remicolin Aug 18, 2024
77e3766
yarn format
remicolin Aug 18, 2024
732127f
fix nullifier generation in ecdsa register circuits
remicolin Aug 18, 2024
07cef6b
create app clip
0xturboblitz Aug 18, 2024
3cf1c41
config
0xturboblitz Aug 18, 2024
5c4f5aa
fix settings so that app clip builds
0xturboblitz Aug 19, 2024
5da4f78
refactor verifier repo and rename econtent var
remicolin Aug 19, 2024
2b5724e
refactor disclose circuits
remicolin Aug 19, 2024
9ed878b
delete calidatePassport.circom
remicolin Aug 19, 2024
85cb552
update disclose tests
remicolin Aug 19, 2024
95f1fba
implement prove new circuit
remicolin Aug 19, 2024
38d3acf
yarn format
remicolin Aug 19, 2024
55508ff
fix imports
0xturboblitz Aug 20, 2024
4c18663
fix zkey download
0xturboblitz Aug 20, 2024
c5321cb
cosmetic changes
0xturboblitz Aug 20, 2024
88a419b
factor nullifier out of disclose.circom
0xturboblitz Aug 20, 2024
12c7a85
fix rsapss test I broke
0xturboblitz Aug 20, 2024
fb768b5
remove unused imports from circuits
0xturboblitz Aug 20, 2024
899556f
add README.md back to sdk
0xturboblitz Aug 20, 2024
f26b5a0
refactor ecdsa verifier
remicolin Aug 20, 2024
e9e3c71
Merge branch 'new-ux-refactor-circuits' of https://github.com/zk-pass…
remicolin Aug 20, 2024
854d4c0
rename circuits build scripts
remicolin Aug 20, 2024
76ec891
rename circuit
remicolin Aug 20, 2024
0d4fe36
create build script for prove circuit
remicolin Aug 20, 2024
1556401
clean prove circuits and add rsa sha1
remicolin Aug 20, 2024
e31a958
update n and k
remicolin Aug 20, 2024
d0d95e5
add rsapss
remicolin Aug 20, 2024
29bdbc9
minor cleanups
0xturboblitz Aug 20, 2024
e98937c
clean register ecdsa tests
0xturboblitz Aug 20, 2024
bacdfab
fix ecdsa test
0xturboblitz Aug 20, 2024
2303a20
small cleanups ofac
0xturboblitz Aug 20, 2024
f4d1e73
add scope in public inputs
remicolin Aug 21, 2024
71fcb36
delete and reanme some cert
remicolin Aug 21, 2024
bfe6b08
update sdk
remicolin Aug 21, 2024
5704f75
add test vkey
remicolin Aug 21, 2024
4ac3363
update registry
remicolin Aug 21, 2024
45f45b3
Merge branch 'new-ux-refactor-circuits' of https://github.com/zk-pass…
remicolin Aug 21, 2024
df17b38
update podfile
remicolin Aug 21, 2024
af8051a
update circuit used
remicolin Aug 21, 2024
e0428c1
fix input generation
remicolin Aug 21, 2024
0e6135e
update witness generators with prove circuits
0xturboblitz Aug 22, 2024
59c2840
update scripts
0xturboblitz Aug 22, 2024
c5de31b
hardcode app circuit to prove_rsa_65537_sha256, todo adapt so it supp…
0xturboblitz Aug 22, 2024
79d8f18
add new zkey urls and vkeys
0xturboblitz Aug 22, 2024
2ff419a
make proving work with new circuits
0xturboblitz Aug 22, 2024
c48318c
details: comment a line on UI and CSCA call
0xturboblitz Aug 22, 2024
64cc93d
proving works
0xturboblitz Aug 22, 2024
0983909
update sdk
remicolin Aug 22, 2024
133db8a
update sdk
remicolin Aug 22, 2024
a425805
Merge branch 'new-ux-refactor-circuits' of https://github.com/zk-pass…
remicolin Aug 22, 2024
9c36ef8
fix NFC reading
0xturboblitz Aug 22, 2024
d911f9a
remove unnecessary OpenPassport App Clip-Bridging-Header.h
0xturboblitz Aug 22, 2024
32ca759
Merge branch 'new-ux-refactor-circuits' into app-clip
0xturboblitz Aug 22, 2024
6fc683f
fix proving with new circuits in app clip
0xturboblitz Aug 22, 2024
f52b867
script copies ios witness gen to app clip
0xturboblitz Aug 22, 2024
ef60999
Merge pull request #178 from zk-passport/app-clip
0xturboblitz Aug 22, 2024
ac90783
update app
remicolin Aug 22, 2024
6ef0153
update sdk version
remicolin Aug 22, 2024
7d96dea
Merge branch 'new-ux-refactor-circuits' of https://github.com/zk-pass…
remicolin Aug 22, 2024
517578f
update sdk
remicolin Aug 22, 2024
281dd1d
update app
remicolin Aug 22, 2024
3579d20
making app clip build, icon
0xturboblitz Aug 23, 2024
7f7aa2e
update UI
remicolin Aug 23, 2024
43575de
Merge branch 'new-ux-refactor-circuits' of https://github.com/zk-pass…
remicolin Aug 23, 2024
0e81577
fix typo
0xturboblitz Aug 25, 2024
3bc08ae
bring back next screen and update camera screen ui
remicolin Aug 26, 2024
8f2df21
add mock passport data generator
remicolin Aug 26, 2024
7d8e9d8
fix mock data inputs
remicolin Aug 26, 2024
f71f186
fix dsc of mock passport data
remicolin Aug 26, 2024
de59992
improve padding
remicolin Aug 26, 2024
efca03d
download zkey dynamicly according to dsc cert
remicolin Aug 26, 2024
44f26ab
removing symbolic link to `/common` in sdk
0xturboblitz Aug 27, 2024
359b07f
add sdk tests to github workflow
0xturboblitz Aug 27, 2024
4bf69b1
Revert "add sdk tests to github workflow"
0xturboblitz Aug 27, 2024
44f8834
toast light mode colors
0xturboblitz Aug 27, 2024
a8206de
small cleanups
0xturboblitz Aug 27, 2024
6e903cc
delete useless files
remicolin Aug 27, 2024
3e43cb4
grab vkey according to circuit
remicolin Aug 27, 2024
f36e5bc
remove legacy apps system
0xturboblitz Aug 27, 2024
3154d3e
merge and fix sdk import
remicolin Aug 27, 2024
b7f50df
fix sdk import
remicolin Aug 27, 2024
537f924
Merge branch 'new-ux-refactor-circuits' of https://github.com/zk-pass…
remicolin Aug 27, 2024
256062e
clean camera screen
remicolin Aug 27, 2024
46c44dd
prettierrc
0xturboblitz Aug 27, 2024
89fbcb9
clean nextScreen
remicolin Aug 27, 2024
32209f3
clean nfc screen and carousel
remicolin Aug 27, 2024
c36a691
refactor ProveScreen
remicolin Aug 27, 2024
c7c93d9
clean app, remove Steps
remicolin Aug 27, 2024
0ba5933
refactor app code, dscSecret gen and mockpassport gen
remicolin Aug 27, 2024
290d6bd
update circuits name in isZkeyDownloading
remicolin Aug 27, 2024
e1573a1
delete comments
remicolin Aug 27, 2024
c3fc800
refactor revealBitmap and change genMockPassportData path
remicolin Aug 27, 2024
ce0427a
add download_circuits_from_aws.sh
remicolin Aug 27, 2024
af4fe04
clean and fix sdk
remicolin Aug 27, 2024
e94af7e
fix circuits name
remicolin Aug 27, 2024
e2e5d2b
add rsapss to skiPem mapping
remicolin Aug 27, 2024
65ef044
uncomment buildJson.ts
remicolin Aug 27, 2024
dd5d020
update genMockPassportData signature type
remicolin Aug 27, 2024
66f0858
add scripts and sha1/rsapss to sdk
remicolin Aug 27, 2024
5fc4348
add prettierrc to sdk
remicolin Aug 27, 2024
172db18
update AppTypes
remicolin Aug 27, 2024
70f1a19
import ws server url
remicolin Aug 27, 2024
5a45b93
update new appType in app
remicolin Aug 27, 2024
e709bee
update sdk version
remicolin Aug 27, 2024
e82a8c0
implement getDisclosureOptions method
remicolin Aug 28, 2024
f788ffb
update appscreen
remicolin Aug 28, 2024
867aba6
add mockUser in passportData type
remicolin Aug 28, 2024
423f681
rename ressources
remicolin Aug 28, 2024
e675a91
add toast & update ui
remicolin Aug 28, 2024
d427c68
fix padding
remicolin Aug 28, 2024
ef42d4b
implement loading bar for zkey download
remicolin Aug 28, 2024
16c6add
update sdk
remicolin Aug 28, 2024
06e36ae
update apptype
remicolin Aug 28, 2024
db018be
update sdk readme
remicolin Aug 28, 2024
bc85490
CI/CD pipeline only for push in circuits/common repo
remicolin Aug 28, 2024
985494b
skip ci/cd fro draft pull requests
remicolin Aug 28, 2024
9127e41
delete empty script
0xturboblitz Aug 29, 2024
d47fb63
import same sampleDataHashes everywhere
0xturboblitz Aug 29, 2024
8a813c5
use mock DSC for sha256-ecdsa, pubkey now optional on PassportData
0xturboblitz Aug 29, 2024
db1751b
gather app utils in `/src`
0xturboblitz Aug 29, 2024
61b8a56
update comment
0xturboblitz Aug 29, 2024
2099e21
refactor QR code scanning in app
remicolin Aug 29, 2024
e019d41
add QR code tsx component and websocket interaction in sdk
remicolin Aug 29, 2024
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
7 changes: 7 additions & 0 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,19 @@ on:
branches:
- dev
- main
paths:
- 'circuits/**'
- 'common/**'
pull_request:
branches:
- dev
- main
paths:
- 'circuits/**'
- 'common/**'
jobs:
run_circuit_tests:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
environment: development
steps:
Expand Down
3 changes: 2 additions & 1 deletion app/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSameLine: false,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
bracketSpacing: true,
};
5 changes: 2 additions & 3 deletions app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,17 @@ function App(): JSX.Element {
useEffect(() => {
setToast(toast);
}, [toast, setToast]);

useEffect(() => {
setSelectedTab('splash');
}, [setSelectedTab]);

useEffect(() => {
if (AMPLITUDE_KEY) {
amplitude.init(AMPLITUDE_KEY);
}
//initUserStore();
}, []);

// TODO: when passportData already stored, retrieve and jump to main screen

return (
<YStack f={1} bc={bgWhite} h="100%" w="100%">
<YStack h="100%" w="100%">
Expand Down
24 changes: 19 additions & 5 deletions app/android/app/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,29 @@ link_directories(lib)
add_library(rapidsnark SHARED IMPORTED)
set_target_properties(rapidsnark PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/lib/librapidsnark.so)

# add_library(register_sha256WithRSAEncryption_65537 SHARED IMPORTED)
# set_target_properties(register_sha256WithRSAEncryption_65537 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/lib/libwitnesscalc_register_sha256WithRSAEncryption_65537.so)

add_library(register_sha256WithRSAEncryption_65537 SHARED IMPORTED)
set_target_properties(register_sha256WithRSAEncryption_65537 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/lib/libwitnesscalc_register_sha256WithRSAEncryption_65537.so)
# add_library(disclose SHARED IMPORTED)
# set_target_properties(disclose PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/lib/libwitnesscalc_disclose.so)

add_library(disclose SHARED IMPORTED)
set_target_properties(disclose PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/lib/libwitnesscalc_disclose.so)
add_library(prove_rsa_65537_sha256 SHARED IMPORTED)
set_target_properties(prove_rsa_65537_sha256 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/lib/libwitnesscalc_prove_rsa_65537_sha256.so)

add_library(prove_rsa_65537_sha1 SHARED IMPORTED)
set_target_properties(prove_rsa_65537_sha1 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/lib/libwitnesscalc_prove_rsa_65537_sha1.so)

add_library(prove_rsapss_65537_sha256 SHARED IMPORTED)
set_target_properties(prove_rsapss_65537_sha256 PROPERTIES IMPORTED_LOCATION ${CMAKE_SOURCE_DIR}/lib/libwitnesscalc_prove_rsapss_65537_sha256.so)

add_library(${CMAKE_PROJECT_NAME} SHARED
proofofpassportapp.cpp)

target_link_libraries(${CMAKE_PROJECT_NAME}
rapidsnark register_sha256WithRSAEncryption_65537 disclose)
rapidsnark
# register_sha256WithRSAEncryption_65537
# disclose
prove_rsa_65537_sha256
prove_rsa_65537_sha1
prove_rsapss_65537_sha256
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef WITNESSCALC_prove_rsa_65537_sha1_H
#define WITNESSCALC_prove_rsa_65537_sha1_H


#ifdef __cplusplus
extern "C" {
#endif

#define WITNESSCALC_OK 0x0
#define WITNESSCALC_ERROR 0x1
#define WITNESSCALC_ERROR_SHORT_BUFFER 0x2

/**
*
* @return error code:
* WITNESSCALC_OK - in case of success.
* WITNESSCALC_ERROR - in case of an error.
*
* On success wtns_buffer is filled with witness data and
* wtns_size contains the number bytes copied to wtns_buffer.
*
* If wtns_buffer is too small then the function returns WITNESSCALC_ERROR_SHORT_BUFFER
* and the minimum size for wtns_buffer in wtns_size.
*
*/

int
witnesscalc_prove_rsa_65537_sha1(
const char *circuit_buffer, unsigned long circuit_size,
const char *json_buffer, unsigned long json_size,
char *wtns_buffer, unsigned long *wtns_size,
char *error_msg, unsigned long error_msg_maxsize);

#ifdef __cplusplus
}
#endif


#endif // WITNESSCALC_prove_rsa_65537_sha1_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef WITNESSCALC_prove_rsa_65537_sha256_H
#define WITNESSCALC_prove_rsa_65537_sha256_H


#ifdef __cplusplus
extern "C" {
#endif

#define WITNESSCALC_OK 0x0
#define WITNESSCALC_ERROR 0x1
#define WITNESSCALC_ERROR_SHORT_BUFFER 0x2

/**
*
* @return error code:
* WITNESSCALC_OK - in case of success.
* WITNESSCALC_ERROR - in case of an error.
*
* On success wtns_buffer is filled with witness data and
* wtns_size contains the number bytes copied to wtns_buffer.
*
* If wtns_buffer is too small then the function returns WITNESSCALC_ERROR_SHORT_BUFFER
* and the minimum size for wtns_buffer in wtns_size.
*
*/

int
witnesscalc_prove_rsa_65537_sha256(
const char *circuit_buffer, unsigned long circuit_size,
const char *json_buffer, unsigned long json_size,
char *wtns_buffer, unsigned long *wtns_size,
char *error_msg, unsigned long error_msg_maxsize);

#ifdef __cplusplus
}
#endif


#endif // WITNESSCALC_prove_rsa_65537_sha256_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef WITNESSCALC_prove_rsapss_65537_sha256_H
#define WITNESSCALC_prove_rsapss_65537_sha256_H


#ifdef __cplusplus
extern "C" {
#endif

#define WITNESSCALC_OK 0x0
#define WITNESSCALC_ERROR 0x1
#define WITNESSCALC_ERROR_SHORT_BUFFER 0x2

/**
*
* @return error code:
* WITNESSCALC_OK - in case of success.
* WITNESSCALC_ERROR - in case of an error.
*
* On success wtns_buffer is filled with witness data and
* wtns_size contains the number bytes copied to wtns_buffer.
*
* If wtns_buffer is too small then the function returns WITNESSCALC_ERROR_SHORT_BUFFER
* and the minimum size for wtns_buffer in wtns_size.
*
*/

int
witnesscalc_prove_rsapss_65537_sha256(
const char *circuit_buffer, unsigned long circuit_size,
const char *json_buffer, unsigned long json_size,
char *wtns_buffer, unsigned long *wtns_size,
char *error_msg, unsigned long error_msg_maxsize);

#ifdef __cplusplus
}
#endif


#endif // WITNESSCALC_prove_rsapss_65537_sha256_H
Binary file not shown.
Binary file not shown.
Binary file not shown.
126 changes: 120 additions & 6 deletions app/android/app/src/main/cpp/proofofpassportapp.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
#include "include/prover.h"
#include "include/witnesscalc_register_sha256WithRSAEncryption_65537.h"
#include "include/witnesscalc_disclose.h"
// #include "include/witnesscalc_register_sha256WithRSAEncryption_65537.h"
// #include "include/witnesscalc_disclose.h"
#include "include/witnesscalc_prove_rsa_65537_sha256.h"
#include "include/witnesscalc_prove_rsa_65537_sha1.h"
#include "include/witnesscalc_prove_rsapss_65537_sha256.h"

#include <jni.h>
#include <iostream>
Expand Down Expand Up @@ -47,9 +50,120 @@ Java_com_proofofpassportapp_prover_ZKPTools_groth16_1prover(JNIEnv *env, jobject
return result;
}

// extern "C"
// JNIEXPORT jint JNICALL
// Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1register_1sha256WithRSAEncryption_165537(JNIEnv *env, jobject thiz,
// jbyteArray circuit_buffer,
// jlong circuit_size, jbyteArray json_buffer,
// jlong json_size, jbyteArray wtns_buffer,
// jlongArray wtns_size, jbyteArray error_msg,
// jlong error_msg_max_size) {
// const char *circuitBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(
// circuit_buffer, nullptr));
// const char *jsonBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(json_buffer,
// nullptr));
// char *wtnsBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(wtns_buffer, nullptr));
// char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));

// unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];


// int result = witnesscalc_register_sha256WithRSAEncryption_65537(
// circuitBuffer, static_cast<unsigned long>(circuit_size),
// jsonBuffer, static_cast<unsigned long>(json_size),
// wtnsBuffer, &wtnsSize,
// errorMsg, static_cast<unsigned long>(error_msg_max_size));

// // Set the result and release the resources
// env->SetLongArrayRegion(wtns_size, 0, 1, reinterpret_cast<jlong *>(&wtnsSize));

// env->ReleaseByteArrayElements(circuit_buffer,
// reinterpret_cast<jbyte *>(const_cast<char *>(circuitBuffer)), 0);
// env->ReleaseByteArrayElements(json_buffer,
// reinterpret_cast<jbyte *>(const_cast<char *>(jsonBuffer)), 0);
// env->ReleaseByteArrayElements(wtns_buffer, reinterpret_cast<jbyte *>(wtnsBuffer), 0);
// env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);

// return result;
// }

// extern "C"
// JNIEXPORT jint JNICALL
// Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1disclose(JNIEnv *env, jobject thiz,
// jbyteArray circuit_buffer,
// jlong circuit_size, jbyteArray json_buffer,
// jlong json_size, jbyteArray wtns_buffer,
// jlongArray wtns_size, jbyteArray error_msg,
// jlong error_msg_max_size) {
// const char *circuitBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(
// circuit_buffer, nullptr));
// const char *jsonBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(json_buffer,
// nullptr));
// char *wtnsBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(wtns_buffer, nullptr));
// char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));

// unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];


// int result = witnesscalc_disclose(
// circuitBuffer, static_cast<unsigned long>(circuit_size),
// jsonBuffer, static_cast<unsigned long>(json_size),
// wtnsBuffer, &wtnsSize,
// errorMsg, static_cast<unsigned long>(error_msg_max_size));

// // Set the result and release the resources
// env->SetLongArrayRegion(wtns_size, 0, 1, reinterpret_cast<jlong *>(&wtnsSize));

// env->ReleaseByteArrayElements(circuit_buffer,
// reinterpret_cast<jbyte *>(const_cast<char *>(circuitBuffer)), 0);
// env->ReleaseByteArrayElements(json_buffer,
// reinterpret_cast<jbyte *>(const_cast<char *>(jsonBuffer)), 0);
// env->ReleaseByteArrayElements(wtns_buffer, reinterpret_cast<jbyte *>(wtnsBuffer), 0);
// env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);

// return result;
// }

extern "C"
JNIEXPORT jint JNICALL
Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1prove_1rsa_165537_1sha256(JNIEnv *env, jobject thiz,
jbyteArray circuit_buffer,
jlong circuit_size, jbyteArray json_buffer,
jlong json_size, jbyteArray wtns_buffer,
jlongArray wtns_size, jbyteArray error_msg,
jlong error_msg_max_size) {
const char *circuitBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(
circuit_buffer, nullptr));
const char *jsonBuffer = reinterpret_cast<const char *>(env->GetByteArrayElements(json_buffer,
nullptr));
char *wtnsBuffer = reinterpret_cast<char *>(env->GetByteArrayElements(wtns_buffer, nullptr));
char *errorMsg = reinterpret_cast<char *>(env->GetByteArrayElements(error_msg, nullptr));

unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];


int result = witnesscalc_prove_rsa_65537_sha256(
circuitBuffer, static_cast<unsigned long>(circuit_size),
jsonBuffer, static_cast<unsigned long>(json_size),
wtnsBuffer, &wtnsSize,
errorMsg, static_cast<unsigned long>(error_msg_max_size));

// Set the result and release the resources
env->SetLongArrayRegion(wtns_size, 0, 1, reinterpret_cast<jlong *>(&wtnsSize));

env->ReleaseByteArrayElements(circuit_buffer,
reinterpret_cast<jbyte *>(const_cast<char *>(circuitBuffer)), 0);
env->ReleaseByteArrayElements(json_buffer,
reinterpret_cast<jbyte *>(const_cast<char *>(jsonBuffer)), 0);
env->ReleaseByteArrayElements(wtns_buffer, reinterpret_cast<jbyte *>(wtnsBuffer), 0);
env->ReleaseByteArrayElements(error_msg, reinterpret_cast<jbyte *>(errorMsg), 0);

return result;
}

extern "C"
JNIEXPORT jint JNICALL
Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1register_1sha256WithRSAEncryption_165537(JNIEnv *env, jobject thiz,
Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1prove_1rsa_165537_1sha1(JNIEnv *env, jobject thiz,
jbyteArray circuit_buffer,
jlong circuit_size, jbyteArray json_buffer,
jlong json_size, jbyteArray wtns_buffer,
Expand All @@ -65,7 +179,7 @@ Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1register_1sha256WithRSA
unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];


int result = witnesscalc_register_sha256WithRSAEncryption_65537(
int result = witnesscalc_prove_rsa_65537_sha1(
circuitBuffer, static_cast<unsigned long>(circuit_size),
jsonBuffer, static_cast<unsigned long>(json_size),
wtnsBuffer, &wtnsSize,
Expand All @@ -86,7 +200,7 @@ Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1register_1sha256WithRSA

extern "C"
JNIEXPORT jint JNICALL
Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1disclose(JNIEnv *env, jobject thiz,
Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1prove_1rsapss_165537_1sha256(JNIEnv *env, jobject thiz,
jbyteArray circuit_buffer,
jlong circuit_size, jbyteArray json_buffer,
jlong json_size, jbyteArray wtns_buffer,
Expand All @@ -102,7 +216,7 @@ Java_com_proofofpassportapp_prover_ZKPTools_witnesscalc_1disclose(JNIEnv *env, j
unsigned long wtnsSize = env->GetLongArrayElements(wtns_size, nullptr)[0];


int result = witnesscalc_disclose(
int result = witnesscalc_prove_rsapss_65537_sha256(
circuitBuffer, static_cast<unsigned long>(circuit_size),
jsonBuffer, static_cast<unsigned long>(json_size),
wtnsBuffer, &wtnsSize,
Expand Down
Loading
Loading