├── .gitignore
├── LICENSE
├── README.md
├── demo
├── app
│ ├── .gitignore
│ ├── build.gradle
│ ├── proguard-rules.pro
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── java
│ │ └── com
│ │ │ └── webank
│ │ │ ├── wedpr
│ │ │ ├── common
│ │ │ │ ├── Utils.java
│ │ │ │ ├── WedprException.java
│ │ │ │ └── WedprResult.java
│ │ │ ├── crypto
│ │ │ │ ├── CryptoClient.java
│ │ │ │ ├── CryptoResult.java
│ │ │ │ └── NativeInterface.java
│ │ │ ├── ktb
│ │ │ │ └── hdk
│ │ │ │ │ ├── HdkClient.java
│ │ │ │ │ ├── HdkResult.java
│ │ │ │ │ └── NativeInterface.java
│ │ │ ├── scd
│ │ │ │ ├── IssuerClient.java
│ │ │ │ ├── IssuerResult.java
│ │ │ │ ├── NativeInterface.java
│ │ │ │ ├── PredicateType.java
│ │ │ │ ├── ScdClient.java
│ │ │ │ ├── UserClient.java
│ │ │ │ ├── UserResult.java
│ │ │ │ ├── VerifierClient.java
│ │ │ │ ├── VerifierResult.java
│ │ │ │ └── proto
│ │ │ │ │ ├── AttributeDict.java
│ │ │ │ │ ├── AttributeDictOrBuilder.java
│ │ │ │ │ ├── BlindedCertificateSecret.java
│ │ │ │ │ ├── BlindedCertificateSecretOrBuilder.java
│ │ │ │ │ ├── CertificateSchema.java
│ │ │ │ │ ├── CertificateSchemaOrBuilder.java
│ │ │ │ │ ├── CertificateSignature.java
│ │ │ │ │ ├── CertificateSignatureOrBuilder.java
│ │ │ │ │ ├── CertificateTemplate.java
│ │ │ │ │ ├── CertificateTemplateOrBuilder.java
│ │ │ │ │ ├── Predicate.java
│ │ │ │ │ ├── PredicateOrBuilder.java
│ │ │ │ │ ├── Scd.java
│ │ │ │ │ ├── ScdResult.java
│ │ │ │ │ ├── ScdResultOrBuilder.java
│ │ │ │ │ ├── SignCertificateRequest.java
│ │ │ │ │ ├── SignCertificateRequestOrBuilder.java
│ │ │ │ │ ├── StringToStringPair.java
│ │ │ │ │ ├── StringToStringPairOrBuilder.java
│ │ │ │ │ ├── TemplatePrivateKey.java
│ │ │ │ │ ├── TemplatePrivateKeyOrBuilder.java
│ │ │ │ │ ├── TemplatePublicKey.java
│ │ │ │ │ ├── TemplatePublicKeyOrBuilder.java
│ │ │ │ │ ├── VerificationRuleSet.java
│ │ │ │ │ ├── VerificationRuleSetOrBuilder.java
│ │ │ │ │ ├── VerifyRequest.java
│ │ │ │ │ └── VerifyRequestOrBuilder.java
│ │ │ └── vcl
│ │ │ │ ├── NativeInterface.java
│ │ │ │ ├── VclClient.java
│ │ │ │ └── VclResult.java
│ │ │ └── wedprdemo
│ │ │ └── MainActivity.java
│ │ ├── jniLibs
│ │ ├── arm64-v8a
│ │ │ └── .blank_file
│ │ └── armeabi-v7a
│ │ │ └── .blank_file
│ │ └── res
│ │ ├── drawable-v24
│ │ └── ic_launcher_foreground.xml
│ │ ├── drawable
│ │ └── ic_launcher_background.xml
│ │ ├── layout
│ │ └── activity_main.xml
│ │ ├── mipmap-anydpi-v26
│ │ ├── ic_launcher.xml
│ │ └── ic_launcher_round.xml
│ │ ├── mipmap-hdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-mdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ ├── mipmap-xxxhdpi
│ │ ├── ic_launcher.png
│ │ └── ic_launcher_round.png
│ │ └── values
│ │ ├── colors.xml
│ │ ├── strings.xml
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ ├── gradle-wrapper.jar
│ │ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
└── settings.gradle
├── release_note.txt
└── sdk
└── extract-lib-subproject-to-here.txt
/.gitignore:
--------------------------------------------------------------------------------
1 | */.DS_Store
2 | **/.vscode/
3 | **/.idea/*
4 | *.lock
5 | *.a
6 | *.tar.gz
7 | *.docx
8 | .DS_Store
9 | **/target
10 | *.so
11 | build
12 | .gradle
13 | local.properties
14 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WeDPR-Lab-Android-SDK
2 |
3 | ## 如何体验WeDPR-Lab-Android-SDK
4 |
5 | WeDPR-Lab-Android-SDK是WeDPR-Lab的Android客户端。
6 |
7 | ## 环境依赖
8 |
9 | WeDPR Lab Android SDK 依赖如下:
10 |
11 | | 依赖软件 | 支持版本 |
12 | | :-: | :-: |
13 | | JAVA | JDK1.8+ |
14 | | Android Studio | 4.1+ |
15 |
16 | ## 快速体验
17 |
18 | 编译项目前,需要准备好`Android Studio、并安装NDK`。
19 |
20 | - 下载仓库
21 |
22 | ```bash
23 | git clone https://github.com/WeBankBlockchain/WeDPR-Lab-Android-SDK.git && cd ./WeDPR-Lab-Android-SDK
24 | ```
25 |
26 | - 获取动态库库:根据需求访问[依赖库地址](https://github.com/WeBankBlockchain/WeDPR-Lab-Core/releases/tag/v1.1.0)页面下载android_sdk_dynamic_lib_arm64_v8a.tar.gz 或 android_sdk_dynamic_lib_armeabi_v7a.tar.gz
27 |
28 | - 解压:tar zxvf wedpr_android_*_libs.tar
29 | - 拷贝动态库至加载路径:将解压好的动态库放至demo/app/src/main/jniLibs对应路径下
30 |
31 | - 编译项目:bash ./gradlew clean build
32 |
33 | - 查看demo:查看MainActivity.java
34 |
--------------------------------------------------------------------------------
/demo/app/.gitignore:
--------------------------------------------------------------------------------
1 | /build
--------------------------------------------------------------------------------
/demo/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: 'com.android.application'
2 |
3 | android {
4 | compileSdkVersion 30
5 | buildToolsVersion "30.0.2"
6 |
7 | defaultConfig {
8 | applicationId "com.webank.wedprdemo"
9 | minSdkVersion 21
10 | targetSdkVersion 30
11 | versionCode 1
12 | versionName "1.0"
13 |
14 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
15 | }
16 |
17 | buildTypes {
18 | release {
19 | minifyEnabled false
20 | proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
21 | }
22 | }
23 | }
24 |
25 | dependencies {
26 | implementation fileTree(dir: "libs", include: ["*.jar"])
27 | // implementation 'androidx.appcompat:appcompat:1.0.0-alpha3'
28 | // implementation 'androidx.constraintlayout:constraintlayout:1.1.1'
29 |
30 | // testImplementation 'junit:junit:4.12'
31 | // androidTestImplementation 'androidx.test:runner:1.1.0-alpha3'
32 | // androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha3'
33 |
34 | // implementation 'com.google.android.material:material:1.0.0-alpha3'
35 | // implementation 'androidx.cardview:cardview:1.0.0-alpha3'
36 | implementation 'com.android.support:appcompat-v7:28.0.0-alpha3'
37 | implementation 'com.android.support.constraint:constraint-layout:2.0.1'
38 | // implementation 'com.google.protobuf:protobuf-lite:3.0.0'
39 | testImplementation 'junit:junit:4.12'
40 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
41 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
42 | implementation group: 'com.google.protobuf', name: 'protobuf-java', version: '3.9.1'
43 |
44 | }
45 |
46 | android {
47 | lintOptions {
48 | abortOnError false
49 | }
50 | }
--------------------------------------------------------------------------------
/demo/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 | #
5 | # For more details, see
6 | # http://developer.android.com/guide/developing/tools/proguard.html
7 |
8 | # If your project uses WebView with JS, uncomment the following
9 | # and specify the fully qualified class name to the JavaScript interface
10 | # class:
11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12 | # public *;
13 | #}
14 |
15 | # Uncomment this to preserve the line number information for
16 | # debugging stack traces.
17 | #-keepattributes SourceFile,LineNumberTable
18 |
19 | # If you keep the line number information, uncomment this to
20 | # hide the original source file name.
21 | #-renamesourcefileattribute SourceFile
--------------------------------------------------------------------------------
/demo/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
This is an easy way to return multiple data from a single JNI interface. 12 | */ 13 | public class CryptoResult extends WedprResult { 14 | public String signature; 15 | public String publicKey; 16 | public String privateKey; 17 | public String hash; 18 | public boolean booleanResult; 19 | public String encryptedData; 20 | public String decryptedData; 21 | 22 | /** Expects no error occurred, otherwise throws an Exception. */ 23 | public CryptoResult expectNoError() throws WedprException { 24 | if (hasError()) { 25 | throw new WedprException(wedprErrorMessage); 26 | } 27 | return this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/crypto/NativeInterface.java: -------------------------------------------------------------------------------- 1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0. 2 | 3 | package com.webank.wedpr.crypto; 4 | 5 | /** Native interface for Crypto client. */ 6 | public class NativeInterface { 7 | 8 | // TODO: Check this path. 9 | static { 10 | System.loadLibrary("ffi_java_crypto"); 11 | } 12 | 13 | // JNI function section. 14 | public static native CryptoResult secp256k1EciesEncrypt(String publicKey, String message); 15 | 16 | public static native CryptoResult secp256k1EciesDecrypt(String privateKey, String encryptedData); 17 | 18 | public static native CryptoResult secp256k1GenKeyPair(); 19 | 20 | public static native CryptoResult secp256k1Sign(String privateKey, String messageHash); 21 | 22 | public static native CryptoResult secp256k1Verify( 23 | String publicKey, String messageHash, String signature); 24 | 25 | public static native CryptoResult keccak256Hash(String message); 26 | } 27 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/ktb/hdk/HdkClient.java: -------------------------------------------------------------------------------- 1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0. 2 | 3 | package com.webank.wedpr.ktb.hdk; 4 | 5 | import com.webank.wedpr.common.WedprException; 6 | 7 | /** 8 | * Client class used by KTB-HDK. This is the main interface class for Java apps using HDK 9 | * functions. 10 | */ 11 | public class HdkClient { 12 | 13 | /** 14 | * Creates an English mnemonic for later generating the master key. 15 | * 16 | * @param wordCount the word count of the mnemonic. 17 | * @return HdkResult containing data for mnemonic. 18 | * @throws WedprException if any error occurred. 19 | */ 20 | public HdkResult createMnemonicEn(int wordCount) throws WedprException { 21 | return NativeInterface.createMnemonicEn(wordCount).expectNoError(); 22 | } 23 | 24 | /** 25 | * Creates a master key from a English mnemonic and a password. 26 | * 27 | * @param password the password used together with the mnemonic. 28 | * @param mnemonic the mnemonic for master key recovery. 29 | * @return HdkResult containing data for masterKey. 30 | * @throws WedprException if any error occurred. 31 | */ 32 | public HdkResult createMasterKeyEn(String password, String mnemonic) throws WedprException { 33 | return NativeInterface.createMasterKeyEn(password, mnemonic).expectNoError(); 34 | } 35 | 36 | /** 37 | * Derives an extended key pair based on a key derivation path. 38 | * 39 | * @param masterKey the master key for key derivation. 40 | * @param purposeType the purpose type of the derived key. 41 | * @param assetType the asset subtype of the derived key. 42 | * @param account the account subtype of the derived key. 43 | * @param change the change subtype of the derived key. 44 | * @param addressIndex the address index of the derived key. 45 | * @return HdkResult containing data for extendedPublicKey, extendedPrivateKey. 46 | * @throws WedprException if any error occurred. 47 | */ 48 | public HdkResult deriveExtendedKey( 49 | String masterKey, int purposeType, int assetType, int account, int change, int addressIndex) 50 | throws WedprException { 51 | return NativeInterface.deriveExtendedKey( 52 | masterKey, purposeType, assetType, account, change, addressIndex) 53 | .expectNoError(); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/ktb/hdk/HdkResult.java: -------------------------------------------------------------------------------- 1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0. 2 | 3 | package com.webank.wedpr.ktb.hdk; 4 | 5 | import com.webank.wedpr.common.WedprException; 6 | import com.webank.wedpr.common.WedprResult; 7 | 8 | /** 9 | * Result class used by HDK client. 10 | * 11 | *
This is an easy way to return multiple data from a single JNI interface.
12 | */
13 | public class HdkResult extends WedprResult {
14 | public String mnemonic;
15 | public String masterKey;
16 | public String extendedPrivateKey;
17 | public String extendedPublicKey;
18 |
19 | /** Expects no error occurred, otherwise throws an Exception. */
20 | public HdkResult expectNoError() throws WedprException {
21 | if (hasError()) {
22 | throw new WedprException(wedprErrorMessage);
23 | }
24 | return this;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/ktb/hdk/NativeInterface.java:
--------------------------------------------------------------------------------
1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2 |
3 | package com.webank.wedpr.ktb.hdk;
4 |
5 | import java.io.IOException;
6 |
7 | /** Native interface for HDK client. */
8 | public class NativeInterface {
9 |
10 | static {
11 | System.loadLibrary("ffi_java_ktb");
12 | }
13 |
14 | // JNI function section.
15 | public static native HdkResult createMnemonicEn(int wordCount);
16 |
17 | public static native HdkResult createMasterKeyEn(String password, String mnemonic);
18 |
19 | public static native HdkResult deriveExtendedKey(String masterKey, int purposeType, int assetType, int account, int change, int addressIndex);
20 | }
21 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/IssuerClient.java:
--------------------------------------------------------------------------------
1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2 |
3 | package com.webank.wedpr.scd;
4 |
5 | import com.webank.wedpr.common.WedprException;
6 | import com.webank.wedpr.scd.proto.CertificateSchema;
7 | import java.util.List;
8 |
9 | /**
10 | * Client class used by a SCD certificate issuer. This is the main interface class for Java apps
11 | * using SCD functions.
12 | */
13 | public class IssuerClient extends ScdClient {
14 | /**
15 | * Makes a certificate template for users to fill data.
16 | *
17 | * @param schema the schema defining the certificate attribute name list.
18 | * @return IssuerResult containing data for certificateTemplate, templatePrivateKey.
19 | * @throws WedprException if any error occurred.
20 | */
21 | public IssuerResult makeCertificateTemplate(List This is an easy way to return multiple data from a single JNI interface.
12 | */
13 | public class IssuerResult extends WedprResult {
14 | public String certificateTemplate;
15 | public String templatePrivateKey;
16 | public String certificateSignature;
17 | public String issuerNonce;
18 |
19 | /** Expects no error occurred, otherwise throws an Exception. */
20 | public IssuerResult expectNoError() throws WedprException {
21 | if (hasError()) {
22 | throw new WedprException(wedprErrorMessage);
23 | }
24 | return this;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/NativeInterface.java:
--------------------------------------------------------------------------------
1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2 |
3 | package com.webank.wedpr.scd;
4 |
5 | /** Native interface for Crypto client. */
6 | public class NativeInterface {
7 |
8 | // TODO: Check this path.
9 | static {
10 | System.loadLibrary("ffi_java_scd");
11 | }
12 |
13 | // JNI function section.
14 | public static native IssuerResult issuerMakeCertificateTemplate(String schema);
15 |
16 | public static native IssuerResult issuerSignCertificate(
17 | String certificateTemplate,
18 | String templatePrivateKey,
19 | String signRequest,
20 | String userId,
21 | String userNonce);
22 |
23 | public static native UserResult userFillCertificate(
24 | String attributeDict, String certificateTemplate);
25 |
26 | public static native UserResult userBlindCertificateSignature(
27 | String certificateSignature,
28 | String attributeDict,
29 | String certificateTemplate,
30 | String userPrivateKey,
31 | String certificateSecretsBlindingFactors,
32 | String issuerNonce);
33 |
34 | public static native UserResult userProveSelectiveDisclosure(
35 | String ruleSet,
36 | String certificateSignature,
37 | String attributeDict,
38 | String certificateTemplate,
39 | String userPrivateKey,
40 | String verificationNonce);
41 |
42 | public static native VerifierResult verifierVerifySelectiveDisclosure(
43 | String ruleSet, String verifyRequest);
44 |
45 | public static native VerifierResult verifierGetRevealedAttributes(String verifyRequest);
46 |
47 | public static native VerifierResult verifierGetVerificationNonce();
48 | }
49 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/PredicateType.java:
--------------------------------------------------------------------------------
1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2 |
3 | package com.webank.wedpr.scd;
4 |
5 | /**
6 | * Predicate types supported by SCD.
7 | */
8 | public enum PredicateType {
9 | GE, // >
10 | LE, // <
11 | GT, // >=
12 | LT, // <=
13 | EQ // ==
14 | }
15 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/ScdClient.java:
--------------------------------------------------------------------------------
1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2 |
3 | package com.webank.wedpr.scd;
4 |
5 | import com.google.protobuf.Message;
6 | import com.webank.wedpr.common.Utils;
7 | import com.webank.wedpr.scd.proto.AttributeDict;
8 | import com.webank.wedpr.scd.proto.StringToStringPair;
9 | import java.util.Map;
10 |
11 | /** Base client class used by SCD. */
12 | abstract class ScdClient {
13 | /**
14 | * Encodes a filled attribute KV map to a String.
15 | *
16 | * @param attributeDictInput the KV map containing the filled data of a certificate.
17 | * @return the encoded string for attributeDictInput.
18 | */
19 | public String encodeAttributeDict(Map This is an easy way to return multiple data from a single JNI interface.
12 | */
13 | public class UserResult extends WedprResult {
14 | public String signCertificateRequest;
15 | public String userPrivateKey;
16 | public String certificateSecretsBlindingFactors;
17 | public String userNonce;
18 | public String certificateSignature;
19 | public String verifyRequest;
20 |
21 | /** Expects no error occurred, otherwise throws an Exception. */
22 | public UserResult expectNoError() throws WedprException {
23 | if (hasError()) {
24 | throw new WedprException(wedprErrorMessage);
25 | }
26 | return this;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/VerifierClient.java:
--------------------------------------------------------------------------------
1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2 |
3 | package com.webank.wedpr.scd;
4 |
5 | import com.webank.wedpr.common.WedprException;
6 |
7 | /**
8 | * Client class used by a SCD certificate verifier. This is the main interface class for Java apps
9 | * using SCD functions.
10 | */
11 | public class VerifierClient extends ScdClient {
12 | /**
13 | * Verifies the validity of a VerifyRequest containing selected attribute values and their value
14 | * predicates.
15 | *
16 | * @param ruleSet the encoded rule set for the disclosure.
17 | * @param verifyRequest the encoded disclosure verifying request from the user.
18 | * @return VerifierResult containing data for boolResult.
19 | * @throws WedprException if any error occurred.
20 | */
21 | public VerifierResult verifySelectiveDisclosure(String ruleSet, String verifyRequest)
22 | throws WedprException {
23 | return NativeInterface.verifierVerifySelectiveDisclosure(ruleSet, verifyRequest)
24 | .expectNoError();
25 | }
26 |
27 | /**
28 | * Gets revealed attributes selected by a user. Before calling this function,
29 | * verifySelectiveDisclosure should be called to verify the validity of the VerifyRequest.
30 | *
31 | * @param verifyRequest the encoded disclosure verifying request from the user.
32 | * @return VerifierResult containing data for revealedAttributeDict.
33 | * @throws WedprException if any error occurred.
34 | */
35 | public VerifierResult getRevealedAttributes(String verifyRequest) throws WedprException {
36 | return NativeInterface.verifierGetRevealedAttributes(verifyRequest).expectNoError();
37 | }
38 |
39 | /**
40 | * Generates a new encoded nonce as the challenge for a user to generate a fresh proof.
41 | *
42 | * @return VerifierResult containing data for verificationNonce.
43 | * @throws WedprException if any error occurred.
44 | */
45 | public VerifierResult getVerificationNonce() throws WedprException {
46 | return NativeInterface.verifierGetVerificationNonce().expectNoError();
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/VerifierResult.java:
--------------------------------------------------------------------------------
1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2 |
3 | package com.webank.wedpr.scd;
4 |
5 | import com.webank.wedpr.common.WedprException;
6 | import com.webank.wedpr.common.WedprResult;
7 |
8 | /**
9 | * Result class used by a SCD certificate verifier.
10 | *
11 | * This is an easy way to return multiple data from a single JNI interface.
12 | */
13 | public class VerifierResult extends WedprResult {
14 | public String revealedAttributeDict;
15 | public String verificationNonce;
16 | public boolean boolResult;
17 |
18 | /** Expects no error occurred, otherwise throws an Exception. */
19 | public VerifierResult expectNoError() throws WedprException {
20 | if (hasError()) {
21 | throw new WedprException(wedprErrorMessage);
22 | }
23 | return this;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/AttributeDictOrBuilder.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | public interface AttributeDictOrBuilder
7 | extends
8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.AttributeDict)
9 | com.google.protobuf.MessageOrBuilder {
10 |
11 | /** This is an easy way to return multiple data from a single JNI interface.
12 | */
13 | public class VclResult extends WedprResult {
14 | public String confidentialCredit;
15 | public String ownerSecret;
16 | public String proof;
17 | public boolean verificationResult;
18 |
19 | /** Expects no error occurred, otherwise throws an Exception. */
20 | public VclResult expectNoError() throws WedprException {
21 | if (hasError()) {
22 | throw new WedprException(wedprErrorMessage);
23 | }
24 | return this;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedprdemo/MainActivity.java:
--------------------------------------------------------------------------------
1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2 |
3 | package com.webank.wedprdemo;
4 |
5 | import android.support.v7.app.AppCompatActivity;
6 | import android.os.Bundle;
7 |
8 | import com.webank.wedpr.common.Utils;
9 | import com.webank.wedpr.crypto.CryptoClient;
10 | import com.webank.wedpr.crypto.CryptoResult;
11 | import com.webank.wedpr.ktb.hdk.HdkClient;
12 | import com.webank.wedpr.ktb.hdk.HdkResult;
13 | import com.webank.wedpr.scd.*;
14 | import com.webank.wedpr.scd.proto.Predicate;
15 | import com.webank.wedpr.vcl.VclClient;
16 | import com.webank.wedpr.vcl.VclResult;
17 | import com.webank.wedpr.scd.proto.*;
18 |
19 | import java.util.Arrays;
20 | import java.util.HashMap;
21 | import java.util.List;
22 | import java.util.Map;
23 |
24 | // TODO: Rename the package name to demo.
25 | public class MainActivity extends AppCompatActivity {
26 | private static final String TAG = "MainActivity";
27 |
28 | @Override
29 | protected void onCreate(Bundle savedInstanceState) {
30 | super.onCreate(savedInstanceState);
31 | setContentView(R.layout.activity_main);
32 | try {
33 | // Crypto demo.
34 | CryptoClient cryptoClient = new CryptoClient();
35 | cryptoDemo(cryptoClient);
36 |
37 | // VCL demo.
38 | VclClient vclClient = new VclClient();
39 | vclDemo(vclClient, 2, 2, 4);
40 | vclDemo(vclClient, 3, 4, 12);
41 | vclDemo(vclClient, 1, 2, 3);
42 | vclDemo(vclClient, 3, 4, 5);
43 | vclDemo(vclClient, -1, 4, 3);
44 |
45 | // SCD demo.
46 | IssuerClient issuerClient = new IssuerClient();
47 | UserClient userClient = new UserClient();
48 | VerifierClient verifierClient = new VerifierClient();
49 | scdDemo(issuerClient, userClient, verifierClient);
50 |
51 | // KTB demo.
52 | HdkClient hdkClient = new HdkClient();
53 | KtbDemo(hdkClient);
54 | } catch (Exception e) {
55 | e.printStackTrace();
56 | }
57 | }
58 |
59 | private static void cryptoDemo(CryptoClient cryptoClient)
60 | throws Exception {
61 | System.out.println("\n*******\nCRYPTO DEMO RUN\n*******");
62 |
63 | CryptoResult cryptoResult = cryptoClient.secp256k1GenKeyPair();
64 | String publicKey = cryptoResult.publicKey;
65 | String privateKey = cryptoResult.privateKey;
66 | System.out.println("public key = " + publicKey);
67 | System.out.println("private key = " + privateKey);
68 |
69 | // Base64 encoding for "WeDPR Demo", which is currently required to pass bytes input to API.
70 | // TODO: Allow non-encoded UTF8 input.
71 | String message = "V2VEUFIgRGVtbw==";
72 | String messageHash = cryptoClient.keccak256Hash(message).hash;
73 | System.out.println("messageHash = " + messageHash);
74 |
75 | String signature = cryptoClient.secp256k1Sign(privateKey, messageHash).signature;
76 | System.out.println("signature = " + signature);
77 |
78 | boolean result = cryptoClient.secp256k1Verify(publicKey, messageHash, signature).booleanResult;
79 | System.out.println("signature verify result = " + result);
80 |
81 | String encryptedData = cryptoClient.secp256k1EciesEncrypt(publicKey, messageHash).encryptedData;
82 | System.out.println("encryptedData = " + encryptedData);
83 |
84 | String decryptedData = cryptoClient.secp256k1EciesDecrypt(privateKey, encryptedData).decryptedData;
85 | System.out.println("decryptedData = " + decryptedData);
86 | }
87 |
88 | private static void vclDemo(VclClient vclClient, long c1Value, long c2Value, long c3Value)
89 | throws Exception {
90 | System.out.println("\n*******\nVCL DEMO RUN\n*******");
91 | System.out.println(
92 | "c1_value = " + c1Value + ", c2_value = " + c2Value + ", c3_value = " + c3Value + "\n");
93 |
94 | if (c1Value < 0 || c2Value < 0 || c3Value < 0) {
95 | System.out.println(
96 | "[WARNING] Non-positive value detected.\n"
97 | + "All the balance proofs (sum and product) will fail intentionally.\n");
98 | }
99 |
100 | // Create confidential credit records for those values.
101 | VclResult c1Result = vclClient.makeCredit(c1Value);
102 | System.out.println("c1_credit (publicly verifiable) = " + c1Result.confidentialCredit);
103 | System.out.println("c1_secret (only known by the owner) = " + c1Result.ownerSecret);
104 |
105 | VclResult c2Result = vclClient.makeCredit(c2Value);
106 | System.out.println("c2_credit (publicly verifiable) = " + c2Result.confidentialCredit);
107 | System.out.println("c2_secret (only known by the owner) = " + c2Result.ownerSecret);
108 |
109 | VclResult c3Result = vclClient.makeCredit(c3Value);
110 | System.out.println("c3_credit (publicly verifiable) = " + c3Result.confidentialCredit);
111 | System.out.println("c3_secret (only known by the owner) = " + c3Result.ownerSecret);
112 |
113 | // Prove c1_value + c2_value = c3_value.
114 | VclResult sumResult =
115 | vclClient.proveSumBalance(c1Result.ownerSecret, c2Result.ownerSecret, c3Result.ownerSecret);
116 | System.out.println(
117 | "\nproof of " + c1Value + " + " + c2Value + " =? " + c3Value + ":\n" + sumResult.proof);
118 |
119 | VclResult verifySumResult =
120 | vclClient.verifySumBalance(
121 | c1Result.confidentialCredit,
122 | c2Result.confidentialCredit,
123 | c3Result.confidentialCredit,
124 | sumResult.proof);
125 | if (verifySumResult.verificationResult) {
126 | System.out.println(">> Pass: " + c1Value + " + " + c2Value + " == " + c3Value);
127 | } else {
128 | System.out.println("<< Fail: " + c1Value + " + " + c2Value + " != " + c3Value);
129 | }
130 |
131 | // Prove c1_value * c2_value = c3_value.
132 | VclResult productResult =
133 | vclClient.proveProductBalance(
134 | c1Result.ownerSecret, c2Result.ownerSecret, c3Result.ownerSecret);
135 | System.out.println(
136 | "\nproof of " + c1Value + " * " + c2Value + " =? " + c3Value + ":\n" + productResult.proof);
137 |
138 | VclResult verifyMultiResult =
139 | vclClient.verifyProductBalance(
140 | c1Result.confidentialCredit,
141 | c2Result.confidentialCredit,
142 | c3Result.confidentialCredit,
143 | productResult.proof);
144 | if (verifyMultiResult.verificationResult) {
145 | System.out.println(">> Pass: " + c1Value + " * " + c2Value + " == " + c3Value);
146 | } else {
147 | System.out.println("<< Fail: " + c1Value + " * " + c2Value + " != " + c3Value);
148 | }
149 |
150 | // Prove c1_value in [0, 2^32-1].
151 | VclResult rangeResult = vclClient.proveRange(c1Result.ownerSecret);
152 | System.out.println("\nproof of " + c1Value + " in [0, 2^32-1]:\n" + productResult.proof);
153 |
154 | VclResult verifyRangeResult =
155 | vclClient.verifyRange(c1Result.confidentialCredit, rangeResult.proof);
156 | if (verifyRangeResult.verificationResult) {
157 | System.out.println(">> Pass: " + c1Value + " in [0, 2^32-1]");
158 | } else {
159 | System.out.println("<< Fail: " + c1Value + " not in [0, 2^32-1]");
160 | }
161 | }
162 |
163 | private static final String NAME = "name";
164 | private static final String AGE = "age";
165 | private static final String GENDER = "gender";
166 | private static final String ISSUE_TIME = "issue_time";
167 | private static final String DEFAULT_USER_ID = "default_user_id";
168 |
169 | public static void scdDemo(
170 | IssuerClient issuerClient, UserClient userClient, VerifierClient verifierClient)
171 | throws Exception {
172 | System.out.println("\n*******\nSCD DEMO RUN\n*******");
173 |
174 | // An issuer defines the certificate schema and generates the certificate template.
175 | Listrepeated .com.webank.wedpr.scd.proto.StringToStringPair pair = 1;
*/
12 | java.util.Listrepeated .com.webank.wedpr.scd.proto.StringToStringPair pair = 1;
*/
14 | com.webank.wedpr.scd.proto.StringToStringPair getPair(int index);
15 | /** repeated .com.webank.wedpr.scd.proto.StringToStringPair pair = 1;
*/
16 | int getPairCount();
17 | /** repeated .com.webank.wedpr.scd.proto.StringToStringPair pair = 1;
*/
18 | java.util.List extends com.webank.wedpr.scd.proto.StringToStringPairOrBuilder>
19 | getPairOrBuilderList();
20 | /** repeated .com.webank.wedpr.scd.proto.StringToStringPair pair = 1;
*/
21 | com.webank.wedpr.scd.proto.StringToStringPairOrBuilder getPairOrBuilder(int index);
22 | }
23 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/BlindedCertificateSecretOrBuilder.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | public interface BlindedCertificateSecretOrBuilder
7 | extends
8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.BlindedCertificateSecret)
9 | com.google.protobuf.MessageOrBuilder {
10 |
11 | /** string blinded_certificate_secrets = 1;
*/
12 | String getBlindedCertificateSecrets();
13 | /** string blinded_certificate_secrets = 1;
*/
14 | com.google.protobuf.ByteString getBlindedCertificateSecretsBytes();
15 |
16 | /** string blinded_certificate_secrets_correctness_proof = 2;
*/
17 | String getBlindedCertificateSecretsCorrectnessProof();
18 | /** string blinded_certificate_secrets_correctness_proof = 2;
*/
19 | com.google.protobuf.ByteString getBlindedCertificateSecretsCorrectnessProofBytes();
20 | }
21 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/CertificateSchema.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | /**
7 | *
8 | *
9 | *
10 | * Certificate schema.
11 | *
12 | *
13 | * Protobuf type {@code com.webank.wedpr.scd.proto.CertificateSchema}
14 | */
15 | public final class CertificateSchema extends com.google.protobuf.GeneratedMessageV3
16 | implements
17 | // @@protoc_insertion_point(message_implements:com.webank.wedpr.scd.proto.CertificateSchema)
18 | CertificateSchemaOrBuilder {
19 | private static final long serialVersionUID = 0L;
20 | // Use CertificateSchema.newBuilder() to construct.
21 | private CertificateSchema(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
22 | super(builder);
23 | }
24 |
25 | private CertificateSchema() {
26 | attributeName_ = com.google.protobuf.LazyStringArrayList.EMPTY;
27 | }
28 |
29 | @Override
30 | @SuppressWarnings({"unused"})
31 | protected Object newInstance(UnusedPrivateParameter unused) {
32 | return new CertificateSchema();
33 | }
34 |
35 | @Override
36 | public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
37 | return this.unknownFields;
38 | }
39 |
40 | private CertificateSchema(
41 | com.google.protobuf.CodedInputStream input,
42 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
43 | throws com.google.protobuf.InvalidProtocolBufferException {
44 | this();
45 | if (extensionRegistry == null) {
46 | throw new NullPointerException();
47 | }
48 | int mutable_bitField0_ = 0;
49 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
50 | com.google.protobuf.UnknownFieldSet.newBuilder();
51 | try {
52 | boolean done = false;
53 | while (!done) {
54 | int tag = input.readTag();
55 | switch (tag) {
56 | case 0:
57 | done = true;
58 | break;
59 | case 10:
60 | {
61 | String s = input.readStringRequireUtf8();
62 | if (!((mutable_bitField0_ & 0x00000001) != 0)) {
63 | attributeName_ = new com.google.protobuf.LazyStringArrayList();
64 | mutable_bitField0_ |= 0x00000001;
65 | }
66 | attributeName_.add(s);
67 | break;
68 | }
69 | default:
70 | {
71 | if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
72 | done = true;
73 | }
74 | break;
75 | }
76 | }
77 | }
78 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
79 | throw e.setUnfinishedMessage(this);
80 | } catch (java.io.IOException e) {
81 | throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
82 | } finally {
83 | if (((mutable_bitField0_ & 0x00000001) != 0)) {
84 | attributeName_ = attributeName_.getUnmodifiableView();
85 | }
86 | this.unknownFields = unknownFields.build();
87 | makeExtensionsImmutable();
88 | }
89 | }
90 |
91 | public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
92 | return com.webank.wedpr.scd.proto.Scd
93 | .internal_static_com_webank_wedpr_scd_proto_CertificateSchema_descriptor;
94 | }
95 |
96 | @Override
97 | protected FieldAccessorTable internalGetFieldAccessorTable() {
98 | return com.webank.wedpr.scd.proto.Scd
99 | .internal_static_com_webank_wedpr_scd_proto_CertificateSchema_fieldAccessorTable
100 | .ensureFieldAccessorsInitialized(
101 | com.webank.wedpr.scd.proto.CertificateSchema.class,
102 | com.webank.wedpr.scd.proto.CertificateSchema.Builder.class);
103 | }
104 |
105 | public static final int ATTRIBUTE_NAME_FIELD_NUMBER = 1;
106 | private com.google.protobuf.LazyStringList attributeName_;
107 | /** repeated string attribute_name = 1;
*/
108 | public com.google.protobuf.ProtocolStringList getAttributeNameList() {
109 | return attributeName_;
110 | }
111 | /** repeated string attribute_name = 1;
*/
112 | public int getAttributeNameCount() {
113 | return attributeName_.size();
114 | }
115 | /** repeated string attribute_name = 1;
*/
116 | public String getAttributeName(int index) {
117 | return attributeName_.get(index);
118 | }
119 | /** repeated string attribute_name = 1;
*/
120 | public com.google.protobuf.ByteString getAttributeNameBytes(int index) {
121 | return attributeName_.getByteString(index);
122 | }
123 |
124 | private byte memoizedIsInitialized = -1;
125 |
126 | @Override
127 | public final boolean isInitialized() {
128 | byte isInitialized = memoizedIsInitialized;
129 | if (isInitialized == 1) return true;
130 | if (isInitialized == 0) return false;
131 |
132 | memoizedIsInitialized = 1;
133 | return true;
134 | }
135 |
136 | @Override
137 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
138 | for (int i = 0; i < attributeName_.size(); i++) {
139 | com.google.protobuf.GeneratedMessageV3.writeString(output, 1, attributeName_.getRaw(i));
140 | }
141 | unknownFields.writeTo(output);
142 | }
143 |
144 | @Override
145 | public int getSerializedSize() {
146 | int size = memoizedSize;
147 | if (size != -1) return size;
148 |
149 | size = 0;
150 | {
151 | int dataSize = 0;
152 | for (int i = 0; i < attributeName_.size(); i++) {
153 | dataSize += computeStringSizeNoTag(attributeName_.getRaw(i));
154 | }
155 | size += dataSize;
156 | size += 1 * getAttributeNameList().size();
157 | }
158 | size += unknownFields.getSerializedSize();
159 | memoizedSize = size;
160 | return size;
161 | }
162 |
163 | @Override
164 | public boolean equals(final Object obj) {
165 | if (obj == this) {
166 | return true;
167 | }
168 | if (!(obj instanceof com.webank.wedpr.scd.proto.CertificateSchema)) {
169 | return super.equals(obj);
170 | }
171 | com.webank.wedpr.scd.proto.CertificateSchema other =
172 | (com.webank.wedpr.scd.proto.CertificateSchema) obj;
173 |
174 | if (!getAttributeNameList().equals(other.getAttributeNameList())) return false;
175 | if (!unknownFields.equals(other.unknownFields)) return false;
176 | return true;
177 | }
178 |
179 | @Override
180 | public int hashCode() {
181 | if (memoizedHashCode != 0) {
182 | return memoizedHashCode;
183 | }
184 | int hash = 41;
185 | hash = (19 * hash) + getDescriptor().hashCode();
186 | if (getAttributeNameCount() > 0) {
187 | hash = (37 * hash) + ATTRIBUTE_NAME_FIELD_NUMBER;
188 | hash = (53 * hash) + getAttributeNameList().hashCode();
189 | }
190 | hash = (29 * hash) + unknownFields.hashCode();
191 | memoizedHashCode = hash;
192 | return hash;
193 | }
194 |
195 | public static com.webank.wedpr.scd.proto.CertificateSchema parseFrom(java.nio.ByteBuffer data)
196 | throws com.google.protobuf.InvalidProtocolBufferException {
197 | return PARSER.parseFrom(data);
198 | }
199 |
200 | public static com.webank.wedpr.scd.proto.CertificateSchema parseFrom(
201 | java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
202 | throws com.google.protobuf.InvalidProtocolBufferException {
203 | return PARSER.parseFrom(data, extensionRegistry);
204 | }
205 |
206 | public static com.webank.wedpr.scd.proto.CertificateSchema parseFrom(
207 | com.google.protobuf.ByteString data)
208 | throws com.google.protobuf.InvalidProtocolBufferException {
209 | return PARSER.parseFrom(data);
210 | }
211 |
212 | public static com.webank.wedpr.scd.proto.CertificateSchema parseFrom(
213 | com.google.protobuf.ByteString data,
214 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
215 | throws com.google.protobuf.InvalidProtocolBufferException {
216 | return PARSER.parseFrom(data, extensionRegistry);
217 | }
218 |
219 | public static com.webank.wedpr.scd.proto.CertificateSchema parseFrom(byte[] data)
220 | throws com.google.protobuf.InvalidProtocolBufferException {
221 | return PARSER.parseFrom(data);
222 | }
223 |
224 | public static com.webank.wedpr.scd.proto.CertificateSchema parseFrom(
225 | byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
226 | throws com.google.protobuf.InvalidProtocolBufferException {
227 | return PARSER.parseFrom(data, extensionRegistry);
228 | }
229 |
230 | public static com.webank.wedpr.scd.proto.CertificateSchema parseFrom(java.io.InputStream input)
231 | throws java.io.IOException {
232 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
233 | }
234 |
235 | public static com.webank.wedpr.scd.proto.CertificateSchema parseFrom(
236 | java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
237 | throws java.io.IOException {
238 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
239 | PARSER, input, extensionRegistry);
240 | }
241 |
242 | public static com.webank.wedpr.scd.proto.CertificateSchema parseDelimitedFrom(
243 | java.io.InputStream input) throws java.io.IOException {
244 | return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
245 | }
246 |
247 | public static com.webank.wedpr.scd.proto.CertificateSchema parseDelimitedFrom(
248 | java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
249 | throws java.io.IOException {
250 | return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
251 | PARSER, input, extensionRegistry);
252 | }
253 |
254 | public static com.webank.wedpr.scd.proto.CertificateSchema parseFrom(
255 | com.google.protobuf.CodedInputStream input) throws java.io.IOException {
256 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
257 | }
258 |
259 | public static com.webank.wedpr.scd.proto.CertificateSchema parseFrom(
260 | com.google.protobuf.CodedInputStream input,
261 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
262 | throws java.io.IOException {
263 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
264 | PARSER, input, extensionRegistry);
265 | }
266 |
267 | @Override
268 | public Builder newBuilderForType() {
269 | return newBuilder();
270 | }
271 |
272 | public static Builder newBuilder() {
273 | return DEFAULT_INSTANCE.toBuilder();
274 | }
275 |
276 | public static Builder newBuilder(com.webank.wedpr.scd.proto.CertificateSchema prototype) {
277 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
278 | }
279 |
280 | @Override
281 | public Builder toBuilder() {
282 | return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
283 | }
284 |
285 | @Override
286 | protected Builder newBuilderForType(BuilderParent parent) {
287 | Builder builder = new Builder(parent);
288 | return builder;
289 | }
290 | /**
291 | *
292 | *
293 | *
294 | * Certificate schema.
295 | *
296 | *
297 | * Protobuf type {@code com.webank.wedpr.scd.proto.CertificateSchema}
298 | */
299 | public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builderrepeated string attribute_name = 1;
*/
468 | public com.google.protobuf.ProtocolStringList getAttributeNameList() {
469 | return attributeName_.getUnmodifiableView();
470 | }
471 | /** repeated string attribute_name = 1;
*/
472 | public int getAttributeNameCount() {
473 | return attributeName_.size();
474 | }
475 | /** repeated string attribute_name = 1;
*/
476 | public String getAttributeName(int index) {
477 | return attributeName_.get(index);
478 | }
479 | /** repeated string attribute_name = 1;
*/
480 | public com.google.protobuf.ByteString getAttributeNameBytes(int index) {
481 | return attributeName_.getByteString(index);
482 | }
483 | /** repeated string attribute_name = 1;
*/
484 | public Builder setAttributeName(int index, String value) {
485 | if (value == null) {
486 | throw new NullPointerException();
487 | }
488 | ensureAttributeNameIsMutable();
489 | attributeName_.set(index, value);
490 | onChanged();
491 | return this;
492 | }
493 | /** repeated string attribute_name = 1;
*/
494 | public Builder addAttributeName(String value) {
495 | if (value == null) {
496 | throw new NullPointerException();
497 | }
498 | ensureAttributeNameIsMutable();
499 | attributeName_.add(value);
500 | onChanged();
501 | return this;
502 | }
503 | /** repeated string attribute_name = 1;
*/
504 | public Builder addAllAttributeName(Iterablerepeated string attribute_name = 1;
*/
511 | public Builder clearAttributeName() {
512 | attributeName_ = com.google.protobuf.LazyStringArrayList.EMPTY;
513 | bitField0_ = (bitField0_ & ~0x00000001);
514 | onChanged();
515 | return this;
516 | }
517 | /** repeated string attribute_name = 1;
*/
518 | public Builder addAttributeNameBytes(com.google.protobuf.ByteString value) {
519 | if (value == null) {
520 | throw new NullPointerException();
521 | }
522 | checkByteStringIsUtf8(value);
523 | ensureAttributeNameIsMutable();
524 | attributeName_.add(value);
525 | onChanged();
526 | return this;
527 | }
528 |
529 | @Override
530 | public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
531 | return super.setUnknownFields(unknownFields);
532 | }
533 |
534 | @Override
535 | public final Builder mergeUnknownFields(
536 | final com.google.protobuf.UnknownFieldSet unknownFields) {
537 | return super.mergeUnknownFields(unknownFields);
538 | }
539 |
540 | // @@protoc_insertion_point(builder_scope:com.webank.wedpr.scd.proto.CertificateSchema)
541 | }
542 |
543 | // @@protoc_insertion_point(class_scope:com.webank.wedpr.scd.proto.CertificateSchema)
544 | private static final com.webank.wedpr.scd.proto.CertificateSchema DEFAULT_INSTANCE;
545 |
546 | static {
547 | DEFAULT_INSTANCE = new com.webank.wedpr.scd.proto.CertificateSchema();
548 | }
549 |
550 | public static com.webank.wedpr.scd.proto.CertificateSchema getDefaultInstance() {
551 | return DEFAULT_INSTANCE;
552 | }
553 |
554 | private static final com.google.protobuf.Parserrepeated string attribute_name = 1;
*/
12 | java.util.Listrepeated string attribute_name = 1;
*/
14 | int getAttributeNameCount();
15 | /** repeated string attribute_name = 1;
*/
16 | String getAttributeName(int index);
17 | /** repeated string attribute_name = 1;
*/
18 | com.google.protobuf.ByteString getAttributeNameBytes(int index);
19 | }
20 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/CertificateSignatureOrBuilder.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | public interface CertificateSignatureOrBuilder
7 | extends
8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.CertificateSignature)
9 | com.google.protobuf.MessageOrBuilder {
10 |
11 | /** string certificate_signature = 1;
*/
12 | String getCertificateSignature();
13 | /** string certificate_signature = 1;
*/
14 | com.google.protobuf.ByteString getCertificateSignatureBytes();
15 |
16 | /** string signature_correctness_proof = 2;
*/
17 | String getSignatureCorrectnessProof();
18 | /** string signature_correctness_proof = 2;
*/
19 | com.google.protobuf.ByteString getSignatureCorrectnessProofBytes();
20 | }
21 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/CertificateTemplateOrBuilder.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | public interface CertificateTemplateOrBuilder
7 | extends
8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.CertificateTemplate)
9 | com.google.protobuf.MessageOrBuilder {
10 |
11 | /** .com.webank.wedpr.scd.proto.CertificateSchema certificate_schema = 1;
*/
12 | boolean hasCertificateSchema();
13 | /** .com.webank.wedpr.scd.proto.CertificateSchema certificate_schema = 1;
*/
14 | com.webank.wedpr.scd.proto.CertificateSchema getCertificateSchema();
15 | /** .com.webank.wedpr.scd.proto.CertificateSchema certificate_schema = 1;
*/
16 | com.webank.wedpr.scd.proto.CertificateSchemaOrBuilder getCertificateSchemaOrBuilder();
17 |
18 | /** string template_correctness_proof = 2;
*/
19 | String getTemplateCorrectnessProof();
20 | /** string template_correctness_proof = 2;
*/
21 | com.google.protobuf.ByteString getTemplateCorrectnessProofBytes();
22 |
23 | /** .com.webank.wedpr.scd.proto.TemplatePublicKey template_public_key = 3;
*/
24 | boolean hasTemplatePublicKey();
25 | /** .com.webank.wedpr.scd.proto.TemplatePublicKey template_public_key = 3;
*/
26 | com.webank.wedpr.scd.proto.TemplatePublicKey getTemplatePublicKey();
27 | /** .com.webank.wedpr.scd.proto.TemplatePublicKey template_public_key = 3;
*/
28 | com.webank.wedpr.scd.proto.TemplatePublicKeyOrBuilder getTemplatePublicKeyOrBuilder();
29 | }
30 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/PredicateOrBuilder.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | public interface PredicateOrBuilder
7 | extends
8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.Predicate)
9 | com.google.protobuf.MessageOrBuilder {
10 |
11 | /** string attribute_name = 1;
*/
12 | String getAttributeName();
13 | /** string attribute_name = 1;
*/
14 | com.google.protobuf.ByteString getAttributeNameBytes();
15 |
16 | /** string predicate_type = 2;
*/
17 | String getPredicateType();
18 | /** string predicate_type = 2;
*/
19 | com.google.protobuf.ByteString getPredicateTypeBytes();
20 |
21 | /** uint64 predicate_value = 3;
*/
22 | long getPredicateValue();
23 | }
24 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/Scd.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | public final class Scd {
7 | private Scd() {}
8 |
9 | public static void registerAllExtensions(com.google.protobuf.ExtensionRegistryLite registry) {}
10 |
11 | public static void registerAllExtensions(com.google.protobuf.ExtensionRegistry registry) {
12 | registerAllExtensions((com.google.protobuf.ExtensionRegistryLite) registry);
13 | }
14 |
15 | static final com.google.protobuf.Descriptors.Descriptor
16 | internal_static_com_webank_wedpr_scd_proto_CertificateSchema_descriptor;
17 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
18 | internal_static_com_webank_wedpr_scd_proto_CertificateSchema_fieldAccessorTable;
19 | static final com.google.protobuf.Descriptors.Descriptor
20 | internal_static_com_webank_wedpr_scd_proto_StringToStringPair_descriptor;
21 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
22 | internal_static_com_webank_wedpr_scd_proto_StringToStringPair_fieldAccessorTable;
23 | static final com.google.protobuf.Descriptors.Descriptor
24 | internal_static_com_webank_wedpr_scd_proto_CertificateTemplate_descriptor;
25 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
26 | internal_static_com_webank_wedpr_scd_proto_CertificateTemplate_fieldAccessorTable;
27 | static final com.google.protobuf.Descriptors.Descriptor
28 | internal_static_com_webank_wedpr_scd_proto_TemplatePublicKey_descriptor;
29 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
30 | internal_static_com_webank_wedpr_scd_proto_TemplatePublicKey_fieldAccessorTable;
31 | static final com.google.protobuf.Descriptors.Descriptor
32 | internal_static_com_webank_wedpr_scd_proto_TemplatePrivateKey_descriptor;
33 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
34 | internal_static_com_webank_wedpr_scd_proto_TemplatePrivateKey_fieldAccessorTable;
35 | static final com.google.protobuf.Descriptors.Descriptor
36 | internal_static_com_webank_wedpr_scd_proto_AttributeDict_descriptor;
37 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
38 | internal_static_com_webank_wedpr_scd_proto_AttributeDict_fieldAccessorTable;
39 | static final com.google.protobuf.Descriptors.Descriptor
40 | internal_static_com_webank_wedpr_scd_proto_BlindedCertificateSecret_descriptor;
41 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
42 | internal_static_com_webank_wedpr_scd_proto_BlindedCertificateSecret_fieldAccessorTable;
43 | static final com.google.protobuf.Descriptors.Descriptor
44 | internal_static_com_webank_wedpr_scd_proto_CertificateSignature_descriptor;
45 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
46 | internal_static_com_webank_wedpr_scd_proto_CertificateSignature_fieldAccessorTable;
47 | static final com.google.protobuf.Descriptors.Descriptor
48 | internal_static_com_webank_wedpr_scd_proto_Predicate_descriptor;
49 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
50 | internal_static_com_webank_wedpr_scd_proto_Predicate_fieldAccessorTable;
51 | static final com.google.protobuf.Descriptors.Descriptor
52 | internal_static_com_webank_wedpr_scd_proto_VerificationRuleSet_descriptor;
53 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
54 | internal_static_com_webank_wedpr_scd_proto_VerificationRuleSet_fieldAccessorTable;
55 | static final com.google.protobuf.Descriptors.Descriptor
56 | internal_static_com_webank_wedpr_scd_proto_SignCertificateRequest_descriptor;
57 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
58 | internal_static_com_webank_wedpr_scd_proto_SignCertificateRequest_fieldAccessorTable;
59 | static final com.google.protobuf.Descriptors.Descriptor
60 | internal_static_com_webank_wedpr_scd_proto_VerifyRequest_descriptor;
61 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
62 | internal_static_com_webank_wedpr_scd_proto_VerifyRequest_fieldAccessorTable;
63 | static final com.google.protobuf.Descriptors.Descriptor
64 | internal_static_com_webank_wedpr_scd_proto_ScdResult_descriptor;
65 | static final com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
66 | internal_static_com_webank_wedpr_scd_proto_ScdResult_fieldAccessorTable;
67 |
68 | public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
69 | return descriptor;
70 | }
71 |
72 | private static com.google.protobuf.Descriptors.FileDescriptor descriptor;
73 |
74 | static {
75 | String[] descriptorData = {
76 | "\n\tscd.proto\022\032com.webank.wedpr.scd.proto\""
77 | + "+\n\021CertificateSchema\022\026\n\016attribute_name\030\001"
78 | + " \003(\t\"0\n\022StringToStringPair\022\013\n\003key\030\001 \001(\t\022"
79 | + "\r\n\005value\030\002 \001(\t\"\320\001\n\023CertificateTemplate\022I"
80 | + "\n\022certificate_schema\030\001 \001(\0132-.com.webank."
81 | + "wedpr.scd.proto.CertificateSchema\022\"\n\032tem"
82 | + "plate_correctness_proof\030\002 \001(\t\022J\n\023templat"
83 | + "e_public_key\030\003 \001(\0132-.com.webank.wedpr.sc"
84 | + "d.proto.TemplatePublicKey\" \n\021TemplatePub"
85 | + "licKey\022\013\n\003key\030\001 \001(\t\"!\n\022TemplatePrivateKe"
86 | + "y\022\013\n\003key\030\001 \001(\t\"M\n\rAttributeDict\022<\n\004pair\030"
87 | + "\001 \003(\0132..com.webank.wedpr.scd.proto.Strin"
88 | + "gToStringPair\"v\n\030BlindedCertificateSecre"
89 | + "t\022#\n\033blinded_certificate_secrets\030\001 \001(\t\0225"
90 | + "\n-blinded_certificate_secrets_correctnes"
91 | + "s_proof\030\002 \001(\t\"Z\n\024CertificateSignature\022\035\n"
92 | + "\025certificate_signature\030\001 \001(\t\022#\n\033signatur"
93 | + "e_correctness_proof\030\002 \001(\t\"T\n\tPredicate\022\026"
94 | + "\n\016attribute_name\030\001 \001(\t\022\026\n\016predicate_type"
95 | + "\030\002 \001(\t\022\027\n\017predicate_value\030\003 \001(\004\"z\n\023Verif"
96 | + "icationRuleSet\022\037\n\027revealed_attribute_nam"
97 | + "e\030\001 \003(\t\022B\n\023attribute_predicate\030\002 \003(\0132%.c"
98 | + "om.webank.wedpr.scd.proto.Predicate\"\303\001\n\026"
99 | + "SignCertificateRequest\022M\n\032certificate_at"
100 | + "tribute_dict\030\001 \001(\0132).com.webank.wedpr.sc"
101 | + "d.proto.AttributeDict\022#\n\033blinded_certifi"
102 | + "cate_secrets\030\002 \001(\t\0225\n-blinded_certificat"
103 | + "e_secrets_correctness_proof\030\003 \001(\t\"\226\001\n\rVe"
104 | + "rifyRequest\022M\n\024certificate_template\030\001 \001("
105 | + "\0132/.com.webank.wedpr.scd.proto.Certifica"
106 | + "teTemplate\022\032\n\022verification_proof\030\002 \001(\t\022\032"
107 | + "\n\022verification_nonce\030\003 \001(\t\"\201\005\n\tScdResult"
108 | + "\022M\n\024certificate_template\030\001 \001(\0132/.com.web"
109 | + "ank.wedpr.scd.proto.CertificateTemplate\022"
110 | + "L\n\024template_private_key\030\002 \001(\0132..com.weba"
111 | + "nk.wedpr.scd.proto.TemplatePrivateKey\022\024\n"
112 | + "\014issuer_nonce\030\003 \001(\t\022O\n\025certificate_signa"
113 | + "ture\030\004 \001(\01320.com.webank.wedpr.scd.proto."
114 | + "CertificateSignature\022\022\n\nuser_nonce\030\005 \001(\t"
115 | + "\022T\n\030sign_certificate_request\030\006 \001(\01322.com"
116 | + ".webank.wedpr.scd.proto.SignCertificateR"
117 | + "equest\022\030\n\020user_private_key\030\007 \001(\t\022,\n$cert"
118 | + "ificate_secrets_blinding_factors\030\010 \001(\t\022\032"
119 | + "\n\022verification_nonce\030\t \001(\t\022A\n\016verify_req"
120 | + "uest\030\n \001(\0132).com.webank.wedpr.scd.proto."
121 | + "VerifyRequest\022J\n\027revealed_attribute_dict"
122 | + "\030\013 \001(\0132).com.webank.wedpr.scd.proto.Attr"
123 | + "ibuteDict\022\023\n\013bool_result\030\014 \001(\010B\036\n\032com.we"
124 | + "bank.wedpr.scd.protoP\001b\006proto3"
125 | };
126 | descriptor =
127 | com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(
128 | descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] {});
129 | internal_static_com_webank_wedpr_scd_proto_CertificateSchema_descriptor =
130 | getDescriptor().getMessageTypes().get(0);
131 | internal_static_com_webank_wedpr_scd_proto_CertificateSchema_fieldAccessorTable =
132 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
133 | internal_static_com_webank_wedpr_scd_proto_CertificateSchema_descriptor,
134 | new String[] {
135 | "AttributeName",
136 | });
137 | internal_static_com_webank_wedpr_scd_proto_StringToStringPair_descriptor =
138 | getDescriptor().getMessageTypes().get(1);
139 | internal_static_com_webank_wedpr_scd_proto_StringToStringPair_fieldAccessorTable =
140 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
141 | internal_static_com_webank_wedpr_scd_proto_StringToStringPair_descriptor,
142 | new String[] {
143 | "Key", "Value",
144 | });
145 | internal_static_com_webank_wedpr_scd_proto_CertificateTemplate_descriptor =
146 | getDescriptor().getMessageTypes().get(2);
147 | internal_static_com_webank_wedpr_scd_proto_CertificateTemplate_fieldAccessorTable =
148 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
149 | internal_static_com_webank_wedpr_scd_proto_CertificateTemplate_descriptor,
150 | new String[] {
151 | "CertificateSchema", "TemplateCorrectnessProof", "TemplatePublicKey",
152 | });
153 | internal_static_com_webank_wedpr_scd_proto_TemplatePublicKey_descriptor =
154 | getDescriptor().getMessageTypes().get(3);
155 | internal_static_com_webank_wedpr_scd_proto_TemplatePublicKey_fieldAccessorTable =
156 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
157 | internal_static_com_webank_wedpr_scd_proto_TemplatePublicKey_descriptor,
158 | new String[] {
159 | "Key",
160 | });
161 | internal_static_com_webank_wedpr_scd_proto_TemplatePrivateKey_descriptor =
162 | getDescriptor().getMessageTypes().get(4);
163 | internal_static_com_webank_wedpr_scd_proto_TemplatePrivateKey_fieldAccessorTable =
164 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
165 | internal_static_com_webank_wedpr_scd_proto_TemplatePrivateKey_descriptor,
166 | new String[] {
167 | "Key",
168 | });
169 | internal_static_com_webank_wedpr_scd_proto_AttributeDict_descriptor =
170 | getDescriptor().getMessageTypes().get(5);
171 | internal_static_com_webank_wedpr_scd_proto_AttributeDict_fieldAccessorTable =
172 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
173 | internal_static_com_webank_wedpr_scd_proto_AttributeDict_descriptor,
174 | new String[] {
175 | "Pair",
176 | });
177 | internal_static_com_webank_wedpr_scd_proto_BlindedCertificateSecret_descriptor =
178 | getDescriptor().getMessageTypes().get(6);
179 | internal_static_com_webank_wedpr_scd_proto_BlindedCertificateSecret_fieldAccessorTable =
180 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
181 | internal_static_com_webank_wedpr_scd_proto_BlindedCertificateSecret_descriptor,
182 | new String[] {
183 | "BlindedCertificateSecrets", "BlindedCertificateSecretsCorrectnessProof",
184 | });
185 | internal_static_com_webank_wedpr_scd_proto_CertificateSignature_descriptor =
186 | getDescriptor().getMessageTypes().get(7);
187 | internal_static_com_webank_wedpr_scd_proto_CertificateSignature_fieldAccessorTable =
188 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
189 | internal_static_com_webank_wedpr_scd_proto_CertificateSignature_descriptor,
190 | new String[] {
191 | "CertificateSignature", "SignatureCorrectnessProof",
192 | });
193 | internal_static_com_webank_wedpr_scd_proto_Predicate_descriptor =
194 | getDescriptor().getMessageTypes().get(8);
195 | internal_static_com_webank_wedpr_scd_proto_Predicate_fieldAccessorTable =
196 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
197 | internal_static_com_webank_wedpr_scd_proto_Predicate_descriptor,
198 | new String[] {
199 | "AttributeName", "PredicateType", "PredicateValue",
200 | });
201 | internal_static_com_webank_wedpr_scd_proto_VerificationRuleSet_descriptor =
202 | getDescriptor().getMessageTypes().get(9);
203 | internal_static_com_webank_wedpr_scd_proto_VerificationRuleSet_fieldAccessorTable =
204 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
205 | internal_static_com_webank_wedpr_scd_proto_VerificationRuleSet_descriptor,
206 | new String[] {
207 | "RevealedAttributeName", "AttributePredicate",
208 | });
209 | internal_static_com_webank_wedpr_scd_proto_SignCertificateRequest_descriptor =
210 | getDescriptor().getMessageTypes().get(10);
211 | internal_static_com_webank_wedpr_scd_proto_SignCertificateRequest_fieldAccessorTable =
212 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
213 | internal_static_com_webank_wedpr_scd_proto_SignCertificateRequest_descriptor,
214 | new String[] {
215 | "CertificateAttributeDict",
216 | "BlindedCertificateSecrets",
217 | "BlindedCertificateSecretsCorrectnessProof",
218 | });
219 | internal_static_com_webank_wedpr_scd_proto_VerifyRequest_descriptor =
220 | getDescriptor().getMessageTypes().get(11);
221 | internal_static_com_webank_wedpr_scd_proto_VerifyRequest_fieldAccessorTable =
222 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
223 | internal_static_com_webank_wedpr_scd_proto_VerifyRequest_descriptor,
224 | new String[] {
225 | "CertificateTemplate", "VerificationProof", "VerificationNonce",
226 | });
227 | internal_static_com_webank_wedpr_scd_proto_ScdResult_descriptor =
228 | getDescriptor().getMessageTypes().get(12);
229 | internal_static_com_webank_wedpr_scd_proto_ScdResult_fieldAccessorTable =
230 | new com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
231 | internal_static_com_webank_wedpr_scd_proto_ScdResult_descriptor,
232 | new String[] {
233 | "CertificateTemplate",
234 | "TemplatePrivateKey",
235 | "IssuerNonce",
236 | "CertificateSignature",
237 | "UserNonce",
238 | "SignCertificateRequest",
239 | "UserPrivateKey",
240 | "CertificateSecretsBlindingFactors",
241 | "VerificationNonce",
242 | "VerifyRequest",
243 | "RevealedAttributeDict",
244 | "BoolResult",
245 | });
246 | }
247 |
248 | // @@protoc_insertion_point(outer_class_scope)
249 | }
250 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/ScdResultOrBuilder.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | public interface ScdResultOrBuilder
7 | extends
8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.ScdResult)
9 | com.google.protobuf.MessageOrBuilder {
10 |
11 | /**
12 | *
13 | *
14 | *
15 | * Used by the issuer.
16 | *
17 | *
18 | * .com.webank.wedpr.scd.proto.CertificateTemplate certificate_template = 1;
19 | */
20 | boolean hasCertificateTemplate();
21 | /**
22 | *
23 | *
24 | *
25 | * Used by the issuer.
26 | *
27 | *
28 | * .com.webank.wedpr.scd.proto.CertificateTemplate certificate_template = 1;
29 | */
30 | com.webank.wedpr.scd.proto.CertificateTemplate getCertificateTemplate();
31 | /**
32 | *
33 | *
34 | *
35 | * Used by the issuer.
36 | *
37 | *
38 | * .com.webank.wedpr.scd.proto.CertificateTemplate certificate_template = 1;
39 | */
40 | com.webank.wedpr.scd.proto.CertificateTemplateOrBuilder getCertificateTemplateOrBuilder();
41 |
42 | /** .com.webank.wedpr.scd.proto.TemplatePrivateKey template_private_key = 2;
*/
43 | boolean hasTemplatePrivateKey();
44 | /** .com.webank.wedpr.scd.proto.TemplatePrivateKey template_private_key = 2;
*/
45 | com.webank.wedpr.scd.proto.TemplatePrivateKey getTemplatePrivateKey();
46 | /** .com.webank.wedpr.scd.proto.TemplatePrivateKey template_private_key = 2;
*/
47 | com.webank.wedpr.scd.proto.TemplatePrivateKeyOrBuilder getTemplatePrivateKeyOrBuilder();
48 |
49 | /** string issuer_nonce = 3;
*/
50 | String getIssuerNonce();
51 | /** string issuer_nonce = 3;
*/
52 | com.google.protobuf.ByteString getIssuerNonceBytes();
53 |
54 | /**
55 | *
56 | *
57 | *
58 | * Used by the user.
59 | *
60 | *
61 | * .com.webank.wedpr.scd.proto.CertificateSignature certificate_signature = 4;
62 | */
63 | boolean hasCertificateSignature();
64 | /**
65 | *
66 | *
67 | *
68 | * Used by the user.
69 | *
70 | *
71 | * .com.webank.wedpr.scd.proto.CertificateSignature certificate_signature = 4;
72 | */
73 | com.webank.wedpr.scd.proto.CertificateSignature getCertificateSignature();
74 | /**
75 | *
76 | *
77 | *
78 | * Used by the user.
79 | *
80 | *
81 | * .com.webank.wedpr.scd.proto.CertificateSignature certificate_signature = 4;
82 | */
83 | com.webank.wedpr.scd.proto.CertificateSignatureOrBuilder getCertificateSignatureOrBuilder();
84 |
85 | /** string user_nonce = 5;
*/
86 | String getUserNonce();
87 | /** string user_nonce = 5;
*/
88 | com.google.protobuf.ByteString getUserNonceBytes();
89 |
90 | /**
91 | * .com.webank.wedpr.scd.proto.SignCertificateRequest sign_certificate_request = 6;
92 | */
93 | boolean hasSignCertificateRequest();
94 | /**
95 | * .com.webank.wedpr.scd.proto.SignCertificateRequest sign_certificate_request = 6;
96 | */
97 | com.webank.wedpr.scd.proto.SignCertificateRequest getSignCertificateRequest();
98 | /**
99 | * .com.webank.wedpr.scd.proto.SignCertificateRequest sign_certificate_request = 6;
100 | */
101 | com.webank.wedpr.scd.proto.SignCertificateRequestOrBuilder getSignCertificateRequestOrBuilder();
102 |
103 | /** string user_private_key = 7;
*/
104 | String getUserPrivateKey();
105 | /** string user_private_key = 7;
*/
106 | com.google.protobuf.ByteString getUserPrivateKeyBytes();
107 |
108 | /** string certificate_secrets_blinding_factors = 8;
*/
109 | String getCertificateSecretsBlindingFactors();
110 | /** string certificate_secrets_blinding_factors = 8;
*/
111 | com.google.protobuf.ByteString getCertificateSecretsBlindingFactorsBytes();
112 |
113 | /**
114 | *
115 | *
116 | *
117 | * Used by the verifier.
118 | *
119 | *
120 | * string verification_nonce = 9;
121 | */
122 | String getVerificationNonce();
123 | /**
124 | *
125 | *
126 | *
127 | * Used by the verifier.
128 | *
129 | *
130 | * string verification_nonce = 9;
131 | */
132 | com.google.protobuf.ByteString getVerificationNonceBytes();
133 |
134 | /** .com.webank.wedpr.scd.proto.VerifyRequest verify_request = 10;
*/
135 | boolean hasVerifyRequest();
136 | /** .com.webank.wedpr.scd.proto.VerifyRequest verify_request = 10;
*/
137 | com.webank.wedpr.scd.proto.VerifyRequest getVerifyRequest();
138 | /** .com.webank.wedpr.scd.proto.VerifyRequest verify_request = 10;
*/
139 | com.webank.wedpr.scd.proto.VerifyRequestOrBuilder getVerifyRequestOrBuilder();
140 |
141 | /** .com.webank.wedpr.scd.proto.AttributeDict revealed_attribute_dict = 11;
*/
142 | boolean hasRevealedAttributeDict();
143 | /** .com.webank.wedpr.scd.proto.AttributeDict revealed_attribute_dict = 11;
*/
144 | com.webank.wedpr.scd.proto.AttributeDict getRevealedAttributeDict();
145 | /** .com.webank.wedpr.scd.proto.AttributeDict revealed_attribute_dict = 11;
*/
146 | com.webank.wedpr.scd.proto.AttributeDictOrBuilder getRevealedAttributeDictOrBuilder();
147 |
148 | /** bool bool_result = 12;
*/
149 | boolean getBoolResult();
150 | }
151 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/SignCertificateRequestOrBuilder.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | public interface SignCertificateRequestOrBuilder
7 | extends
8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.SignCertificateRequest)
9 | com.google.protobuf.MessageOrBuilder {
10 |
11 | /** .com.webank.wedpr.scd.proto.AttributeDict certificate_attribute_dict = 1;
*/
12 | boolean hasCertificateAttributeDict();
13 | /** .com.webank.wedpr.scd.proto.AttributeDict certificate_attribute_dict = 1;
*/
14 | com.webank.wedpr.scd.proto.AttributeDict getCertificateAttributeDict();
15 | /** .com.webank.wedpr.scd.proto.AttributeDict certificate_attribute_dict = 1;
*/
16 | com.webank.wedpr.scd.proto.AttributeDictOrBuilder getCertificateAttributeDictOrBuilder();
17 |
18 | /** string blinded_certificate_secrets = 2;
*/
19 | String getBlindedCertificateSecrets();
20 | /** string blinded_certificate_secrets = 2;
*/
21 | com.google.protobuf.ByteString getBlindedCertificateSecretsBytes();
22 |
23 | /** string blinded_certificate_secrets_correctness_proof = 3;
*/
24 | String getBlindedCertificateSecretsCorrectnessProof();
25 | /** string blinded_certificate_secrets_correctness_proof = 3;
*/
26 | com.google.protobuf.ByteString getBlindedCertificateSecretsCorrectnessProofBytes();
27 | }
28 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/StringToStringPair.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | /**
7 | *
8 | *
9 | *
10 | * String to string mapping pairs.
11 | *
12 | *
13 | * Protobuf type {@code com.webank.wedpr.scd.proto.StringToStringPair}
14 | */
15 | public final class StringToStringPair extends com.google.protobuf.GeneratedMessageV3
16 | implements
17 | // @@protoc_insertion_point(message_implements:com.webank.wedpr.scd.proto.StringToStringPair)
18 | StringToStringPairOrBuilder {
19 | private static final long serialVersionUID = 0L;
20 | // Use StringToStringPair.newBuilder() to construct.
21 | private StringToStringPair(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
22 | super(builder);
23 | }
24 |
25 | private StringToStringPair() {
26 | key_ = "";
27 | value_ = "";
28 | }
29 |
30 | @Override
31 | @SuppressWarnings({"unused"})
32 | protected Object newInstance(UnusedPrivateParameter unused) {
33 | return new StringToStringPair();
34 | }
35 |
36 | @Override
37 | public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
38 | return this.unknownFields;
39 | }
40 |
41 | private StringToStringPair(
42 | com.google.protobuf.CodedInputStream input,
43 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
44 | throws com.google.protobuf.InvalidProtocolBufferException {
45 | this();
46 | if (extensionRegistry == null) {
47 | throw new NullPointerException();
48 | }
49 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
50 | com.google.protobuf.UnknownFieldSet.newBuilder();
51 | try {
52 | boolean done = false;
53 | while (!done) {
54 | int tag = input.readTag();
55 | switch (tag) {
56 | case 0:
57 | done = true;
58 | break;
59 | case 10:
60 | {
61 | String s = input.readStringRequireUtf8();
62 |
63 | key_ = s;
64 | break;
65 | }
66 | case 18:
67 | {
68 | String s = input.readStringRequireUtf8();
69 |
70 | value_ = s;
71 | break;
72 | }
73 | default:
74 | {
75 | if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
76 | done = true;
77 | }
78 | break;
79 | }
80 | }
81 | }
82 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
83 | throw e.setUnfinishedMessage(this);
84 | } catch (java.io.IOException e) {
85 | throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
86 | } finally {
87 | this.unknownFields = unknownFields.build();
88 | makeExtensionsImmutable();
89 | }
90 | }
91 |
92 | public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
93 | return com.webank.wedpr.scd.proto.Scd
94 | .internal_static_com_webank_wedpr_scd_proto_StringToStringPair_descriptor;
95 | }
96 |
97 | @Override
98 | protected FieldAccessorTable internalGetFieldAccessorTable() {
99 | return com.webank.wedpr.scd.proto.Scd
100 | .internal_static_com_webank_wedpr_scd_proto_StringToStringPair_fieldAccessorTable
101 | .ensureFieldAccessorsInitialized(
102 | com.webank.wedpr.scd.proto.StringToStringPair.class,
103 | com.webank.wedpr.scd.proto.StringToStringPair.Builder.class);
104 | }
105 |
106 | public static final int KEY_FIELD_NUMBER = 1;
107 | private volatile Object key_;
108 | /** string key = 1;
*/
109 | public String getKey() {
110 | Object ref = key_;
111 | if (ref instanceof String) {
112 | return (String) ref;
113 | } else {
114 | com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
115 | String s = bs.toStringUtf8();
116 | key_ = s;
117 | return s;
118 | }
119 | }
120 | /** string key = 1;
*/
121 | public com.google.protobuf.ByteString getKeyBytes() {
122 | Object ref = key_;
123 | if (ref instanceof String) {
124 | com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref);
125 | key_ = b;
126 | return b;
127 | } else {
128 | return (com.google.protobuf.ByteString) ref;
129 | }
130 | }
131 |
132 | public static final int VALUE_FIELD_NUMBER = 2;
133 | private volatile Object value_;
134 | /** string value = 2;
*/
135 | public String getValue() {
136 | Object ref = value_;
137 | if (ref instanceof String) {
138 | return (String) ref;
139 | } else {
140 | com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
141 | String s = bs.toStringUtf8();
142 | value_ = s;
143 | return s;
144 | }
145 | }
146 | /** string value = 2;
*/
147 | public com.google.protobuf.ByteString getValueBytes() {
148 | Object ref = value_;
149 | if (ref instanceof String) {
150 | com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref);
151 | value_ = b;
152 | return b;
153 | } else {
154 | return (com.google.protobuf.ByteString) ref;
155 | }
156 | }
157 |
158 | private byte memoizedIsInitialized = -1;
159 |
160 | @Override
161 | public final boolean isInitialized() {
162 | byte isInitialized = memoizedIsInitialized;
163 | if (isInitialized == 1) return true;
164 | if (isInitialized == 0) return false;
165 |
166 | memoizedIsInitialized = 1;
167 | return true;
168 | }
169 |
170 | @Override
171 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
172 | if (!getKeyBytes().isEmpty()) {
173 | com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_);
174 | }
175 | if (!getValueBytes().isEmpty()) {
176 | com.google.protobuf.GeneratedMessageV3.writeString(output, 2, value_);
177 | }
178 | unknownFields.writeTo(output);
179 | }
180 |
181 | @Override
182 | public int getSerializedSize() {
183 | int size = memoizedSize;
184 | if (size != -1) return size;
185 |
186 | size = 0;
187 | if (!getKeyBytes().isEmpty()) {
188 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_);
189 | }
190 | if (!getValueBytes().isEmpty()) {
191 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, value_);
192 | }
193 | size += unknownFields.getSerializedSize();
194 | memoizedSize = size;
195 | return size;
196 | }
197 |
198 | @Override
199 | public boolean equals(final Object obj) {
200 | if (obj == this) {
201 | return true;
202 | }
203 | if (!(obj instanceof com.webank.wedpr.scd.proto.StringToStringPair)) {
204 | return super.equals(obj);
205 | }
206 | com.webank.wedpr.scd.proto.StringToStringPair other =
207 | (com.webank.wedpr.scd.proto.StringToStringPair) obj;
208 |
209 | if (!getKey().equals(other.getKey())) return false;
210 | if (!getValue().equals(other.getValue())) return false;
211 | if (!unknownFields.equals(other.unknownFields)) return false;
212 | return true;
213 | }
214 |
215 | @Override
216 | public int hashCode() {
217 | if (memoizedHashCode != 0) {
218 | return memoizedHashCode;
219 | }
220 | int hash = 41;
221 | hash = (19 * hash) + getDescriptor().hashCode();
222 | hash = (37 * hash) + KEY_FIELD_NUMBER;
223 | hash = (53 * hash) + getKey().hashCode();
224 | hash = (37 * hash) + VALUE_FIELD_NUMBER;
225 | hash = (53 * hash) + getValue().hashCode();
226 | hash = (29 * hash) + unknownFields.hashCode();
227 | memoizedHashCode = hash;
228 | return hash;
229 | }
230 |
231 | public static com.webank.wedpr.scd.proto.StringToStringPair parseFrom(java.nio.ByteBuffer data)
232 | throws com.google.protobuf.InvalidProtocolBufferException {
233 | return PARSER.parseFrom(data);
234 | }
235 |
236 | public static com.webank.wedpr.scd.proto.StringToStringPair parseFrom(
237 | java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
238 | throws com.google.protobuf.InvalidProtocolBufferException {
239 | return PARSER.parseFrom(data, extensionRegistry);
240 | }
241 |
242 | public static com.webank.wedpr.scd.proto.StringToStringPair parseFrom(
243 | com.google.protobuf.ByteString data)
244 | throws com.google.protobuf.InvalidProtocolBufferException {
245 | return PARSER.parseFrom(data);
246 | }
247 |
248 | public static com.webank.wedpr.scd.proto.StringToStringPair parseFrom(
249 | com.google.protobuf.ByteString data,
250 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
251 | throws com.google.protobuf.InvalidProtocolBufferException {
252 | return PARSER.parseFrom(data, extensionRegistry);
253 | }
254 |
255 | public static com.webank.wedpr.scd.proto.StringToStringPair parseFrom(byte[] data)
256 | throws com.google.protobuf.InvalidProtocolBufferException {
257 | return PARSER.parseFrom(data);
258 | }
259 |
260 | public static com.webank.wedpr.scd.proto.StringToStringPair parseFrom(
261 | byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
262 | throws com.google.protobuf.InvalidProtocolBufferException {
263 | return PARSER.parseFrom(data, extensionRegistry);
264 | }
265 |
266 | public static com.webank.wedpr.scd.proto.StringToStringPair parseFrom(java.io.InputStream input)
267 | throws java.io.IOException {
268 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
269 | }
270 |
271 | public static com.webank.wedpr.scd.proto.StringToStringPair parseFrom(
272 | java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
273 | throws java.io.IOException {
274 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
275 | PARSER, input, extensionRegistry);
276 | }
277 |
278 | public static com.webank.wedpr.scd.proto.StringToStringPair parseDelimitedFrom(
279 | java.io.InputStream input) throws java.io.IOException {
280 | return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
281 | }
282 |
283 | public static com.webank.wedpr.scd.proto.StringToStringPair parseDelimitedFrom(
284 | java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
285 | throws java.io.IOException {
286 | return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
287 | PARSER, input, extensionRegistry);
288 | }
289 |
290 | public static com.webank.wedpr.scd.proto.StringToStringPair parseFrom(
291 | com.google.protobuf.CodedInputStream input) throws java.io.IOException {
292 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
293 | }
294 |
295 | public static com.webank.wedpr.scd.proto.StringToStringPair parseFrom(
296 | com.google.protobuf.CodedInputStream input,
297 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
298 | throws java.io.IOException {
299 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
300 | PARSER, input, extensionRegistry);
301 | }
302 |
303 | @Override
304 | public Builder newBuilderForType() {
305 | return newBuilder();
306 | }
307 |
308 | public static Builder newBuilder() {
309 | return DEFAULT_INSTANCE.toBuilder();
310 | }
311 |
312 | public static Builder newBuilder(com.webank.wedpr.scd.proto.StringToStringPair prototype) {
313 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
314 | }
315 |
316 | @Override
317 | public Builder toBuilder() {
318 | return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
319 | }
320 |
321 | @Override
322 | protected Builder newBuilderForType(BuilderParent parent) {
323 | Builder builder = new Builder(parent);
324 | return builder;
325 | }
326 | /**
327 | *
328 | *
329 | *
330 | * String to string mapping pairs.
331 | *
332 | *
333 | * Protobuf type {@code com.webank.wedpr.scd.proto.StringToStringPair}
334 | */
335 | public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builderstring key = 1;
*/
490 | public String getKey() {
491 | Object ref = key_;
492 | if (!(ref instanceof String)) {
493 | com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
494 | String s = bs.toStringUtf8();
495 | key_ = s;
496 | return s;
497 | } else {
498 | return (String) ref;
499 | }
500 | }
501 | /** string key = 1;
*/
502 | public com.google.protobuf.ByteString getKeyBytes() {
503 | Object ref = key_;
504 | if (ref instanceof String) {
505 | com.google.protobuf.ByteString b =
506 | com.google.protobuf.ByteString.copyFromUtf8((String) ref);
507 | key_ = b;
508 | return b;
509 | } else {
510 | return (com.google.protobuf.ByteString) ref;
511 | }
512 | }
513 | /** string key = 1;
*/
514 | public Builder setKey(String value) {
515 | if (value == null) {
516 | throw new NullPointerException();
517 | }
518 |
519 | key_ = value;
520 | onChanged();
521 | return this;
522 | }
523 | /** string key = 1;
*/
524 | public Builder clearKey() {
525 |
526 | key_ = getDefaultInstance().getKey();
527 | onChanged();
528 | return this;
529 | }
530 | /** string key = 1;
*/
531 | public Builder setKeyBytes(com.google.protobuf.ByteString value) {
532 | if (value == null) {
533 | throw new NullPointerException();
534 | }
535 | checkByteStringIsUtf8(value);
536 |
537 | key_ = value;
538 | onChanged();
539 | return this;
540 | }
541 |
542 | private Object value_ = "";
543 | /** string value = 2;
*/
544 | public String getValue() {
545 | Object ref = value_;
546 | if (!(ref instanceof String)) {
547 | com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
548 | String s = bs.toStringUtf8();
549 | value_ = s;
550 | return s;
551 | } else {
552 | return (String) ref;
553 | }
554 | }
555 | /** string value = 2;
*/
556 | public com.google.protobuf.ByteString getValueBytes() {
557 | Object ref = value_;
558 | if (ref instanceof String) {
559 | com.google.protobuf.ByteString b =
560 | com.google.protobuf.ByteString.copyFromUtf8((String) ref);
561 | value_ = b;
562 | return b;
563 | } else {
564 | return (com.google.protobuf.ByteString) ref;
565 | }
566 | }
567 | /** string value = 2;
*/
568 | public Builder setValue(String value) {
569 | if (value == null) {
570 | throw new NullPointerException();
571 | }
572 |
573 | value_ = value;
574 | onChanged();
575 | return this;
576 | }
577 | /** string value = 2;
*/
578 | public Builder clearValue() {
579 |
580 | value_ = getDefaultInstance().getValue();
581 | onChanged();
582 | return this;
583 | }
584 | /** string value = 2;
*/
585 | public Builder setValueBytes(com.google.protobuf.ByteString value) {
586 | if (value == null) {
587 | throw new NullPointerException();
588 | }
589 | checkByteStringIsUtf8(value);
590 |
591 | value_ = value;
592 | onChanged();
593 | return this;
594 | }
595 |
596 | @Override
597 | public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
598 | return super.setUnknownFields(unknownFields);
599 | }
600 |
601 | @Override
602 | public final Builder mergeUnknownFields(
603 | final com.google.protobuf.UnknownFieldSet unknownFields) {
604 | return super.mergeUnknownFields(unknownFields);
605 | }
606 |
607 | // @@protoc_insertion_point(builder_scope:com.webank.wedpr.scd.proto.StringToStringPair)
608 | }
609 |
610 | // @@protoc_insertion_point(class_scope:com.webank.wedpr.scd.proto.StringToStringPair)
611 | private static final com.webank.wedpr.scd.proto.StringToStringPair DEFAULT_INSTANCE;
612 |
613 | static {
614 | DEFAULT_INSTANCE = new com.webank.wedpr.scd.proto.StringToStringPair();
615 | }
616 |
617 | public static com.webank.wedpr.scd.proto.StringToStringPair getDefaultInstance() {
618 | return DEFAULT_INSTANCE;
619 | }
620 |
621 | private static final com.google.protobuf.Parserstring key = 1;
*/
12 | String getKey();
13 | /** string key = 1;
*/
14 | com.google.protobuf.ByteString getKeyBytes();
15 |
16 | /** string value = 2;
*/
17 | String getValue();
18 | /** string value = 2;
*/
19 | com.google.protobuf.ByteString getValueBytes();
20 | }
21 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/TemplatePrivateKey.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | /**
7 | *
8 | *
9 | *
10 | * Template private key.
11 | *
12 | *
13 | * Protobuf type {@code com.webank.wedpr.scd.proto.TemplatePrivateKey}
14 | */
15 | public final class TemplatePrivateKey extends com.google.protobuf.GeneratedMessageV3
16 | implements
17 | // @@protoc_insertion_point(message_implements:com.webank.wedpr.scd.proto.TemplatePrivateKey)
18 | TemplatePrivateKeyOrBuilder {
19 | private static final long serialVersionUID = 0L;
20 | // Use TemplatePrivateKey.newBuilder() to construct.
21 | private TemplatePrivateKey(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
22 | super(builder);
23 | }
24 |
25 | private TemplatePrivateKey() {
26 | key_ = "";
27 | }
28 |
29 | @Override
30 | @SuppressWarnings({"unused"})
31 | protected Object newInstance(UnusedPrivateParameter unused) {
32 | return new TemplatePrivateKey();
33 | }
34 |
35 | @Override
36 | public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
37 | return this.unknownFields;
38 | }
39 |
40 | private TemplatePrivateKey(
41 | com.google.protobuf.CodedInputStream input,
42 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
43 | throws com.google.protobuf.InvalidProtocolBufferException {
44 | this();
45 | if (extensionRegistry == null) {
46 | throw new NullPointerException();
47 | }
48 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
49 | com.google.protobuf.UnknownFieldSet.newBuilder();
50 | try {
51 | boolean done = false;
52 | while (!done) {
53 | int tag = input.readTag();
54 | switch (tag) {
55 | case 0:
56 | done = true;
57 | break;
58 | case 10:
59 | {
60 | String s = input.readStringRequireUtf8();
61 |
62 | key_ = s;
63 | break;
64 | }
65 | default:
66 | {
67 | if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
68 | done = true;
69 | }
70 | break;
71 | }
72 | }
73 | }
74 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
75 | throw e.setUnfinishedMessage(this);
76 | } catch (java.io.IOException e) {
77 | throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
78 | } finally {
79 | this.unknownFields = unknownFields.build();
80 | makeExtensionsImmutable();
81 | }
82 | }
83 |
84 | public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
85 | return com.webank.wedpr.scd.proto.Scd
86 | .internal_static_com_webank_wedpr_scd_proto_TemplatePrivateKey_descriptor;
87 | }
88 |
89 | @Override
90 | protected FieldAccessorTable internalGetFieldAccessorTable() {
91 | return com.webank.wedpr.scd.proto.Scd
92 | .internal_static_com_webank_wedpr_scd_proto_TemplatePrivateKey_fieldAccessorTable
93 | .ensureFieldAccessorsInitialized(
94 | com.webank.wedpr.scd.proto.TemplatePrivateKey.class,
95 | com.webank.wedpr.scd.proto.TemplatePrivateKey.Builder.class);
96 | }
97 |
98 | public static final int KEY_FIELD_NUMBER = 1;
99 | private volatile Object key_;
100 | /** string key = 1;
*/
101 | public String getKey() {
102 | Object ref = key_;
103 | if (ref instanceof String) {
104 | return (String) ref;
105 | } else {
106 | com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
107 | String s = bs.toStringUtf8();
108 | key_ = s;
109 | return s;
110 | }
111 | }
112 | /** string key = 1;
*/
113 | public com.google.protobuf.ByteString getKeyBytes() {
114 | Object ref = key_;
115 | if (ref instanceof String) {
116 | com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref);
117 | key_ = b;
118 | return b;
119 | } else {
120 | return (com.google.protobuf.ByteString) ref;
121 | }
122 | }
123 |
124 | private byte memoizedIsInitialized = -1;
125 |
126 | @Override
127 | public final boolean isInitialized() {
128 | byte isInitialized = memoizedIsInitialized;
129 | if (isInitialized == 1) return true;
130 | if (isInitialized == 0) return false;
131 |
132 | memoizedIsInitialized = 1;
133 | return true;
134 | }
135 |
136 | @Override
137 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
138 | if (!getKeyBytes().isEmpty()) {
139 | com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_);
140 | }
141 | unknownFields.writeTo(output);
142 | }
143 |
144 | @Override
145 | public int getSerializedSize() {
146 | int size = memoizedSize;
147 | if (size != -1) return size;
148 |
149 | size = 0;
150 | if (!getKeyBytes().isEmpty()) {
151 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_);
152 | }
153 | size += unknownFields.getSerializedSize();
154 | memoizedSize = size;
155 | return size;
156 | }
157 |
158 | @Override
159 | public boolean equals(final Object obj) {
160 | if (obj == this) {
161 | return true;
162 | }
163 | if (!(obj instanceof com.webank.wedpr.scd.proto.TemplatePrivateKey)) {
164 | return super.equals(obj);
165 | }
166 | com.webank.wedpr.scd.proto.TemplatePrivateKey other =
167 | (com.webank.wedpr.scd.proto.TemplatePrivateKey) obj;
168 |
169 | if (!getKey().equals(other.getKey())) return false;
170 | if (!unknownFields.equals(other.unknownFields)) return false;
171 | return true;
172 | }
173 |
174 | @Override
175 | public int hashCode() {
176 | if (memoizedHashCode != 0) {
177 | return memoizedHashCode;
178 | }
179 | int hash = 41;
180 | hash = (19 * hash) + getDescriptor().hashCode();
181 | hash = (37 * hash) + KEY_FIELD_NUMBER;
182 | hash = (53 * hash) + getKey().hashCode();
183 | hash = (29 * hash) + unknownFields.hashCode();
184 | memoizedHashCode = hash;
185 | return hash;
186 | }
187 |
188 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseFrom(java.nio.ByteBuffer data)
189 | throws com.google.protobuf.InvalidProtocolBufferException {
190 | return PARSER.parseFrom(data);
191 | }
192 |
193 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseFrom(
194 | java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
195 | throws com.google.protobuf.InvalidProtocolBufferException {
196 | return PARSER.parseFrom(data, extensionRegistry);
197 | }
198 |
199 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseFrom(
200 | com.google.protobuf.ByteString data)
201 | throws com.google.protobuf.InvalidProtocolBufferException {
202 | return PARSER.parseFrom(data);
203 | }
204 |
205 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseFrom(
206 | com.google.protobuf.ByteString data,
207 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
208 | throws com.google.protobuf.InvalidProtocolBufferException {
209 | return PARSER.parseFrom(data, extensionRegistry);
210 | }
211 |
212 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseFrom(byte[] data)
213 | throws com.google.protobuf.InvalidProtocolBufferException {
214 | return PARSER.parseFrom(data);
215 | }
216 |
217 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseFrom(
218 | byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
219 | throws com.google.protobuf.InvalidProtocolBufferException {
220 | return PARSER.parseFrom(data, extensionRegistry);
221 | }
222 |
223 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseFrom(java.io.InputStream input)
224 | throws java.io.IOException {
225 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
226 | }
227 |
228 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseFrom(
229 | java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
230 | throws java.io.IOException {
231 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
232 | PARSER, input, extensionRegistry);
233 | }
234 |
235 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseDelimitedFrom(
236 | java.io.InputStream input) throws java.io.IOException {
237 | return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
238 | }
239 |
240 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseDelimitedFrom(
241 | java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
242 | throws java.io.IOException {
243 | return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
244 | PARSER, input, extensionRegistry);
245 | }
246 |
247 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseFrom(
248 | com.google.protobuf.CodedInputStream input) throws java.io.IOException {
249 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
250 | }
251 |
252 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey parseFrom(
253 | com.google.protobuf.CodedInputStream input,
254 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
255 | throws java.io.IOException {
256 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
257 | PARSER, input, extensionRegistry);
258 | }
259 |
260 | @Override
261 | public Builder newBuilderForType() {
262 | return newBuilder();
263 | }
264 |
265 | public static Builder newBuilder() {
266 | return DEFAULT_INSTANCE.toBuilder();
267 | }
268 |
269 | public static Builder newBuilder(com.webank.wedpr.scd.proto.TemplatePrivateKey prototype) {
270 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
271 | }
272 |
273 | @Override
274 | public Builder toBuilder() {
275 | return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
276 | }
277 |
278 | @Override
279 | protected Builder newBuilderForType(BuilderParent parent) {
280 | Builder builder = new Builder(parent);
281 | return builder;
282 | }
283 | /**
284 | *
285 | *
286 | *
287 | * Template private key.
288 | *
289 | *
290 | * Protobuf type {@code com.webank.wedpr.scd.proto.TemplatePrivateKey}
291 | */
292 | public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builderstring key = 1;
*/
440 | public String getKey() {
441 | Object ref = key_;
442 | if (!(ref instanceof String)) {
443 | com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
444 | String s = bs.toStringUtf8();
445 | key_ = s;
446 | return s;
447 | } else {
448 | return (String) ref;
449 | }
450 | }
451 | /** string key = 1;
*/
452 | public com.google.protobuf.ByteString getKeyBytes() {
453 | Object ref = key_;
454 | if (ref instanceof String) {
455 | com.google.protobuf.ByteString b =
456 | com.google.protobuf.ByteString.copyFromUtf8((String) ref);
457 | key_ = b;
458 | return b;
459 | } else {
460 | return (com.google.protobuf.ByteString) ref;
461 | }
462 | }
463 | /** string key = 1;
*/
464 | public Builder setKey(String value) {
465 | if (value == null) {
466 | throw new NullPointerException();
467 | }
468 |
469 | key_ = value;
470 | onChanged();
471 | return this;
472 | }
473 | /** string key = 1;
*/
474 | public Builder clearKey() {
475 |
476 | key_ = getDefaultInstance().getKey();
477 | onChanged();
478 | return this;
479 | }
480 | /** string key = 1;
*/
481 | public Builder setKeyBytes(com.google.protobuf.ByteString value) {
482 | if (value == null) {
483 | throw new NullPointerException();
484 | }
485 | checkByteStringIsUtf8(value);
486 |
487 | key_ = value;
488 | onChanged();
489 | return this;
490 | }
491 |
492 | @Override
493 | public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
494 | return super.setUnknownFields(unknownFields);
495 | }
496 |
497 | @Override
498 | public final Builder mergeUnknownFields(
499 | final com.google.protobuf.UnknownFieldSet unknownFields) {
500 | return super.mergeUnknownFields(unknownFields);
501 | }
502 |
503 | // @@protoc_insertion_point(builder_scope:com.webank.wedpr.scd.proto.TemplatePrivateKey)
504 | }
505 |
506 | // @@protoc_insertion_point(class_scope:com.webank.wedpr.scd.proto.TemplatePrivateKey)
507 | private static final com.webank.wedpr.scd.proto.TemplatePrivateKey DEFAULT_INSTANCE;
508 |
509 | static {
510 | DEFAULT_INSTANCE = new com.webank.wedpr.scd.proto.TemplatePrivateKey();
511 | }
512 |
513 | public static com.webank.wedpr.scd.proto.TemplatePrivateKey getDefaultInstance() {
514 | return DEFAULT_INSTANCE;
515 | }
516 |
517 | private static final com.google.protobuf.Parserstring key = 1;
*/
12 | String getKey();
13 | /** string key = 1;
*/
14 | com.google.protobuf.ByteString getKeyBytes();
15 | }
16 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/TemplatePublicKey.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | /**
7 | *
8 | *
9 | *
10 | * Template public key.
11 | *
12 | *
13 | * Protobuf type {@code com.webank.wedpr.scd.proto.TemplatePublicKey}
14 | */
15 | public final class TemplatePublicKey extends com.google.protobuf.GeneratedMessageV3
16 | implements
17 | // @@protoc_insertion_point(message_implements:com.webank.wedpr.scd.proto.TemplatePublicKey)
18 | TemplatePublicKeyOrBuilder {
19 | private static final long serialVersionUID = 0L;
20 | // Use TemplatePublicKey.newBuilder() to construct.
21 | private TemplatePublicKey(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
22 | super(builder);
23 | }
24 |
25 | private TemplatePublicKey() {
26 | key_ = "";
27 | }
28 |
29 | @Override
30 | @SuppressWarnings({"unused"})
31 | protected Object newInstance(UnusedPrivateParameter unused) {
32 | return new TemplatePublicKey();
33 | }
34 |
35 | @Override
36 | public final com.google.protobuf.UnknownFieldSet getUnknownFields() {
37 | return this.unknownFields;
38 | }
39 |
40 | private TemplatePublicKey(
41 | com.google.protobuf.CodedInputStream input,
42 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
43 | throws com.google.protobuf.InvalidProtocolBufferException {
44 | this();
45 | if (extensionRegistry == null) {
46 | throw new NullPointerException();
47 | }
48 | com.google.protobuf.UnknownFieldSet.Builder unknownFields =
49 | com.google.protobuf.UnknownFieldSet.newBuilder();
50 | try {
51 | boolean done = false;
52 | while (!done) {
53 | int tag = input.readTag();
54 | switch (tag) {
55 | case 0:
56 | done = true;
57 | break;
58 | case 10:
59 | {
60 | String s = input.readStringRequireUtf8();
61 |
62 | key_ = s;
63 | break;
64 | }
65 | default:
66 | {
67 | if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) {
68 | done = true;
69 | }
70 | break;
71 | }
72 | }
73 | }
74 | } catch (com.google.protobuf.InvalidProtocolBufferException e) {
75 | throw e.setUnfinishedMessage(this);
76 | } catch (java.io.IOException e) {
77 | throw new com.google.protobuf.InvalidProtocolBufferException(e).setUnfinishedMessage(this);
78 | } finally {
79 | this.unknownFields = unknownFields.build();
80 | makeExtensionsImmutable();
81 | }
82 | }
83 |
84 | public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() {
85 | return com.webank.wedpr.scd.proto.Scd
86 | .internal_static_com_webank_wedpr_scd_proto_TemplatePublicKey_descriptor;
87 | }
88 |
89 | @Override
90 | protected FieldAccessorTable internalGetFieldAccessorTable() {
91 | return com.webank.wedpr.scd.proto.Scd
92 | .internal_static_com_webank_wedpr_scd_proto_TemplatePublicKey_fieldAccessorTable
93 | .ensureFieldAccessorsInitialized(
94 | com.webank.wedpr.scd.proto.TemplatePublicKey.class,
95 | com.webank.wedpr.scd.proto.TemplatePublicKey.Builder.class);
96 | }
97 |
98 | public static final int KEY_FIELD_NUMBER = 1;
99 | private volatile Object key_;
100 | /** string key = 1;
*/
101 | public String getKey() {
102 | Object ref = key_;
103 | if (ref instanceof String) {
104 | return (String) ref;
105 | } else {
106 | com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
107 | String s = bs.toStringUtf8();
108 | key_ = s;
109 | return s;
110 | }
111 | }
112 | /** string key = 1;
*/
113 | public com.google.protobuf.ByteString getKeyBytes() {
114 | Object ref = key_;
115 | if (ref instanceof String) {
116 | com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8((String) ref);
117 | key_ = b;
118 | return b;
119 | } else {
120 | return (com.google.protobuf.ByteString) ref;
121 | }
122 | }
123 |
124 | private byte memoizedIsInitialized = -1;
125 |
126 | @Override
127 | public final boolean isInitialized() {
128 | byte isInitialized = memoizedIsInitialized;
129 | if (isInitialized == 1) return true;
130 | if (isInitialized == 0) return false;
131 |
132 | memoizedIsInitialized = 1;
133 | return true;
134 | }
135 |
136 | @Override
137 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {
138 | if (!getKeyBytes().isEmpty()) {
139 | com.google.protobuf.GeneratedMessageV3.writeString(output, 1, key_);
140 | }
141 | unknownFields.writeTo(output);
142 | }
143 |
144 | @Override
145 | public int getSerializedSize() {
146 | int size = memoizedSize;
147 | if (size != -1) return size;
148 |
149 | size = 0;
150 | if (!getKeyBytes().isEmpty()) {
151 | size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, key_);
152 | }
153 | size += unknownFields.getSerializedSize();
154 | memoizedSize = size;
155 | return size;
156 | }
157 |
158 | @Override
159 | public boolean equals(final Object obj) {
160 | if (obj == this) {
161 | return true;
162 | }
163 | if (!(obj instanceof com.webank.wedpr.scd.proto.TemplatePublicKey)) {
164 | return super.equals(obj);
165 | }
166 | com.webank.wedpr.scd.proto.TemplatePublicKey other =
167 | (com.webank.wedpr.scd.proto.TemplatePublicKey) obj;
168 |
169 | if (!getKey().equals(other.getKey())) return false;
170 | if (!unknownFields.equals(other.unknownFields)) return false;
171 | return true;
172 | }
173 |
174 | @Override
175 | public int hashCode() {
176 | if (memoizedHashCode != 0) {
177 | return memoizedHashCode;
178 | }
179 | int hash = 41;
180 | hash = (19 * hash) + getDescriptor().hashCode();
181 | hash = (37 * hash) + KEY_FIELD_NUMBER;
182 | hash = (53 * hash) + getKey().hashCode();
183 | hash = (29 * hash) + unknownFields.hashCode();
184 | memoizedHashCode = hash;
185 | return hash;
186 | }
187 |
188 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseFrom(java.nio.ByteBuffer data)
189 | throws com.google.protobuf.InvalidProtocolBufferException {
190 | return PARSER.parseFrom(data);
191 | }
192 |
193 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseFrom(
194 | java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
195 | throws com.google.protobuf.InvalidProtocolBufferException {
196 | return PARSER.parseFrom(data, extensionRegistry);
197 | }
198 |
199 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseFrom(
200 | com.google.protobuf.ByteString data)
201 | throws com.google.protobuf.InvalidProtocolBufferException {
202 | return PARSER.parseFrom(data);
203 | }
204 |
205 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseFrom(
206 | com.google.protobuf.ByteString data,
207 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
208 | throws com.google.protobuf.InvalidProtocolBufferException {
209 | return PARSER.parseFrom(data, extensionRegistry);
210 | }
211 |
212 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseFrom(byte[] data)
213 | throws com.google.protobuf.InvalidProtocolBufferException {
214 | return PARSER.parseFrom(data);
215 | }
216 |
217 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseFrom(
218 | byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
219 | throws com.google.protobuf.InvalidProtocolBufferException {
220 | return PARSER.parseFrom(data, extensionRegistry);
221 | }
222 |
223 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseFrom(java.io.InputStream input)
224 | throws java.io.IOException {
225 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
226 | }
227 |
228 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseFrom(
229 | java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
230 | throws java.io.IOException {
231 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
232 | PARSER, input, extensionRegistry);
233 | }
234 |
235 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseDelimitedFrom(
236 | java.io.InputStream input) throws java.io.IOException {
237 | return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input);
238 | }
239 |
240 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseDelimitedFrom(
241 | java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)
242 | throws java.io.IOException {
243 | return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(
244 | PARSER, input, extensionRegistry);
245 | }
246 |
247 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseFrom(
248 | com.google.protobuf.CodedInputStream input) throws java.io.IOException {
249 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input);
250 | }
251 |
252 | public static com.webank.wedpr.scd.proto.TemplatePublicKey parseFrom(
253 | com.google.protobuf.CodedInputStream input,
254 | com.google.protobuf.ExtensionRegistryLite extensionRegistry)
255 | throws java.io.IOException {
256 | return com.google.protobuf.GeneratedMessageV3.parseWithIOException(
257 | PARSER, input, extensionRegistry);
258 | }
259 |
260 | @Override
261 | public Builder newBuilderForType() {
262 | return newBuilder();
263 | }
264 |
265 | public static Builder newBuilder() {
266 | return DEFAULT_INSTANCE.toBuilder();
267 | }
268 |
269 | public static Builder newBuilder(com.webank.wedpr.scd.proto.TemplatePublicKey prototype) {
270 | return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
271 | }
272 |
273 | @Override
274 | public Builder toBuilder() {
275 | return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this);
276 | }
277 |
278 | @Override
279 | protected Builder newBuilderForType(BuilderParent parent) {
280 | Builder builder = new Builder(parent);
281 | return builder;
282 | }
283 | /**
284 | *
285 | *
286 | *
287 | * Template public key.
288 | *
289 | *
290 | * Protobuf type {@code com.webank.wedpr.scd.proto.TemplatePublicKey}
291 | */
292 | public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builderstring key = 1;
*/
440 | public String getKey() {
441 | Object ref = key_;
442 | if (!(ref instanceof String)) {
443 | com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
444 | String s = bs.toStringUtf8();
445 | key_ = s;
446 | return s;
447 | } else {
448 | return (String) ref;
449 | }
450 | }
451 | /** string key = 1;
*/
452 | public com.google.protobuf.ByteString getKeyBytes() {
453 | Object ref = key_;
454 | if (ref instanceof String) {
455 | com.google.protobuf.ByteString b =
456 | com.google.protobuf.ByteString.copyFromUtf8((String) ref);
457 | key_ = b;
458 | return b;
459 | } else {
460 | return (com.google.protobuf.ByteString) ref;
461 | }
462 | }
463 | /** string key = 1;
*/
464 | public Builder setKey(String value) {
465 | if (value == null) {
466 | throw new NullPointerException();
467 | }
468 |
469 | key_ = value;
470 | onChanged();
471 | return this;
472 | }
473 | /** string key = 1;
*/
474 | public Builder clearKey() {
475 |
476 | key_ = getDefaultInstance().getKey();
477 | onChanged();
478 | return this;
479 | }
480 | /** string key = 1;
*/
481 | public Builder setKeyBytes(com.google.protobuf.ByteString value) {
482 | if (value == null) {
483 | throw new NullPointerException();
484 | }
485 | checkByteStringIsUtf8(value);
486 |
487 | key_ = value;
488 | onChanged();
489 | return this;
490 | }
491 |
492 | @Override
493 | public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
494 | return super.setUnknownFields(unknownFields);
495 | }
496 |
497 | @Override
498 | public final Builder mergeUnknownFields(
499 | final com.google.protobuf.UnknownFieldSet unknownFields) {
500 | return super.mergeUnknownFields(unknownFields);
501 | }
502 |
503 | // @@protoc_insertion_point(builder_scope:com.webank.wedpr.scd.proto.TemplatePublicKey)
504 | }
505 |
506 | // @@protoc_insertion_point(class_scope:com.webank.wedpr.scd.proto.TemplatePublicKey)
507 | private static final com.webank.wedpr.scd.proto.TemplatePublicKey DEFAULT_INSTANCE;
508 |
509 | static {
510 | DEFAULT_INSTANCE = new com.webank.wedpr.scd.proto.TemplatePublicKey();
511 | }
512 |
513 | public static com.webank.wedpr.scd.proto.TemplatePublicKey getDefaultInstance() {
514 | return DEFAULT_INSTANCE;
515 | }
516 |
517 | private static final com.google.protobuf.Parserstring key = 1;
*/
12 | String getKey();
13 | /** string key = 1;
*/
14 | com.google.protobuf.ByteString getKeyBytes();
15 | }
16 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/VerificationRuleSetOrBuilder.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | public interface VerificationRuleSetOrBuilder
7 | extends
8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.VerificationRuleSet)
9 | com.google.protobuf.MessageOrBuilder {
10 |
11 | /** repeated string revealed_attribute_name = 1;
*/
12 | java.util.Listrepeated string revealed_attribute_name = 1;
*/
14 | int getRevealedAttributeNameCount();
15 | /** repeated string revealed_attribute_name = 1;
*/
16 | String getRevealedAttributeName(int index);
17 | /** repeated string revealed_attribute_name = 1;
*/
18 | com.google.protobuf.ByteString getRevealedAttributeNameBytes(int index);
19 |
20 | /** repeated .com.webank.wedpr.scd.proto.Predicate attribute_predicate = 2;
*/
21 | java.util.Listrepeated .com.webank.wedpr.scd.proto.Predicate attribute_predicate = 2;
*/
23 | com.webank.wedpr.scd.proto.Predicate getAttributePredicate(int index);
24 | /** repeated .com.webank.wedpr.scd.proto.Predicate attribute_predicate = 2;
*/
25 | int getAttributePredicateCount();
26 | /** repeated .com.webank.wedpr.scd.proto.Predicate attribute_predicate = 2;
*/
27 | java.util.List extends com.webank.wedpr.scd.proto.PredicateOrBuilder>
28 | getAttributePredicateOrBuilderList();
29 | /** repeated .com.webank.wedpr.scd.proto.Predicate attribute_predicate = 2;
*/
30 | com.webank.wedpr.scd.proto.PredicateOrBuilder getAttributePredicateOrBuilder(int index);
31 | }
32 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/scd/proto/VerifyRequestOrBuilder.java:
--------------------------------------------------------------------------------
1 | // Generated by the protocol buffer compiler. DO NOT EDIT!
2 | // source: scd.proto
3 |
4 | package com.webank.wedpr.scd.proto;
5 |
6 | public interface VerifyRequestOrBuilder
7 | extends
8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.VerifyRequest)
9 | com.google.protobuf.MessageOrBuilder {
10 |
11 | /** .com.webank.wedpr.scd.proto.CertificateTemplate certificate_template = 1;
*/
12 | boolean hasCertificateTemplate();
13 | /** .com.webank.wedpr.scd.proto.CertificateTemplate certificate_template = 1;
*/
14 | com.webank.wedpr.scd.proto.CertificateTemplate getCertificateTemplate();
15 | /** .com.webank.wedpr.scd.proto.CertificateTemplate certificate_template = 1;
*/
16 | com.webank.wedpr.scd.proto.CertificateTemplateOrBuilder getCertificateTemplateOrBuilder();
17 |
18 | /** string verification_proof = 2;
*/
19 | String getVerificationProof();
20 | /** string verification_proof = 2;
*/
21 | com.google.protobuf.ByteString getVerificationProofBytes();
22 |
23 | /** string verification_nonce = 3;
*/
24 | String getVerificationNonce();
25 | /** string verification_nonce = 3;
*/
26 | com.google.protobuf.ByteString getVerificationNonceBytes();
27 | }
28 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/vcl/NativeInterface.java:
--------------------------------------------------------------------------------
1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2 |
3 | package com.webank.wedpr.vcl;
4 |
5 | /** Native interface for VCL client. */
6 | public class NativeInterface {
7 |
8 | // TODO: Check this path.
9 | static {
10 | System.loadLibrary("ffi_java_vcl");
11 | }
12 |
13 | // JNI function section.
14 | public static native VclResult makeCredit(long value);
15 |
16 | public static native VclResult proveSumBalance(String c1Secret, String c2Secret, String c3Secret);
17 |
18 | public static native VclResult verifySumBalance(
19 | String c1Credit, String c2Credit, String c3Credit, String proof);
20 |
21 | public static native VclResult proveProductBalance(
22 | String c1Secret, String c2Secret, String c3Secret);
23 |
24 | public static native VclResult verifyProductBalance(
25 | String c1Credit, String c2Credit, String c3Credit, String proof);
26 |
27 | public static native VclResult proveRange(String ownerSecret);
28 |
29 | public static native VclResult verifyRange(String confidentialCredit, String proof);
30 | }
31 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/vcl/VclClient.java:
--------------------------------------------------------------------------------
1 | package com.webank.wedpr.vcl;
2 |
3 | import com.webank.wedpr.common.WedprException;
4 |
5 | /** Client class used by VCL. This is the main interface class for Java apps using VCL functions. */
6 | public class VclClient {
7 | /**
8 | * Makes a confidential credit record and owner secret for a numeric value.
9 | *
10 | * @param value credit value.
11 | * @return VclResult containing data for confidentialCredit, ownerSecret.
12 | * @throws WedprException if any error occurred.
13 | */
14 | public VclResult makeCredit(long value) throws WedprException {
15 | return NativeInterface.makeCredit(value).expectNoError();
16 | }
17 |
18 | /**
19 | * Proves three confidential credit records satisfying a sum relationship, i.e. the values
20 | * embedded in them satisfying c1_value + c2_value = c3_value. c?_secret are the owner secrets for
21 | * spending those credit.
22 | *
23 | * @param c1Secret the owner secret for spending the credit of c1_value.
24 | * @param c2Secret the owner secret for spending the credit of c2_value.
25 | * @param c3Secret the owner secret for spending the credit of c3_value.
26 | * @return VclResult containing data for proof.
27 | * @throws WedprException if any error occurred.
28 | */
29 | public VclResult proveSumBalance(String c1Secret, String c2Secret, String c3Secret)
30 | throws WedprException {
31 | return NativeInterface.proveSumBalance(c1Secret, c2Secret, c3Secret).expectNoError();
32 | }
33 |
34 | /**
35 | * Verifies three commitments satisfying a sum relationship, i.e. the values embedded in
36 | * c1_credit, c2_credit, c3_credit satisfying c1_value + c2_value = c3_value.
37 | *
38 | * @param c1Credit the confidential credit record of c1_value.
39 | * @param c2Credit the confidential credit record of c2_value.
40 | * @param c3Credit the confidential credit record of c3_value.
41 | * @param proof the proof of satisfying the sum relationship or not.
42 | * @return VclResult containing data for verificationResult.
43 | * @throws WedprException if any error occurred.
44 | */
45 | public VclResult verifySumBalance(String c1Credit, String c2Credit, String c3Credit, String proof)
46 | throws WedprException {
47 | return NativeInterface.verifySumBalance(c1Credit, c2Credit, c3Credit, proof).expectNoError();
48 | }
49 |
50 | /**
51 | * Proves three confidential credit records satisfying a product relationship, i.e. the values
52 | * embedded in them satisfying c1_value * c2_value = c3_value. c?_secret are the owner secrets for
53 | * spending those commitments.
54 | *
55 | * @param c1Secret the owner secret for spending the credit of c1_value.
56 | * @param c2Secret the owner secret for spending the credit of c2_value.
57 | * @param c3Secret the owner secret for spending the credit of c3_value.
58 | * @return VclResult containing data for proof.
59 | * @throws WedprException if any error occurred.
60 | */
61 | public VclResult proveProductBalance(String c1Secret, String c2Secret, String c3Secret)
62 | throws WedprException {
63 | return NativeInterface.proveProductBalance(c1Secret, c2Secret, c3Secret).expectNoError();
64 | }
65 |
66 | /**
67 | * Verifies three commitments satisfying a product relationship, i.e. the values embedded in
68 | * c1_credit, c2_credit, c3_credit satisfying c1_value * c2_value = c3_value.
69 | *
70 | * @param c1Credit the confidential credit record of c1_value.
71 | * @param c2Credit the confidential credit record of c2_value.
72 | * @param c3Credit the confidential credit record of c3_value.
73 | * @param proof the proof of satisfying the product relationship or not.
74 | * @return VclResult containing data for verificationResult.
75 | * @throws WedprException if any error occurred.
76 | */
77 | public VclResult verifyProductBalance(
78 | String c1Credit, String c2Credit, String c3Credit, String proof) throws WedprException {
79 | return NativeInterface.verifyProductBalance(c1Credit, c2Credit, c3Credit, proof)
80 | .expectNoError();
81 | }
82 |
83 | /**
84 | * Proves whether the value embedded in a confidential credit record belongs to (0,
85 | * 2^RANGE_SIZE_IN_BITS - 1]. RANGE_SIZE_IN_BITS is defined in the dynamic library of VCL, whose
86 | * typical value is 32.
87 | *
88 | * @param ownerSecret the owner secret for spending a credit.
89 | * @return VclResult containing data for proof.
90 | * @throws WedprException if any error occurred.
91 | */
92 | public VclResult proveRange(String ownerSecret) throws WedprException {
93 | return NativeInterface.proveRange(ownerSecret).expectNoError();
94 | }
95 |
96 | /**
97 | * Verifies whether the value embedded in a confidential credit record belongs to (0,
98 | * 2^RANGE_SIZE_IN_BITS - 1]. RANGE_SIZE_IN_BITS is defined in the dynamic library of VCL, whose
99 | * typical value is 32.
100 | *
101 | * @param confidentialCredit the confidential credit record of a value.
102 | * @param proof the proof of satisfying the range constraint or not.
103 | * @return VclResult containing data for verificationResult.
104 | * @throws WedprException if any error occurred.
105 | */
106 | public VclResult verifyRange(String confidentialCredit, String proof) throws WedprException {
107 | return NativeInterface.verifyRange(confidentialCredit, proof).expectNoError();
108 | }
109 |
110 | // TODO: Add a getVclConfig function to expose the value of RANGE_SIZE_IN_BITS.
111 | }
112 |
--------------------------------------------------------------------------------
/demo/app/src/main/java/com/webank/wedpr/vcl/VclResult.java:
--------------------------------------------------------------------------------
1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0.
2 |
3 | package com.webank.wedpr.vcl;
4 |
5 | import com.webank.wedpr.common.WedprException;
6 | import com.webank.wedpr.common.WedprResult;
7 |
8 | /**
9 | * Result class used by VCL client.
10 | *
11 | *