├── .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 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/common/Utils.java: -------------------------------------------------------------------------------- 1 | package com.webank.wedpr.common; 2 | 3 | import java.util.*; 4 | 5 | public class Utils { 6 | 7 | public static String bytesToString(byte[] param) { 8 | return Base64.getEncoder().encodeToString(param); 9 | } 10 | 11 | public static byte[] stringToBytes(String param) { 12 | return Base64.getDecoder().decode(param); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/common/WedprException.java: -------------------------------------------------------------------------------- 1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0. 2 | 3 | package com.webank.wedpr.common; 4 | 5 | /** Base exception class used by WeDPR Java SDK. */ 6 | public class WedprException extends Exception { 7 | 8 | public WedprException() { 9 | super(); 10 | } 11 | 12 | public WedprException(String message) { 13 | super(message); 14 | } 15 | 16 | public WedprException(Throwable cause) { 17 | super(cause); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/common/WedprResult.java: -------------------------------------------------------------------------------- 1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0. 2 | 3 | package com.webank.wedpr.common; 4 | 5 | /** Base result class used by WeDPR Java SDK. */ 6 | public class WedprResult { 7 | public String wedprErrorMessage; 8 | 9 | /** Checks whether any error occurred. */ 10 | public boolean hasError() { 11 | return wedprErrorMessage != null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/crypto/CryptoClient.java: -------------------------------------------------------------------------------- 1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0. 2 | package com.webank.wedpr.crypto; 3 | 4 | import com.webank.wedpr.common.WedprException; 5 | 6 | /** 7 | * Client class used by crypto tools. This is the main interface class for Java apps using crypto 8 | * functions. 9 | */ 10 | public class CryptoClient { 11 | 12 | /** 13 | * Encrypts an encoded message by ECIES with a public key on the secp256k1 curve. 14 | * 15 | * @param publicKey encoded public key. 16 | * @param message encoded message to encrypt. 17 | * @return CryptoResult containing data for encryptedData. 18 | * @throws WedprException if any error occurred. 19 | */ 20 | public CryptoResult secp256k1EciesEncrypt(String publicKey, String message) throws WedprException { 21 | return NativeInterface.secp256k1EciesEncrypt(publicKey, message).expectNoError(); 22 | } 23 | 24 | /** 25 | * Decrypts an encoded encryptedData by ECIES with a private key on the secp256k1 curve. 26 | * 27 | * @param privateKey encoded private key. 28 | * @param encryptedData encoded ciphertext to decrypt. 29 | * @return CryptoResult containing data for decryptedData. 30 | * @throws WedprException if any error occurred. 31 | */ 32 | public CryptoResult secp256k1EciesDecrypt(String privateKey, String encryptedData) 33 | throws WedprException { 34 | return NativeInterface.secp256k1EciesDecrypt(privateKey, encryptedData).expectNoError(); 35 | } 36 | 37 | /** 38 | * Generates a new key pair for signature algorithm on the secp256k1 curve. 39 | * 40 | * @return CryptoResult containing data for publicKey, privateKey. 41 | * @throws WedprException if any error occurred. 42 | */ 43 | public CryptoResult secp256k1GenKeyPair() throws WedprException { 44 | return NativeInterface.secp256k1GenKeyPair().expectNoError(); 45 | } 46 | 47 | /** 48 | * Signs a message hash with the private key on the secp256k1 curve. 49 | * 50 | * @param privateKey encoded private key. 51 | * @param messageHash encoded hash of a message to sign. 52 | * @return CryptoResult containing data for signature. 53 | * @throws WedprException if any error occurred. 54 | */ 55 | public CryptoResult secp256k1Sign(String privateKey, String messageHash) throws WedprException { 56 | return NativeInterface.secp256k1Sign(privateKey, messageHash).expectNoError(); 57 | } 58 | 59 | /** 60 | * Verifies a message hash with the public key on the secp256k1 curve. 61 | * 62 | * @param publicKey encoded public key. 63 | * @param messageHash encoded hash of a message to verify. 64 | * @param signature encoded signature 65 | * @return CryptoResult containing data for booleanResult. 66 | * @throws WedprException if any error occurred. 67 | */ 68 | public CryptoResult secp256k1Verify(String publicKey, String messageHash, String signature) 69 | throws WedprException { 70 | return NativeInterface.secp256k1Verify(publicKey, messageHash, signature).expectNoError(); 71 | } 72 | 73 | /** 74 | * Generates a keccak256 hash string from a bytes array of any length. 75 | * 76 | * @param message 77 | * @return CryptoResult containing data for hash. 78 | * @throws WedprException if any error occurred. 79 | */ 80 | public CryptoResult keccak256Hash(String message) throws WedprException { 81 | return NativeInterface.keccak256Hash(message).expectNoError(); 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/crypto/CryptoResult.java: -------------------------------------------------------------------------------- 1 | // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0. 2 | 3 | package com.webank.wedpr.crypto; 4 | 5 | import com.webank.wedpr.common.WedprException; 6 | import com.webank.wedpr.common.WedprResult; 7 | 8 | /** 9 | * Result class used by Crypto client. 10 | * 11 | *

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 schema) throws WedprException { 22 | return NativeInterface.issuerMakeCertificateTemplate( 23 | protoToEncodedString( 24 | CertificateSchema.newBuilder().addAllAttributeName(schema).build())) 25 | .expectNoError(); 26 | } 27 | 28 | /** 29 | * Signs a verified certificate from a user. 30 | * 31 | * @param certificateTemplate the encoded certificate template. 32 | * @param templatePrivateKey the encoded template private key. 33 | * @param signRequest the encoded certificate signing request from the user. 34 | * @param userId the encoded user id. 35 | * @param userNonce the encoded nonce from the user. 36 | * @return IssuerResult containing data for certificateSignature, issuerNonce. 37 | * @throws WedprException if any error occurred. 38 | */ 39 | public IssuerResult signCertificate( 40 | String certificateTemplate, 41 | String templatePrivateKey, 42 | String signRequest, 43 | String userId, 44 | String userNonce) 45 | throws WedprException { 46 | return NativeInterface.issuerSignCertificate( 47 | certificateTemplate, templatePrivateKey, signRequest, userId, userNonce) 48 | .expectNoError(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/scd/IssuerResult.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 issuer. 10 | * 11 | *

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 attributeDictInput) { 20 | AttributeDict attributeDict = AttributeDict.getDefaultInstance(); 21 | for (Map.Entry entry : attributeDictInput.entrySet()) { 22 | StringToStringPair pair = 23 | StringToStringPair.newBuilder().setKey(entry.getKey()).setValue(entry.getValue()).build(); 24 | attributeDict = attributeDict.toBuilder().addPair(pair).build(); 25 | } 26 | return protoToEncodedString(attributeDict); 27 | } 28 | 29 | /** 30 | * Encodes a Protobuf object to a String. 31 | * 32 | * @param message the Protobuf object. 33 | * @return the encoded string of message. 34 | */ 35 | public String protoToEncodedString(Message message) { 36 | return Utils.bytesToString(message.toByteArray()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/scd/UserClient.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 user. This is the main interface class for Java apps using 9 | * SCD functions. 10 | */ 11 | public class UserClient extends ScdClient { 12 | /** 13 | * Fills a certificate and generates a SignCertificateRequest for an issuer to sign. 14 | * 15 | * @param attributeDict the encode KV map for the filled data of a certificate. 16 | * @param certificateTemplate the encoded certificate template. 17 | * @return UserResult containing data for signCertificateRequest, userPrivateKey, 18 | * certificateSecretsBlindingFactors, userNonce. 19 | * @throws WedprException if any error occurred. 20 | */ 21 | public UserResult fillCertificate(String attributeDict, String certificateTemplate) 22 | throws WedprException { 23 | return NativeInterface.userFillCertificate(attributeDict, certificateTemplate).expectNoError(); 24 | } 25 | 26 | /** 27 | * Blinds the signature of a signed certificate to prevent the issuer from tracking its usage. 28 | * 29 | * @param certificateSignature the encoded certificate signature signed by the issuer. 30 | * @param attributeDict the encode KV map for the filled data of a certificate. 31 | * @param certificateTemplate the encoded certificate template. 32 | * @param userPrivateKey the encoded user private key. 33 | * @param certificateSecretsBlindingFactors the encoded blinding factors. 34 | * @param issuerNonce the encoded nonce from the issuer. 35 | * @return UserResult containing data for certificateSignature. 36 | * @throws WedprException if any error occurred. 37 | */ 38 | public UserResult blindCertificateSignature( 39 | String certificateSignature, 40 | String attributeDict, 41 | String certificateTemplate, 42 | String userPrivateKey, 43 | String certificateSecretsBlindingFactors, 44 | String issuerNonce) 45 | throws WedprException { 46 | return NativeInterface.userBlindCertificateSignature( 47 | certificateSignature, 48 | attributeDict, 49 | certificateTemplate, 50 | userPrivateKey, 51 | certificateSecretsBlindingFactors, 52 | issuerNonce) 53 | .expectNoError(); 54 | } 55 | 56 | /** 57 | * Generate a VerifyRequest to prove the validity of selected attribute values and their value 58 | * predicates from a certificate, while those unselected attributes will not be revealed. 59 | * 60 | * @param ruleSet the encoded rule set for the disclosure from the verifier. 61 | * @param certificateSignature the encoded certificate signature. 62 | * @param attributeDict the encode KV map for the filled data of a certificate. 63 | * @param certificateTemplate the encoded certificate template. 64 | * @param userPrivateKey the encoded user private key. 65 | * @return UserResult containing data for verifyRequest. 66 | * @throws WedprException if any error occurred. 67 | */ 68 | public UserResult proveSelectiveDisclosure( 69 | String ruleSet, 70 | String certificateSignature, 71 | String attributeDict, 72 | String certificateTemplate, 73 | String userPrivateKey, 74 | String verificationNonce) 75 | throws WedprException { 76 | return NativeInterface.userProveSelectiveDisclosure( 77 | ruleSet, 78 | certificateSignature, 79 | attributeDict, 80 | certificateTemplate, 81 | userPrivateKey, 82 | verificationNonce) 83 | .expectNoError(); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/scd/UserResult.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 user. 10 | * 11 | *

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 | /** repeated .com.webank.wedpr.scd.proto.StringToStringPair pair = 1; */ 12 | java.util.List getPairList(); 13 | /** repeated .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 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.Builder 300 | implements 301 | // @@protoc_insertion_point(builder_implements:com.webank.wedpr.scd.proto.CertificateSchema) 302 | com.webank.wedpr.scd.proto.CertificateSchemaOrBuilder { 303 | public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 304 | return com.webank.wedpr.scd.proto.Scd 305 | .internal_static_com_webank_wedpr_scd_proto_CertificateSchema_descriptor; 306 | } 307 | 308 | @Override 309 | protected FieldAccessorTable internalGetFieldAccessorTable() { 310 | return com.webank.wedpr.scd.proto.Scd 311 | .internal_static_com_webank_wedpr_scd_proto_CertificateSchema_fieldAccessorTable 312 | .ensureFieldAccessorsInitialized( 313 | com.webank.wedpr.scd.proto.CertificateSchema.class, 314 | com.webank.wedpr.scd.proto.CertificateSchema.Builder.class); 315 | } 316 | 317 | // Construct using com.webank.wedpr.scd.proto.CertificateSchema.newBuilder() 318 | private Builder() { 319 | maybeForceBuilderInitialization(); 320 | } 321 | 322 | private Builder(BuilderParent parent) { 323 | super(parent); 324 | maybeForceBuilderInitialization(); 325 | } 326 | 327 | private void maybeForceBuilderInitialization() { 328 | if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} 329 | } 330 | 331 | @Override 332 | public Builder clear() { 333 | super.clear(); 334 | attributeName_ = com.google.protobuf.LazyStringArrayList.EMPTY; 335 | bitField0_ = (bitField0_ & ~0x00000001); 336 | return this; 337 | } 338 | 339 | @Override 340 | public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 341 | return com.webank.wedpr.scd.proto.Scd 342 | .internal_static_com_webank_wedpr_scd_proto_CertificateSchema_descriptor; 343 | } 344 | 345 | @Override 346 | public com.webank.wedpr.scd.proto.CertificateSchema getDefaultInstanceForType() { 347 | return com.webank.wedpr.scd.proto.CertificateSchema.getDefaultInstance(); 348 | } 349 | 350 | @Override 351 | public com.webank.wedpr.scd.proto.CertificateSchema build() { 352 | com.webank.wedpr.scd.proto.CertificateSchema result = buildPartial(); 353 | if (!result.isInitialized()) { 354 | throw newUninitializedMessageException(result); 355 | } 356 | return result; 357 | } 358 | 359 | @Override 360 | public com.webank.wedpr.scd.proto.CertificateSchema buildPartial() { 361 | com.webank.wedpr.scd.proto.CertificateSchema result = 362 | new com.webank.wedpr.scd.proto.CertificateSchema(this); 363 | int from_bitField0_ = bitField0_; 364 | if (((bitField0_ & 0x00000001) != 0)) { 365 | attributeName_ = attributeName_.getUnmodifiableView(); 366 | bitField0_ = (bitField0_ & ~0x00000001); 367 | } 368 | result.attributeName_ = attributeName_; 369 | onBuilt(); 370 | return result; 371 | } 372 | 373 | @Override 374 | public Builder clone() { 375 | return super.clone(); 376 | } 377 | 378 | @Override 379 | public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { 380 | return super.setField(field, value); 381 | } 382 | 383 | @Override 384 | public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 385 | return super.clearField(field); 386 | } 387 | 388 | @Override 389 | public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 390 | return super.clearOneof(oneof); 391 | } 392 | 393 | @Override 394 | public Builder setRepeatedField( 395 | com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) { 396 | return super.setRepeatedField(field, index, value); 397 | } 398 | 399 | @Override 400 | public Builder addRepeatedField( 401 | com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { 402 | return super.addRepeatedField(field, value); 403 | } 404 | 405 | @Override 406 | public Builder mergeFrom(com.google.protobuf.Message other) { 407 | if (other instanceof com.webank.wedpr.scd.proto.CertificateSchema) { 408 | return mergeFrom((com.webank.wedpr.scd.proto.CertificateSchema) other); 409 | } else { 410 | super.mergeFrom(other); 411 | return this; 412 | } 413 | } 414 | 415 | public Builder mergeFrom(com.webank.wedpr.scd.proto.CertificateSchema other) { 416 | if (other == com.webank.wedpr.scd.proto.CertificateSchema.getDefaultInstance()) return this; 417 | if (!other.attributeName_.isEmpty()) { 418 | if (attributeName_.isEmpty()) { 419 | attributeName_ = other.attributeName_; 420 | bitField0_ = (bitField0_ & ~0x00000001); 421 | } else { 422 | ensureAttributeNameIsMutable(); 423 | attributeName_.addAll(other.attributeName_); 424 | } 425 | onChanged(); 426 | } 427 | this.mergeUnknownFields(other.unknownFields); 428 | onChanged(); 429 | return this; 430 | } 431 | 432 | @Override 433 | public final boolean isInitialized() { 434 | return true; 435 | } 436 | 437 | @Override 438 | public Builder mergeFrom( 439 | com.google.protobuf.CodedInputStream input, 440 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 441 | throws java.io.IOException { 442 | com.webank.wedpr.scd.proto.CertificateSchema parsedMessage = null; 443 | try { 444 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 445 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 446 | parsedMessage = (com.webank.wedpr.scd.proto.CertificateSchema) e.getUnfinishedMessage(); 447 | throw e.unwrapIOException(); 448 | } finally { 449 | if (parsedMessage != null) { 450 | mergeFrom(parsedMessage); 451 | } 452 | } 453 | return this; 454 | } 455 | 456 | private int bitField0_; 457 | 458 | private com.google.protobuf.LazyStringList attributeName_ = 459 | com.google.protobuf.LazyStringArrayList.EMPTY; 460 | 461 | private void ensureAttributeNameIsMutable() { 462 | if (!((bitField0_ & 0x00000001) != 0)) { 463 | attributeName_ = new com.google.protobuf.LazyStringArrayList(attributeName_); 464 | bitField0_ |= 0x00000001; 465 | } 466 | } 467 | /** repeated 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(Iterable values) { 505 | ensureAttributeNameIsMutable(); 506 | com.google.protobuf.AbstractMessageLite.Builder.addAll(values, attributeName_); 507 | onChanged(); 508 | return this; 509 | } 510 | /** repeated 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.Parser PARSER = 555 | new com.google.protobuf.AbstractParser() { 556 | @Override 557 | public CertificateSchema parsePartialFrom( 558 | com.google.protobuf.CodedInputStream input, 559 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 560 | throws com.google.protobuf.InvalidProtocolBufferException { 561 | return new CertificateSchema(input, extensionRegistry); 562 | } 563 | }; 564 | 565 | public static com.google.protobuf.Parser parser() { 566 | return PARSER; 567 | } 568 | 569 | @Override 570 | public com.google.protobuf.Parser getParserForType() { 571 | return PARSER; 572 | } 573 | 574 | @Override 575 | public com.webank.wedpr.scd.proto.CertificateSchema getDefaultInstanceForType() { 576 | return DEFAULT_INSTANCE; 577 | } 578 | } 579 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/scd/proto/CertificateSchemaOrBuilder.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 CertificateSchemaOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.CertificateSchema) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** repeated string attribute_name = 1; */ 12 | java.util.List getAttributeNameList(); 13 | /** repeated 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.Builder 336 | implements 337 | // @@protoc_insertion_point(builder_implements:com.webank.wedpr.scd.proto.StringToStringPair) 338 | com.webank.wedpr.scd.proto.StringToStringPairOrBuilder { 339 | public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 340 | return com.webank.wedpr.scd.proto.Scd 341 | .internal_static_com_webank_wedpr_scd_proto_StringToStringPair_descriptor; 342 | } 343 | 344 | @Override 345 | protected FieldAccessorTable internalGetFieldAccessorTable() { 346 | return com.webank.wedpr.scd.proto.Scd 347 | .internal_static_com_webank_wedpr_scd_proto_StringToStringPair_fieldAccessorTable 348 | .ensureFieldAccessorsInitialized( 349 | com.webank.wedpr.scd.proto.StringToStringPair.class, 350 | com.webank.wedpr.scd.proto.StringToStringPair.Builder.class); 351 | } 352 | 353 | // Construct using com.webank.wedpr.scd.proto.StringToStringPair.newBuilder() 354 | private Builder() { 355 | maybeForceBuilderInitialization(); 356 | } 357 | 358 | private Builder(BuilderParent parent) { 359 | super(parent); 360 | maybeForceBuilderInitialization(); 361 | } 362 | 363 | private void maybeForceBuilderInitialization() { 364 | if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} 365 | } 366 | 367 | @Override 368 | public Builder clear() { 369 | super.clear(); 370 | key_ = ""; 371 | 372 | value_ = ""; 373 | 374 | return this; 375 | } 376 | 377 | @Override 378 | public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 379 | return com.webank.wedpr.scd.proto.Scd 380 | .internal_static_com_webank_wedpr_scd_proto_StringToStringPair_descriptor; 381 | } 382 | 383 | @Override 384 | public com.webank.wedpr.scd.proto.StringToStringPair getDefaultInstanceForType() { 385 | return com.webank.wedpr.scd.proto.StringToStringPair.getDefaultInstance(); 386 | } 387 | 388 | @Override 389 | public com.webank.wedpr.scd.proto.StringToStringPair build() { 390 | com.webank.wedpr.scd.proto.StringToStringPair result = buildPartial(); 391 | if (!result.isInitialized()) { 392 | throw newUninitializedMessageException(result); 393 | } 394 | return result; 395 | } 396 | 397 | @Override 398 | public com.webank.wedpr.scd.proto.StringToStringPair buildPartial() { 399 | com.webank.wedpr.scd.proto.StringToStringPair result = 400 | new com.webank.wedpr.scd.proto.StringToStringPair(this); 401 | result.key_ = key_; 402 | result.value_ = value_; 403 | onBuilt(); 404 | return result; 405 | } 406 | 407 | @Override 408 | public Builder clone() { 409 | return super.clone(); 410 | } 411 | 412 | @Override 413 | public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { 414 | return super.setField(field, value); 415 | } 416 | 417 | @Override 418 | public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 419 | return super.clearField(field); 420 | } 421 | 422 | @Override 423 | public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 424 | return super.clearOneof(oneof); 425 | } 426 | 427 | @Override 428 | public Builder setRepeatedField( 429 | com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) { 430 | return super.setRepeatedField(field, index, value); 431 | } 432 | 433 | @Override 434 | public Builder addRepeatedField( 435 | com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { 436 | return super.addRepeatedField(field, value); 437 | } 438 | 439 | @Override 440 | public Builder mergeFrom(com.google.protobuf.Message other) { 441 | if (other instanceof com.webank.wedpr.scd.proto.StringToStringPair) { 442 | return mergeFrom((com.webank.wedpr.scd.proto.StringToStringPair) other); 443 | } else { 444 | super.mergeFrom(other); 445 | return this; 446 | } 447 | } 448 | 449 | public Builder mergeFrom(com.webank.wedpr.scd.proto.StringToStringPair other) { 450 | if (other == com.webank.wedpr.scd.proto.StringToStringPair.getDefaultInstance()) return this; 451 | if (!other.getKey().isEmpty()) { 452 | key_ = other.key_; 453 | onChanged(); 454 | } 455 | if (!other.getValue().isEmpty()) { 456 | value_ = other.value_; 457 | onChanged(); 458 | } 459 | this.mergeUnknownFields(other.unknownFields); 460 | onChanged(); 461 | return this; 462 | } 463 | 464 | @Override 465 | public final boolean isInitialized() { 466 | return true; 467 | } 468 | 469 | @Override 470 | public Builder mergeFrom( 471 | com.google.protobuf.CodedInputStream input, 472 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 473 | throws java.io.IOException { 474 | com.webank.wedpr.scd.proto.StringToStringPair parsedMessage = null; 475 | try { 476 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 477 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 478 | parsedMessage = (com.webank.wedpr.scd.proto.StringToStringPair) e.getUnfinishedMessage(); 479 | throw e.unwrapIOException(); 480 | } finally { 481 | if (parsedMessage != null) { 482 | mergeFrom(parsedMessage); 483 | } 484 | } 485 | return this; 486 | } 487 | 488 | private Object key_ = ""; 489 | /** string 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.Parser PARSER = 622 | new com.google.protobuf.AbstractParser() { 623 | @Override 624 | public StringToStringPair parsePartialFrom( 625 | com.google.protobuf.CodedInputStream input, 626 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 627 | throws com.google.protobuf.InvalidProtocolBufferException { 628 | return new StringToStringPair(input, extensionRegistry); 629 | } 630 | }; 631 | 632 | public static com.google.protobuf.Parser parser() { 633 | return PARSER; 634 | } 635 | 636 | @Override 637 | public com.google.protobuf.Parser getParserForType() { 638 | return PARSER; 639 | } 640 | 641 | @Override 642 | public com.webank.wedpr.scd.proto.StringToStringPair getDefaultInstanceForType() { 643 | return DEFAULT_INSTANCE; 644 | } 645 | } 646 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/scd/proto/StringToStringPairOrBuilder.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 StringToStringPairOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.StringToStringPair) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** string 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.Builder 293 | implements 294 | // @@protoc_insertion_point(builder_implements:com.webank.wedpr.scd.proto.TemplatePrivateKey) 295 | com.webank.wedpr.scd.proto.TemplatePrivateKeyOrBuilder { 296 | public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 297 | return com.webank.wedpr.scd.proto.Scd 298 | .internal_static_com_webank_wedpr_scd_proto_TemplatePrivateKey_descriptor; 299 | } 300 | 301 | @Override 302 | protected FieldAccessorTable internalGetFieldAccessorTable() { 303 | return com.webank.wedpr.scd.proto.Scd 304 | .internal_static_com_webank_wedpr_scd_proto_TemplatePrivateKey_fieldAccessorTable 305 | .ensureFieldAccessorsInitialized( 306 | com.webank.wedpr.scd.proto.TemplatePrivateKey.class, 307 | com.webank.wedpr.scd.proto.TemplatePrivateKey.Builder.class); 308 | } 309 | 310 | // Construct using com.webank.wedpr.scd.proto.TemplatePrivateKey.newBuilder() 311 | private Builder() { 312 | maybeForceBuilderInitialization(); 313 | } 314 | 315 | private Builder(BuilderParent parent) { 316 | super(parent); 317 | maybeForceBuilderInitialization(); 318 | } 319 | 320 | private void maybeForceBuilderInitialization() { 321 | if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} 322 | } 323 | 324 | @Override 325 | public Builder clear() { 326 | super.clear(); 327 | key_ = ""; 328 | 329 | return this; 330 | } 331 | 332 | @Override 333 | public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 334 | return com.webank.wedpr.scd.proto.Scd 335 | .internal_static_com_webank_wedpr_scd_proto_TemplatePrivateKey_descriptor; 336 | } 337 | 338 | @Override 339 | public com.webank.wedpr.scd.proto.TemplatePrivateKey getDefaultInstanceForType() { 340 | return com.webank.wedpr.scd.proto.TemplatePrivateKey.getDefaultInstance(); 341 | } 342 | 343 | @Override 344 | public com.webank.wedpr.scd.proto.TemplatePrivateKey build() { 345 | com.webank.wedpr.scd.proto.TemplatePrivateKey result = buildPartial(); 346 | if (!result.isInitialized()) { 347 | throw newUninitializedMessageException(result); 348 | } 349 | return result; 350 | } 351 | 352 | @Override 353 | public com.webank.wedpr.scd.proto.TemplatePrivateKey buildPartial() { 354 | com.webank.wedpr.scd.proto.TemplatePrivateKey result = 355 | new com.webank.wedpr.scd.proto.TemplatePrivateKey(this); 356 | result.key_ = key_; 357 | onBuilt(); 358 | return result; 359 | } 360 | 361 | @Override 362 | public Builder clone() { 363 | return super.clone(); 364 | } 365 | 366 | @Override 367 | public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { 368 | return super.setField(field, value); 369 | } 370 | 371 | @Override 372 | public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 373 | return super.clearField(field); 374 | } 375 | 376 | @Override 377 | public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 378 | return super.clearOneof(oneof); 379 | } 380 | 381 | @Override 382 | public Builder setRepeatedField( 383 | com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) { 384 | return super.setRepeatedField(field, index, value); 385 | } 386 | 387 | @Override 388 | public Builder addRepeatedField( 389 | com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { 390 | return super.addRepeatedField(field, value); 391 | } 392 | 393 | @Override 394 | public Builder mergeFrom(com.google.protobuf.Message other) { 395 | if (other instanceof com.webank.wedpr.scd.proto.TemplatePrivateKey) { 396 | return mergeFrom((com.webank.wedpr.scd.proto.TemplatePrivateKey) other); 397 | } else { 398 | super.mergeFrom(other); 399 | return this; 400 | } 401 | } 402 | 403 | public Builder mergeFrom(com.webank.wedpr.scd.proto.TemplatePrivateKey other) { 404 | if (other == com.webank.wedpr.scd.proto.TemplatePrivateKey.getDefaultInstance()) return this; 405 | if (!other.getKey().isEmpty()) { 406 | key_ = other.key_; 407 | onChanged(); 408 | } 409 | this.mergeUnknownFields(other.unknownFields); 410 | onChanged(); 411 | return this; 412 | } 413 | 414 | @Override 415 | public final boolean isInitialized() { 416 | return true; 417 | } 418 | 419 | @Override 420 | public Builder mergeFrom( 421 | com.google.protobuf.CodedInputStream input, 422 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 423 | throws java.io.IOException { 424 | com.webank.wedpr.scd.proto.TemplatePrivateKey parsedMessage = null; 425 | try { 426 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 427 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 428 | parsedMessage = (com.webank.wedpr.scd.proto.TemplatePrivateKey) e.getUnfinishedMessage(); 429 | throw e.unwrapIOException(); 430 | } finally { 431 | if (parsedMessage != null) { 432 | mergeFrom(parsedMessage); 433 | } 434 | } 435 | return this; 436 | } 437 | 438 | private Object key_ = ""; 439 | /** string 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.Parser PARSER = 518 | new com.google.protobuf.AbstractParser() { 519 | @Override 520 | public TemplatePrivateKey parsePartialFrom( 521 | com.google.protobuf.CodedInputStream input, 522 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 523 | throws com.google.protobuf.InvalidProtocolBufferException { 524 | return new TemplatePrivateKey(input, extensionRegistry); 525 | } 526 | }; 527 | 528 | public static com.google.protobuf.Parser parser() { 529 | return PARSER; 530 | } 531 | 532 | @Override 533 | public com.google.protobuf.Parser getParserForType() { 534 | return PARSER; 535 | } 536 | 537 | @Override 538 | public com.webank.wedpr.scd.proto.TemplatePrivateKey getDefaultInstanceForType() { 539 | return DEFAULT_INSTANCE; 540 | } 541 | } 542 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/scd/proto/TemplatePrivateKeyOrBuilder.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 TemplatePrivateKeyOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.TemplatePrivateKey) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** string 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.Builder 293 | implements 294 | // @@protoc_insertion_point(builder_implements:com.webank.wedpr.scd.proto.TemplatePublicKey) 295 | com.webank.wedpr.scd.proto.TemplatePublicKeyOrBuilder { 296 | public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 297 | return com.webank.wedpr.scd.proto.Scd 298 | .internal_static_com_webank_wedpr_scd_proto_TemplatePublicKey_descriptor; 299 | } 300 | 301 | @Override 302 | protected FieldAccessorTable internalGetFieldAccessorTable() { 303 | return com.webank.wedpr.scd.proto.Scd 304 | .internal_static_com_webank_wedpr_scd_proto_TemplatePublicKey_fieldAccessorTable 305 | .ensureFieldAccessorsInitialized( 306 | com.webank.wedpr.scd.proto.TemplatePublicKey.class, 307 | com.webank.wedpr.scd.proto.TemplatePublicKey.Builder.class); 308 | } 309 | 310 | // Construct using com.webank.wedpr.scd.proto.TemplatePublicKey.newBuilder() 311 | private Builder() { 312 | maybeForceBuilderInitialization(); 313 | } 314 | 315 | private Builder(BuilderParent parent) { 316 | super(parent); 317 | maybeForceBuilderInitialization(); 318 | } 319 | 320 | private void maybeForceBuilderInitialization() { 321 | if (com.google.protobuf.GeneratedMessageV3.alwaysUseFieldBuilders) {} 322 | } 323 | 324 | @Override 325 | public Builder clear() { 326 | super.clear(); 327 | key_ = ""; 328 | 329 | return this; 330 | } 331 | 332 | @Override 333 | public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 334 | return com.webank.wedpr.scd.proto.Scd 335 | .internal_static_com_webank_wedpr_scd_proto_TemplatePublicKey_descriptor; 336 | } 337 | 338 | @Override 339 | public com.webank.wedpr.scd.proto.TemplatePublicKey getDefaultInstanceForType() { 340 | return com.webank.wedpr.scd.proto.TemplatePublicKey.getDefaultInstance(); 341 | } 342 | 343 | @Override 344 | public com.webank.wedpr.scd.proto.TemplatePublicKey build() { 345 | com.webank.wedpr.scd.proto.TemplatePublicKey result = buildPartial(); 346 | if (!result.isInitialized()) { 347 | throw newUninitializedMessageException(result); 348 | } 349 | return result; 350 | } 351 | 352 | @Override 353 | public com.webank.wedpr.scd.proto.TemplatePublicKey buildPartial() { 354 | com.webank.wedpr.scd.proto.TemplatePublicKey result = 355 | new com.webank.wedpr.scd.proto.TemplatePublicKey(this); 356 | result.key_ = key_; 357 | onBuilt(); 358 | return result; 359 | } 360 | 361 | @Override 362 | public Builder clone() { 363 | return super.clone(); 364 | } 365 | 366 | @Override 367 | public Builder setField(com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { 368 | return super.setField(field, value); 369 | } 370 | 371 | @Override 372 | public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 373 | return super.clearField(field); 374 | } 375 | 376 | @Override 377 | public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 378 | return super.clearOneof(oneof); 379 | } 380 | 381 | @Override 382 | public Builder setRepeatedField( 383 | com.google.protobuf.Descriptors.FieldDescriptor field, int index, Object value) { 384 | return super.setRepeatedField(field, index, value); 385 | } 386 | 387 | @Override 388 | public Builder addRepeatedField( 389 | com.google.protobuf.Descriptors.FieldDescriptor field, Object value) { 390 | return super.addRepeatedField(field, value); 391 | } 392 | 393 | @Override 394 | public Builder mergeFrom(com.google.protobuf.Message other) { 395 | if (other instanceof com.webank.wedpr.scd.proto.TemplatePublicKey) { 396 | return mergeFrom((com.webank.wedpr.scd.proto.TemplatePublicKey) other); 397 | } else { 398 | super.mergeFrom(other); 399 | return this; 400 | } 401 | } 402 | 403 | public Builder mergeFrom(com.webank.wedpr.scd.proto.TemplatePublicKey other) { 404 | if (other == com.webank.wedpr.scd.proto.TemplatePublicKey.getDefaultInstance()) return this; 405 | if (!other.getKey().isEmpty()) { 406 | key_ = other.key_; 407 | onChanged(); 408 | } 409 | this.mergeUnknownFields(other.unknownFields); 410 | onChanged(); 411 | return this; 412 | } 413 | 414 | @Override 415 | public final boolean isInitialized() { 416 | return true; 417 | } 418 | 419 | @Override 420 | public Builder mergeFrom( 421 | com.google.protobuf.CodedInputStream input, 422 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 423 | throws java.io.IOException { 424 | com.webank.wedpr.scd.proto.TemplatePublicKey parsedMessage = null; 425 | try { 426 | parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); 427 | } catch (com.google.protobuf.InvalidProtocolBufferException e) { 428 | parsedMessage = (com.webank.wedpr.scd.proto.TemplatePublicKey) e.getUnfinishedMessage(); 429 | throw e.unwrapIOException(); 430 | } finally { 431 | if (parsedMessage != null) { 432 | mergeFrom(parsedMessage); 433 | } 434 | } 435 | return this; 436 | } 437 | 438 | private Object key_ = ""; 439 | /** string 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.Parser PARSER = 518 | new com.google.protobuf.AbstractParser() { 519 | @Override 520 | public TemplatePublicKey parsePartialFrom( 521 | com.google.protobuf.CodedInputStream input, 522 | com.google.protobuf.ExtensionRegistryLite extensionRegistry) 523 | throws com.google.protobuf.InvalidProtocolBufferException { 524 | return new TemplatePublicKey(input, extensionRegistry); 525 | } 526 | }; 527 | 528 | public static com.google.protobuf.Parser parser() { 529 | return PARSER; 530 | } 531 | 532 | @Override 533 | public com.google.protobuf.Parser getParserForType() { 534 | return PARSER; 535 | } 536 | 537 | @Override 538 | public com.webank.wedpr.scd.proto.TemplatePublicKey getDefaultInstanceForType() { 539 | return DEFAULT_INSTANCE; 540 | } 541 | } 542 | -------------------------------------------------------------------------------- /demo/app/src/main/java/com/webank/wedpr/scd/proto/TemplatePublicKeyOrBuilder.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 TemplatePublicKeyOrBuilder 7 | extends 8 | // @@protoc_insertion_point(interface_extends:com.webank.wedpr.scd.proto.TemplatePublicKey) 9 | com.google.protobuf.MessageOrBuilder { 10 | 11 | /** string 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.List getRevealedAttributeNameList(); 13 | /** repeated 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.List getAttributePredicateList(); 22 | /** repeated .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 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 | *

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 | List schema = Arrays.asList(NAME, AGE, GENDER, ISSUE_TIME); 176 | System.out.println("Encoded schema = " + schema); 177 | 178 | IssuerResult issuerResult = issuerClient.makeCertificateTemplate(schema); 179 | 180 | String certificateTemplate = issuerResult.certificateTemplate; 181 | String templatePrivateKey = issuerResult.templatePrivateKey; 182 | System.out.println("Encoded certificateTemplate = " + certificateTemplate); 183 | System.out.println("Encoded templatePrivateKey = " + templatePrivateKey); 184 | 185 | // A user fills the certificate template and prepares a request for the issuer to sign. 186 | Map certificateDataInput = new HashMap<>(); 187 | // TODO: Add a utility function to convert any string to a decimal string. 188 | // Before this utility function is implemented, the attribute value can only be a decimal 189 | // string. 190 | certificateDataInput.put(NAME, "123"); 191 | certificateDataInput.put(AGE, "19"); 192 | certificateDataInput.put(GENDER, "1"); 193 | certificateDataInput.put(ISSUE_TIME, "12345"); 194 | String certificateData = userClient.encodeAttributeDict(certificateDataInput); 195 | UserResult userResult = userClient.fillCertificate(certificateData, certificateTemplate); 196 | 197 | String signCertificateRequest = userResult.signCertificateRequest; 198 | String userPrivateKey = userResult.userPrivateKey; 199 | String certificateSecretsBlindingFactors = userResult.certificateSecretsBlindingFactors; 200 | String userNonce = userResult.userNonce; 201 | System.out.println("Encoded signCertificateRequest = " + signCertificateRequest); 202 | System.out.println("Encoded userPrivateKey = " + userPrivateKey); 203 | System.out.println( 204 | "Encoded certificateSecretsBlindingFactors = " + certificateSecretsBlindingFactors); 205 | System.out.println("Encoded userNonce = " + userNonce); 206 | 207 | // The issuer verifies the certificate signing request from the user and signs the certificate. 208 | issuerResult = 209 | issuerClient.signCertificate( 210 | certificateTemplate, 211 | templatePrivateKey, 212 | signCertificateRequest, 213 | DEFAULT_USER_ID, 214 | userNonce); 215 | 216 | String certificateSignature = issuerResult.certificateSignature; 217 | String issuerNonce = issuerResult.issuerNonce; 218 | System.out.println("Encoded certificateSignature = " + certificateSignature); 219 | System.out.println("Encoded issuerNonce = " + issuerNonce); 220 | 221 | // The user blinds the received certificateSignature to prevent the issuer to track the 222 | // certificate usage. 223 | userResult = 224 | userClient.blindCertificateSignature( 225 | certificateSignature, 226 | certificateData, 227 | certificateTemplate, 228 | userPrivateKey, 229 | certificateSecretsBlindingFactors, 230 | issuerNonce); 231 | 232 | String blindedCertificateSignature = userResult.certificateSignature; 233 | System.out.println("Encoded blindedCertificateSignature = " + blindedCertificateSignature); 234 | 235 | // A verifier sets a verification rule to: 236 | // Check AGE > 18 and, 237 | VerificationRuleSet.Builder verificationRuleSetBuilder = VerificationRuleSet.newBuilder(); 238 | Predicate predicate = 239 | Predicate.newBuilder() 240 | .setAttributeName(AGE) 241 | .setPredicateType(PredicateType.GT.name()) 242 | .setPredicateValue(18) 243 | .build(); 244 | verificationRuleSetBuilder.addAttributePredicate(predicate); 245 | // Reveal the ISSUE_TIME attribute. 246 | verificationRuleSetBuilder.addRevealedAttributeName(ISSUE_TIME); 247 | 248 | String encodedVerificationRuleSet = 249 | verifierClient.protoToEncodedString(verificationRuleSetBuilder.build()); 250 | System.out.println("Encoded verificationRuleSet = " + encodedVerificationRuleSet); 251 | 252 | String verificationNonce = verifierClient.getVerificationNonce().verificationNonce; 253 | 254 | // The user proves the signed certificate data satisfying the verification rules and does not 255 | // reveal any extra data. 256 | userResult = 257 | userClient.proveSelectiveDisclosure( 258 | encodedVerificationRuleSet, 259 | blindedCertificateSignature, 260 | certificateData, 261 | certificateTemplate, 262 | userPrivateKey, 263 | verificationNonce); 264 | 265 | String verifyRequest = userResult.verifyRequest; 266 | System.out.println("Encoded verifyRequest = " + verifyRequest); 267 | 268 | // The verifier verifies the required verification rule is satisfied and extracts the required 269 | // attribute. 270 | // This verification should be done before calling revealedAttributeDict. 271 | VerifierResult verifierResult = 272 | verifierClient.verifySelectiveDisclosure(encodedVerificationRuleSet, verifyRequest); 273 | System.out.println("Proof verification result = " + verifierResult.boolResult); 274 | 275 | verifierResult = verifierClient.getRevealedAttributes(verifyRequest); 276 | String encodedRevealedCertificateData = verifierResult.revealedAttributeDict; 277 | AttributeDict revealedCertificateData = 278 | AttributeDict.parseFrom(Utils.stringToBytes(encodedRevealedCertificateData)); 279 | System.out.println("revealedCertificateData =" + revealedCertificateData); 280 | } 281 | 282 | private static void KtbDemo(HdkClient hdkClient) 283 | throws Exception { 284 | System.out.println("\n*******\nKTB DEMO RUN\n*******"); 285 | 286 | HdkResult hdkResult = hdkClient.createMnemonicEn(24); 287 | String mnemonic = hdkResult.mnemonic; 288 | System.out.println("mnemonic = " + mnemonic); 289 | 290 | String password = "Do not use real password"; 291 | hdkResult = hdkClient.createMasterKeyEn(password, mnemonic); 292 | String masterKey = hdkResult.masterKey; 293 | System.out.println("masterKey = " + masterKey); 294 | 295 | int purposeType = 44; 296 | int assetType = 513866; 297 | int account = 1; 298 | int change = 0; 299 | int addressIndex = 1000; 300 | hdkResult = 301 | hdkClient.deriveExtendedKey( 302 | masterKey, purposeType, assetType, account, change, addressIndex); 303 | String extendedPrivateKey = hdkResult.extendedPrivateKey; 304 | String extendedPublicKey = hdkResult.extendedPublicKey; 305 | System.out.println("extendedPrivateKey = " + extendedPrivateKey); 306 | System.out.println("extendedPublicKey = " + extendedPublicKey); 307 | } 308 | } -------------------------------------------------------------------------------- /demo/app/src/main/jniLibs/arm64-v8a/.blank_file: -------------------------------------------------------------------------------- 1 | Have a good day :D 2 | -------------------------------------------------------------------------------- /demo/app/src/main/jniLibs/armeabi-v7a/.blank_file: -------------------------------------------------------------------------------- 1 | Have a good day :D 2 | -------------------------------------------------------------------------------- /demo/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 8 | 9 | 15 | 18 | 21 | 22 | 23 | 24 | 30 | -------------------------------------------------------------------------------- /demo/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /demo/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 | -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/demo/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/demo/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/demo/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/demo/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/demo/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/demo/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/demo/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/demo/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/demo/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /demo/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #6200EE 4 | #3700B3 5 | #03DAC5 6 | -------------------------------------------------------------------------------- /demo/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | WeDPRDemo 3 | -------------------------------------------------------------------------------- /demo/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 9 | 10 | -------------------------------------------------------------------------------- /demo/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | buildscript { 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath "com.android.tools.build:gradle:4.0.1" 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | google() 18 | jcenter() 19 | } 20 | } 21 | 22 | task clean(type: Delete) { 23 | delete rootProject.buildDir 24 | } -------------------------------------------------------------------------------- /demo/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx2048m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /demo/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/demo/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /demo/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Oct 12 14:35:07 CST 2020 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip 7 | -------------------------------------------------------------------------------- /demo/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /demo/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /demo/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | rootProject.name = "WedprAndroidDemo" -------------------------------------------------------------------------------- /release_note.txt: -------------------------------------------------------------------------------- 1 | v0.3.0 2 | -------------------------------------------------------------------------------- /sdk/extract-lib-subproject-to-here.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/WeBankBlockchain/WeDPR-Lab-Android-SDK/d6c62a403d806bd60f0ecb2682a993ed1246da4d/sdk/extract-lib-subproject-to-here.txt --------------------------------------------------------------------------------