@onekeyfe/react-native-lite-card 6.7.0-21 → 6.7.0-22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/README.md +9 -1
  2. package/ReactNativeLiteCard.podspec +25 -2
  3. package/android/build.gradle +7 -0
  4. package/android/src/main/cpp/CMakeLists.txt +6 -2
  5. package/android/src/main/java/com/onekeyfe/reactnativelitecard/ReactNativeLiteCardModule.kt +29 -11
  6. package/android/src/main/java/com/onekeyfe/reactnativelitecard/nfc/gpchannel/GPChannelNatives.kt +7 -7
  7. package/android/src/main/java/com/onekeyfe/reactnativelitecard/onekeyLite/OnekeyLiteCard.kt +14 -3
  8. package/android/src/main/java/com/onekeyfe/reactnativelitecard/onekeyLite/entitys/SendResponse.kt +6 -3
  9. package/android/src/main/java/com/onekeyfe/reactnativelitecard/onekeyLite/nfc/CommandGenerator.kt +5 -1
  10. package/android/src/main/java/com/onekeyfe/reactnativelitecard/onekeyLite/nfc/Connection.kt +36 -17
  11. package/android/src/main/java/com/onekeyfe/reactnativelitecard/onekeyLite/nfc/GPCAPDUGenerator.kt +2 -2
  12. package/ios/Classes/OKLiteCommand/OKLiteCommandTool.m +4 -1
  13. package/ios/Classes/OKNFCBridge.mm +1 -1
  14. package/ios/Classes/OKNFTLite/OKLiteV1.m +6 -3
  15. package/ios/Classes/OKNFTLite/OKLiteV2.m +13 -5
  16. package/ios/Classes/OKNFTLite/OKNFCManager.m +26 -6
  17. package/ios/ReactNativeLiteCard.mm +16 -7
  18. package/package.json +8 -8
  19. package/sdk/CMakeLists.txt +120 -0
  20. package/sdk/README.md +175 -0
  21. package/sdk/android/implJni.cpp +177 -0
  22. package/sdk/deps/jsoncpp/LICENSE +55 -0
  23. package/sdk/deps/jsoncpp/include/CMakeLists.txt +2 -0
  24. package/sdk/deps/jsoncpp/include/json/allocator.h +98 -0
  25. package/sdk/deps/jsoncpp/include/json/assertions.h +54 -0
  26. package/sdk/deps/jsoncpp/include/json/autolink.h +25 -0
  27. package/sdk/deps/jsoncpp/include/json/config.h +187 -0
  28. package/sdk/deps/jsoncpp/include/json/features.h +61 -0
  29. package/sdk/deps/jsoncpp/include/json/forwards.h +37 -0
  30. package/sdk/deps/jsoncpp/include/json/json.h +15 -0
  31. package/sdk/deps/jsoncpp/include/json/reader.h +411 -0
  32. package/sdk/deps/jsoncpp/include/json/value.h +888 -0
  33. package/sdk/deps/jsoncpp/include/json/version.h +20 -0
  34. package/sdk/deps/jsoncpp/include/json/writer.h +357 -0
  35. package/sdk/deps/jsoncpp/src/lib_json/CMakeLists.txt +117 -0
  36. package/sdk/deps/jsoncpp/src/lib_json/json_reader.cpp +2060 -0
  37. package/sdk/deps/jsoncpp/src/lib_json/json_tool.h +114 -0
  38. package/sdk/deps/jsoncpp/src/lib_json/json_value.cpp +1661 -0
  39. package/sdk/deps/jsoncpp/src/lib_json/json_valueiterator.inl +167 -0
  40. package/sdk/deps/jsoncpp/src/lib_json/json_writer.cpp +1233 -0
  41. package/sdk/deps/jsoncpp/src/lib_json/version.h.in +20 -0
  42. package/sdk/deps/trezor-crypto/AUTHORS +2 -0
  43. package/sdk/deps/trezor-crypto/LICENSE +22 -0
  44. package/sdk/deps/trezor-crypto/include/TrezorCrypto/TrezorCrypto.h +29 -0
  45. package/sdk/deps/trezor-crypto/include/TrezorCrypto/address.h +44 -0
  46. package/sdk/deps/trezor-crypto/include/TrezorCrypto/aes.h +224 -0
  47. package/sdk/deps/trezor-crypto/include/TrezorCrypto/base32.h +49 -0
  48. package/sdk/deps/trezor-crypto/include/TrezorCrypto/base58.h +58 -0
  49. package/sdk/deps/trezor-crypto/include/TrezorCrypto/bignum.h +169 -0
  50. package/sdk/deps/trezor-crypto/include/TrezorCrypto/bip32.h +114 -0
  51. package/sdk/deps/trezor-crypto/include/TrezorCrypto/bip39.h +66 -0
  52. package/sdk/deps/trezor-crypto/include/TrezorCrypto/blake256.h +61 -0
  53. package/sdk/deps/trezor-crypto/include/TrezorCrypto/blake2b.h +50 -0
  54. package/sdk/deps/trezor-crypto/include/TrezorCrypto/blake2s.h +49 -0
  55. package/sdk/deps/trezor-crypto/include/TrezorCrypto/cash_addr.h +109 -0
  56. package/sdk/deps/trezor-crypto/include/TrezorCrypto/chacha20poly1305/ecrypt-config.h +316 -0
  57. package/sdk/deps/trezor-crypto/include/TrezorCrypto/chacha20poly1305/ecrypt-sync.h +289 -0
  58. package/sdk/deps/trezor-crypto/include/TrezorCrypto/chacha20poly1305/ecrypt-types.h +53 -0
  59. package/sdk/deps/trezor-crypto/include/TrezorCrypto/chacha20poly1305/poly1305-donna.h +28 -0
  60. package/sdk/deps/trezor-crypto/include/TrezorCrypto/chacha20poly1305.h +27 -0
  61. package/sdk/deps/trezor-crypto/include/TrezorCrypto/cmac.h +44 -0
  62. package/sdk/deps/trezor-crypto/include/TrezorCrypto/curves.h +60 -0
  63. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ecdsa.h +112 -0
  64. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/curve25519-donna-32bit.h +87 -0
  65. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/curve25519-donna-helpers.h +30 -0
  66. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-blake2b.h +21 -0
  67. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-donna-32bit-tables.h +25 -0
  68. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-donna-basepoint-table.h +10 -0
  69. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-donna-impl-base.h +110 -0
  70. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-donna-portable.h +32 -0
  71. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-donna.h +60 -0
  72. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-keccak.h +21 -0
  73. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/ed25519-sha3.h +21 -0
  74. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna/modm-donna-32bit.h +87 -0
  75. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519-donna.h +60 -0
  76. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ed25519.h +42 -0
  77. package/sdk/deps/trezor-crypto/include/TrezorCrypto/endian.h +132 -0
  78. package/sdk/deps/trezor-crypto/include/TrezorCrypto/groestl.h +104 -0
  79. package/sdk/deps/trezor-crypto/include/TrezorCrypto/hasher.h +90 -0
  80. package/sdk/deps/trezor-crypto/include/TrezorCrypto/hmac.h +60 -0
  81. package/sdk/deps/trezor-crypto/include/TrezorCrypto/memzero.h +16 -0
  82. package/sdk/deps/trezor-crypto/include/TrezorCrypto/monero/base58.h +42 -0
  83. package/sdk/deps/trezor-crypto/include/TrezorCrypto/monero/monero.h +13 -0
  84. package/sdk/deps/trezor-crypto/include/TrezorCrypto/monero/range_proof.h +30 -0
  85. package/sdk/deps/trezor-crypto/include/TrezorCrypto/monero/serialize.h +15 -0
  86. package/sdk/deps/trezor-crypto/include/TrezorCrypto/monero/xmr.h +67 -0
  87. package/sdk/deps/trezor-crypto/include/TrezorCrypto/nano.h +56 -0
  88. package/sdk/deps/trezor-crypto/include/TrezorCrypto/nem.h +199 -0
  89. package/sdk/deps/trezor-crypto/include/TrezorCrypto/nist256p1.h +35 -0
  90. package/sdk/deps/trezor-crypto/include/TrezorCrypto/pbkdf2.h +64 -0
  91. package/sdk/deps/trezor-crypto/include/TrezorCrypto/rand.h +44 -0
  92. package/sdk/deps/trezor-crypto/include/TrezorCrypto/rc4.h +37 -0
  93. package/sdk/deps/trezor-crypto/include/TrezorCrypto/rfc6979.h +40 -0
  94. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ripemd160.h +28 -0
  95. package/sdk/deps/trezor-crypto/include/TrezorCrypto/ripple/base58.h +45 -0
  96. package/sdk/deps/trezor-crypto/include/TrezorCrypto/schnorr.h +48 -0
  97. package/sdk/deps/trezor-crypto/include/TrezorCrypto/script.h +30 -0
  98. package/sdk/deps/trezor-crypto/include/TrezorCrypto/scrypt.h +68 -0
  99. package/sdk/deps/trezor-crypto/include/TrezorCrypto/secp256k1.h +59 -0
  100. package/sdk/deps/trezor-crypto/include/TrezorCrypto/sha2.h +125 -0
  101. package/sdk/deps/trezor-crypto/include/TrezorCrypto/sha3.h +86 -0
  102. package/sdk/deps/trezor-crypto/include/TrezorCrypto/sodium/keypair.h +20 -0
  103. package/sdk/deps/trezor-crypto/include/TrezorCrypto/sodium/private/ed25519_ref10.h +85 -0
  104. package/sdk/deps/trezor-crypto/include/TrezorCrypto/sodium/private/ed25519_ref10_fe_25_5.h +43 -0
  105. package/sdk/deps/trezor-crypto/include/TrezorCrypto/sodium/private/fe_25_5/constants.h +29 -0
  106. package/sdk/deps/trezor-crypto/include/TrezorCrypto/sodium/private/fe_25_5/fe.h +25 -0
  107. package/sdk/deps/trezor-crypto/src/address.c +87 -0
  108. package/sdk/deps/trezor-crypto/src/aes/aes_modes.c +959 -0
  109. package/sdk/deps/trezor-crypto/src/aes/aescrypt.c +307 -0
  110. package/sdk/deps/trezor-crypto/src/aes/aeskey.c +560 -0
  111. package/sdk/deps/trezor-crypto/src/aes/aesopt.h +784 -0
  112. package/sdk/deps/trezor-crypto/src/aes/aestab.c +418 -0
  113. package/sdk/deps/trezor-crypto/src/aes/aestab.h +173 -0
  114. package/sdk/deps/trezor-crypto/src/base32.c +233 -0
  115. package/sdk/deps/trezor-crypto/src/base58.c +298 -0
  116. package/sdk/deps/trezor-crypto/src/bignum.c +808 -0
  117. package/sdk/deps/trezor-crypto/src/bip32.c +852 -0
  118. package/sdk/deps/trezor-crypto/src/bip39.c +266 -0
  119. package/sdk/deps/trezor-crypto/src/bip39_english.h +2074 -0
  120. package/sdk/deps/trezor-crypto/src/blake256.c +235 -0
  121. package/sdk/deps/trezor-crypto/src/blake2_common.h +39 -0
  122. package/sdk/deps/trezor-crypto/src/blake2b.c +333 -0
  123. package/sdk/deps/trezor-crypto/src/blake2s.c +318 -0
  124. package/sdk/deps/trezor-crypto/src/cash_addr.c +195 -0
  125. package/sdk/deps/trezor-crypto/src/chacha20poly1305/chacha20poly1305.c +60 -0
  126. package/sdk/deps/trezor-crypto/src/chacha20poly1305/chacha_merged.c +246 -0
  127. package/sdk/deps/trezor-crypto/src/chacha20poly1305/ecrypt-machine.h +49 -0
  128. package/sdk/deps/trezor-crypto/src/chacha20poly1305/ecrypt-portable.h +275 -0
  129. package/sdk/deps/trezor-crypto/src/chacha20poly1305/poly1305-donna-32.h +219 -0
  130. package/sdk/deps/trezor-crypto/src/chacha20poly1305/poly1305-donna.c +179 -0
  131. package/sdk/deps/trezor-crypto/src/chacha20poly1305/rfc7539.c +48 -0
  132. package/sdk/deps/trezor-crypto/src/chacha20poly1305/rfc7539.h +10 -0
  133. package/sdk/deps/trezor-crypto/src/check_mem.h +30 -0
  134. package/sdk/deps/trezor-crypto/src/cmac.c +342 -0
  135. package/sdk/deps/trezor-crypto/src/curves.c +48 -0
  136. package/sdk/deps/trezor-crypto/src/ecdsa.c +1355 -0
  137. package/sdk/deps/trezor-crypto/src/ed25519-donna/README.md +183 -0
  138. package/sdk/deps/trezor-crypto/src/ed25519-donna/curve25519-donna-32bit.c +681 -0
  139. package/sdk/deps/trezor-crypto/src/ed25519-donna/curve25519-donna-helpers.c +66 -0
  140. package/sdk/deps/trezor-crypto/src/ed25519-donna/curve25519-donna-scalarmult-base.c +67 -0
  141. package/sdk/deps/trezor-crypto/src/ed25519-donna/curve25519-donna-scalarmult-base.h +8 -0
  142. package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-blake2b.c +8 -0
  143. package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-donna-32bit-tables.c +63 -0
  144. package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-donna-basepoint-table.c +261 -0
  145. package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-donna-impl-base.c +722 -0
  146. package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-hash-custom-blake2b.h +23 -0
  147. package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-hash-custom-keccak.h +23 -0
  148. package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-hash-custom-sha3.h +23 -0
  149. package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-hash-custom.h +23 -0
  150. package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-keccak.c +8 -0
  151. package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519-sha3.c +8 -0
  152. package/sdk/deps/trezor-crypto/src/ed25519-donna/ed25519.c +311 -0
  153. package/sdk/deps/trezor-crypto/src/ed25519-donna/modm-donna-32bit.c +517 -0
  154. package/sdk/deps/trezor-crypto/src/groestl.c +783 -0
  155. package/sdk/deps/trezor-crypto/src/groestl_internal.h +419 -0
  156. package/sdk/deps/trezor-crypto/src/hasher.c +186 -0
  157. package/sdk/deps/trezor-crypto/src/hmac.c +179 -0
  158. package/sdk/deps/trezor-crypto/src/memzero.c +6 -0
  159. package/sdk/deps/trezor-crypto/src/monero/base58.c +245 -0
  160. package/sdk/deps/trezor-crypto/src/monero/int-util.h +77 -0
  161. package/sdk/deps/trezor-crypto/src/monero/range_proof.c +115 -0
  162. package/sdk/deps/trezor-crypto/src/monero/serialize.c +54 -0
  163. package/sdk/deps/trezor-crypto/src/monero/xmr.c +136 -0
  164. package/sdk/deps/trezor-crypto/src/nano.c +151 -0
  165. package/sdk/deps/trezor-crypto/src/nem.c +569 -0
  166. package/sdk/deps/trezor-crypto/src/nist256p1.c +63 -0
  167. package/sdk/deps/trezor-crypto/src/nist256p1.table +1664 -0
  168. package/sdk/deps/trezor-crypto/src/options.h +43 -0
  169. package/sdk/deps/trezor-crypto/src/pbkdf2.c +177 -0
  170. package/sdk/deps/trezor-crypto/src/rand.c +51 -0
  171. package/sdk/deps/trezor-crypto/src/rc4.c +56 -0
  172. package/sdk/deps/trezor-crypto/src/ripemd160.c +343 -0
  173. package/sdk/deps/trezor-crypto/src/ripple/base58.c +76 -0
  174. package/sdk/deps/trezor-crypto/src/schnorr.c +208 -0
  175. package/sdk/deps/trezor-crypto/src/script.c +64 -0
  176. package/sdk/deps/trezor-crypto/src/scrypt.c +343 -0
  177. package/sdk/deps/trezor-crypto/src/secp256k1.c +160 -0
  178. package/sdk/deps/trezor-crypto/src/secp256k1.table +1664 -0
  179. package/sdk/deps/trezor-crypto/src/setup.py +38 -0
  180. package/sdk/deps/trezor-crypto/src/sha2.c +1314 -0
  181. package/sdk/deps/trezor-crypto/src/sha3.c +395 -0
  182. package/sdk/deps/trezor-crypto/src/shell.nix +6 -0
  183. package/sdk/deps/trezor-crypto/src/sodium/keypair.c +63 -0
  184. package/sdk/deps/trezor-crypto/src/sodium/private/ed25519_ref10.c +481 -0
  185. package/sdk/deps/trezor-crypto/src/sodium/private/ed25519_ref10_fe_25_5.c +885 -0
  186. package/sdk/deps/trezor-crypto/src/sodium/private/fe_25_5/fe.c +237 -0
  187. package/sdk/gpc/include/scp03/scp03.hpp +80 -0
  188. package/sdk/gpc/include/scp11/scp11.hpp +492 -0
  189. package/sdk/gpc/include/scp11/scp11c.hpp +58 -0
  190. package/sdk/gpc/include/tag.h +68 -0
  191. package/sdk/gpc/include/tlv.hpp +94 -0
  192. package/sdk/gpc/include/tlvparse.hpp +24 -0
  193. package/sdk/gpc/src/scp03.cpp +243 -0
  194. package/sdk/gpc/src/scp11.cpp +798 -0
  195. package/sdk/gpc/src/scp11c.cpp +136 -0
  196. package/sdk/gpc/src/tlv.cpp +159 -0
  197. package/sdk/gpc/src/tlvparse.c +174 -0
  198. package/{framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/Headers → sdk/include}/GPChannelSDK.h +0 -0
  199. package/sdk/include/GPChannelSDKCore.h +10 -0
  200. package/sdk/include/context/BaseContext.h +56 -0
  201. package/sdk/include/device/ApduBuilder.hpp +72 -0
  202. package/sdk/include/mSIGNA/stdutils/uchar_vector.h +36 -0
  203. package/sdk/include/utility/Apdu.hpp +172 -0
  204. package/sdk/include/utility/Debug.hpp +3 -0
  205. package/sdk/include/utility/util.h +104 -0
  206. package/sdk/src/ApduBuilder.cpp +332 -0
  207. package/sdk/src/GPChannelSDK.cpp +252 -0
  208. package/sdk/src/random.c +25 -0
  209. package/sdk/src/version.c +2 -0
  210. package/sdk/tests/android/GPChannelProxy.java +55 -0
  211. package/sdk/tests/android_verify.py +121 -0
  212. package/sdk/tests/safety.cpp +603 -0
  213. package/sdk/tests/verify.py +267 -0
  214. package/android/src/main/jniLibs/arm64-v8a/libgpchannelNDK.so +0 -0
  215. package/android/src/main/jniLibs/armeabi-v7a/libgpchannelNDK.so +0 -0
  216. package/framework/GPChannelSDKCore.xcframework/Info.plist +0 -52
  217. package/framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/GPChannelSDKCore +0 -0
  218. package/framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/Headers/GPChannelSDKCore.h +0 -19
  219. package/framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/Info.plist +0 -0
  220. package/framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/Modules/module.modulemap +0 -7
  221. package/framework/GPChannelSDKCore.xcframework/ios-arm64/GPChannelSDKCore.framework/_CodeSignature/CodeResources +0 -147
  222. package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/GPChannelSDKCore +0 -0
  223. package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/Headers/GPChannelSDK.h +0 -315
  224. package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/Headers/GPChannelSDKCore.h +0 -19
  225. package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/Info.plist +0 -0
  226. package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/Modules/module.modulemap +0 -7
  227. package/framework/GPChannelSDKCore.xcframework/ios-arm64_x86_64-simulator/GPChannelSDKCore.framework/_CodeSignature/CodeResources +0 -147
@@ -0,0 +1,177 @@
1
+ // Recovered JNI contract from ziancube/GPChannel-test.
2
+ #include <jni.h>
3
+ #include <atomic>
4
+ #include <string>
5
+ #include "GPChannelSDK.h"
6
+ #include "json/json.h"
7
+
8
+ namespace {
9
+ std::atomic<int> errorCode{0};
10
+ class UtfChars {
11
+ public:
12
+ UtfChars(JNIEnv* env, jstring value) : env(env), value(value),
13
+ chars(value ? env->GetStringUTFChars(value, nullptr) : nullptr) {}
14
+ ~UtfChars() { if (chars) env->ReleaseStringUTFChars(value, chars); }
15
+ const char* get() const { return chars; }
16
+ private:
17
+ JNIEnv* env;
18
+ jstring value;
19
+ const char* chars;
20
+ };
21
+ class Output {
22
+ public:
23
+ char* value = nullptr;
24
+ ~Output() { if (value) JUB_FreeMemory(value); }
25
+ };
26
+ jstring json(JNIEnv* env, const Json::Value& value) {
27
+ return env->NewStringUTF(Json::FastWriter().write(value).c_str());
28
+ }
29
+ jstring result(JNIEnv* env, JUB_RV code, const Output& output) {
30
+ if (code != JUBR_OK) { errorCode.store(static_cast<int>(code)); return nullptr; }
31
+ return env->NewStringUTF(output.value);
32
+ }
33
+ jint getError(JNIEnv*, jobject) { return errorCode.load(); }
34
+ jint initialize(JNIEnv* env, jobject, jstring input) {
35
+ try {
36
+ UtfChars text(env, input);
37
+ if (!text.get()) return JUBR_ARGUMENTS_BAD;
38
+ Json::Value root;
39
+ Json::Reader reader;
40
+ if (!reader.parse(text.get(), root) || !root.isObject()) return JUBR_ARGUMENTS_BAD;
41
+ const char* fields[] = {"scpID", "keyUsage", "keyType", "hostID", "cardGroupID", "crt", "sk"};
42
+ for (const char* name : fields) if (!root[name].isString()) return JUBR_ARGUMENTS_BAD;
43
+ if (!root["keyLength"].isUInt() || root["keyLength"].asUInt() != 16) return JUBR_ARGUMENTS_BAD;
44
+ GPC_SCP11_SHAREDINFO info{
45
+ const_cast<char*>(root["scpID"].asCString()),
46
+ const_cast<char*>(root["keyUsage"].asCString()),
47
+ const_cast<char*>(root["keyType"].asCString()),
48
+ const_cast<char*>("10"),
49
+ const_cast<char*>(root["hostID"].asCString()),
50
+ const_cast<char*>(root["cardGroupID"].asCString())};
51
+ return static_cast<jint>(JUB_GPC_Initialize(info, root["crt"].asCString(), root["sk"].asCString()));
52
+ } catch (...) {
53
+ errorCode.store(static_cast<int>(JUBR_ARGUMENTS_BAD));
54
+ return JUBR_ARGUMENTS_BAD;
55
+ }
56
+ }
57
+ jint finalize(JNIEnv*, jobject) {
58
+ try {
59
+ return static_cast<jint>(JUB_GPC_Finalize());
60
+ } catch (...) {
61
+ return JUBR_ERROR;
62
+ }
63
+ }
64
+ jint open(JNIEnv* env, jobject, jstring input) {
65
+ try {
66
+ UtfChars text(env, input);
67
+ if (!text.get()) return JUBR_ARGUMENTS_BAD;
68
+ return static_cast<jint>(JUB_GPC_OpenSecureChannel(text.get()));
69
+ } catch (...) {
70
+ errorCode.store(static_cast<int>(JUBR_ARGUMENTS_BAD));
71
+ return JUBR_ARGUMENTS_BAD;
72
+ }
73
+ }
74
+ jstring mutual(JNIEnv* env, jobject) {
75
+ try {
76
+ Output output;
77
+ auto code = JUB_GPC_BuildMutualAuthData(&output.value);
78
+ return result(env, code, output);
79
+ } catch (...) {
80
+ errorCode.store(static_cast<int>(JUBR_ERROR));
81
+ return nullptr;
82
+ }
83
+ }
84
+ jstring build(JNIEnv* env, bool safe, jlong cla, jlong ins, jlong p1, jlong p2, jstring input) {
85
+ try {
86
+ UtfChars text(env, input);
87
+ Output output;
88
+ auto code = safe ? JUB_GPC_BuildSafeAPDU(cla, ins, p1, p2, text.get(), &output.value)
89
+ : JUB_GPC_BuildAPDU(cla, ins, p1, p2, text.get(), &output.value);
90
+ return result(env, code, output);
91
+ } catch (...) {
92
+ errorCode.store(static_cast<int>(JUBR_ERROR));
93
+ return nullptr;
94
+ }
95
+ }
96
+ jstring buildPlain(JNIEnv* env, jobject, jlong cla, jlong ins, jlong p1, jlong p2, jstring input) {
97
+ return build(env, false, cla, ins, p1, p2, input);
98
+ }
99
+ jstring buildSafe(JNIEnv* env, jobject, jlong cla, jlong ins, jlong p1, jlong p2, jstring input) {
100
+ return build(env, true, cla, ins, p1, p2, input);
101
+ }
102
+ jstring parse(JNIEnv* env, bool safe, jstring input) {
103
+ try {
104
+ UtfChars text(env, input);
105
+ Output output;
106
+ JUB_UINT16 word = 0;
107
+ auto code = safe ? JUB_GPC_ParseSafeAPDUResponse(text.get(), &word, &output.value)
108
+ : JUB_GPC_ParseAPDUResponse(text.get(), &word, &output.value);
109
+ if (code != JUBR_OK) { errorCode.store(static_cast<int>(code)); return nullptr; }
110
+ Json::Value root;
111
+ root["wRet"] = word;
112
+ root["response"] = output.value;
113
+ return json(env, root);
114
+ } catch (...) {
115
+ errorCode.store(static_cast<int>(JUBR_ERROR));
116
+ return nullptr;
117
+ }
118
+ }
119
+ jstring parsePlain(JNIEnv* env, jobject, jstring input) { return parse(env, false, input); }
120
+ jstring parseSafe(JNIEnv* env, jobject, jstring input) { return parse(env, true, input); }
121
+ jstring decodeTLV(JNIEnv* env, jobject, jstring input) {
122
+ try {
123
+ UtfChars text(env, input);
124
+ Output output;
125
+ JUB_ULONG tag = 0;
126
+ auto code = JUB_GPC_TLVDecode(text.get(), &tag, &output.value);
127
+ if (code != JUBR_OK) { errorCode.store(static_cast<int>(code)); return nullptr; }
128
+ Json::Value root;
129
+ root["tag"] = static_cast<Json::Int64>(tag);
130
+ root["value"] = output.value;
131
+ return json(env, root);
132
+ } catch (...) {
133
+ errorCode.store(static_cast<int>(JUBR_ERROR));
134
+ return nullptr;
135
+ }
136
+ }
137
+ jstring parseCertificate(JNIEnv* env, jobject, jstring input) {
138
+ try {
139
+ UtfChars text(env, input);
140
+ Output serial, subject;
141
+ auto code = JUB_GPC_ParseCertificate(text.get(), &serial.value, &subject.value);
142
+ if (code != JUBR_OK) { errorCode.store(static_cast<int>(code)); return nullptr; }
143
+ Json::Value root;
144
+ root["sn"] = serial.value;
145
+ root["subjectID"] = subject.value;
146
+ return json(env, root);
147
+ } catch (...) {
148
+ errorCode.store(static_cast<int>(JUBR_ERROR));
149
+ return nullptr;
150
+ }
151
+ }
152
+ #define METHOD(name, signature, function) \
153
+ {const_cast<char*>(name), const_cast<char*>(signature), reinterpret_cast<void*>(function)}
154
+ JNINativeMethod methods[] = {
155
+ METHOD("nativeGetErrorCode", "()I", getError),
156
+ METHOD("nativeGPCInitialize", "(Ljava/lang/String;)I", initialize),
157
+ METHOD("nativeGPCFinalize", "()I", finalize),
158
+ METHOD("nativeGPCBuildMutualAuthData", "()Ljava/lang/String;", mutual),
159
+ METHOD("nativeGPCOpenSecureChannel", "(Ljava/lang/String;)I", open),
160
+ METHOD("nativeGPCBuildAPDU", "(JJJJLjava/lang/String;)Ljava/lang/String;", buildPlain),
161
+ METHOD("nativeGPCBuildSafeAPDU", "(JJJJLjava/lang/String;)Ljava/lang/String;", buildSafe),
162
+ METHOD("nativeGPCParseSafeAPDUResponse", "(Ljava/lang/String;)Ljava/lang/String;", parseSafe),
163
+ METHOD("nativeGPCParseAPDUResponse", "(Ljava/lang/String;)Ljava/lang/String;", parsePlain),
164
+ METHOD("nativeGPCTLVDecode", "(Ljava/lang/String;)Ljava/lang/String;", decodeTLV),
165
+ METHOD("nativeGPCParseCertificate", "(Ljava/lang/String;)Ljava/lang/String;", parseCertificate)
166
+ };
167
+ #undef METHOD
168
+ }
169
+ extern "C" JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
170
+ JNIEnv* env = nullptr;
171
+ if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) return JNI_ERR;
172
+ jclass type = env->FindClass("org/haobtc/onekey/card/gpchannel/GPChannelNatives");
173
+ if (!type) return JNI_ERR;
174
+ auto code = env->RegisterNatives(type, methods, sizeof(methods) / sizeof(methods[0]));
175
+ env->DeleteLocalRef(type);
176
+ return code < 0 ? JNI_ERR : JNI_VERSION_1_6;
177
+ }
@@ -0,0 +1,55 @@
1
+ The JsonCpp library's source code, including accompanying documentation,
2
+ tests and demonstration applications, are licensed under the following
3
+ conditions...
4
+
5
+ Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all
6
+ jurisdictions which recognize such a disclaimer. In such jurisdictions,
7
+ this software is released into the Public Domain.
8
+
9
+ In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
10
+ 2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur and
11
+ The JsonCpp Authors, and is released under the terms of the MIT License (see below).
12
+
13
+ In jurisdictions which recognize Public Domain property, the user of this
14
+ software may choose to accept it either as 1) Public Domain, 2) under the
15
+ conditions of the MIT License (see below), or 3) under the terms of dual
16
+ Public Domain/MIT License conditions described here, as they choose.
17
+
18
+ The MIT License is about as close to Public Domain as a license can get, and is
19
+ described in clear, concise terms at:
20
+
21
+ http://en.wikipedia.org/wiki/MIT_License
22
+
23
+ The full text of the MIT License follows:
24
+
25
+ ========================================================================
26
+ Copyright (c) 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
27
+
28
+ Permission is hereby granted, free of charge, to any person
29
+ obtaining a copy of this software and associated documentation
30
+ files (the "Software"), to deal in the Software without
31
+ restriction, including without limitation the rights to use, copy,
32
+ modify, merge, publish, distribute, sublicense, and/or sell copies
33
+ of the Software, and to permit persons to whom the Software is
34
+ furnished to do so, subject to the following conditions:
35
+
36
+ The above copyright notice and this permission notice shall be
37
+ included in all copies or substantial portions of the Software.
38
+
39
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
40
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
41
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
42
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
43
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
44
+ ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
45
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
46
+ SOFTWARE.
47
+ ========================================================================
48
+ (END LICENSE TEXT)
49
+
50
+ The MIT license is compatible with both the GPL and commercial
51
+ software, affording one all of the rights of Public Domain with the
52
+ minor nuisance of being required to keep the above copyright notice
53
+ and license text in the source code. Note also that by accepting the
54
+ Public Domain "license" you can re-license your copy using whatever
55
+ license you like.
@@ -0,0 +1,2 @@
1
+ FILE(GLOB INCLUDE_FILES "json/*.h")
2
+ INSTALL(FILES ${INCLUDE_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/json)
@@ -0,0 +1,98 @@
1
+ // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
2
+ // Distributed under MIT license, or public domain if desired and
3
+ // recognized in your jurisdiction.
4
+ // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5
+
6
+ #ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED
7
+ #define CPPTL_JSON_ALLOCATOR_H_INCLUDED
8
+
9
+ #include <cstring>
10
+ #include <memory>
11
+
12
+ #pragma pack(push, 8)
13
+
14
+ namespace Json {
15
+ template<typename T>
16
+ class SecureAllocator {
17
+ public:
18
+ // Type definitions
19
+ using value_type = T;
20
+ using pointer = T*;
21
+ using const_pointer = const T*;
22
+ using reference = T&;
23
+ using const_reference = const T&;
24
+ using size_type = std::size_t;
25
+ using difference_type = std::ptrdiff_t;
26
+
27
+ /**
28
+ * Allocate memory for N items using the standard allocator.
29
+ */
30
+ pointer allocate(size_type n) {
31
+ // allocate using "global operator new"
32
+ return static_cast<pointer>(::operator new(n * sizeof(T)));
33
+ }
34
+
35
+ /**
36
+ * Release memory which was allocated for N items at pointer P.
37
+ *
38
+ * The memory block is filled with zeroes before being released.
39
+ * The pointer argument is tagged as "volatile" to prevent the
40
+ * compiler optimizing out this critical step.
41
+ */
42
+ void deallocate(volatile pointer p, size_type n) {
43
+ std::memset(p, 0, n * sizeof(T));
44
+ // free using "global operator delete"
45
+ ::operator delete(p);
46
+ }
47
+
48
+ /**
49
+ * Construct an item in-place at pointer P.
50
+ */
51
+ template<typename... Args>
52
+ void construct(pointer p, Args&&... args) {
53
+ // construct using "placement new" and "perfect forwarding"
54
+ ::new (static_cast<void*>(p)) T(std::forward<Args>(args)...);
55
+ }
56
+
57
+ size_type max_size() const {
58
+ return size_t(-1) / sizeof(T);
59
+ }
60
+
61
+ pointer address( reference x ) const {
62
+ return std::addressof(x);
63
+ }
64
+
65
+ const_pointer address( const_reference x ) const {
66
+ return std::addressof(x);
67
+ }
68
+
69
+ /**
70
+ * Destroy an item in-place at pointer P.
71
+ */
72
+ void destroy(pointer p) {
73
+ // destroy using "explicit destructor"
74
+ p->~T();
75
+ }
76
+
77
+ // Boilerplate
78
+ SecureAllocator() {}
79
+ template<typename U> SecureAllocator(const SecureAllocator<U>&) {}
80
+ template<typename U> struct rebind { using other = SecureAllocator<U>; };
81
+ };
82
+
83
+
84
+ template<typename T, typename U>
85
+ bool operator==(const SecureAllocator<T>&, const SecureAllocator<U>&) {
86
+ return true;
87
+ }
88
+
89
+ template<typename T, typename U>
90
+ bool operator!=(const SecureAllocator<T>&, const SecureAllocator<U>&) {
91
+ return false;
92
+ }
93
+
94
+ } //namespace Json
95
+
96
+ #pragma pack(pop)
97
+
98
+ #endif // CPPTL_JSON_ALLOCATOR_H_INCLUDED
@@ -0,0 +1,54 @@
1
+ // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
2
+ // Distributed under MIT license, or public domain if desired and
3
+ // recognized in your jurisdiction.
4
+ // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5
+
6
+ #ifndef CPPTL_JSON_ASSERTIONS_H_INCLUDED
7
+ #define CPPTL_JSON_ASSERTIONS_H_INCLUDED
8
+
9
+ #include <stdlib.h>
10
+ #include <sstream>
11
+
12
+ #if !defined(JSON_IS_AMALGAMATION)
13
+ #include "config.h"
14
+ #endif // if !defined(JSON_IS_AMALGAMATION)
15
+
16
+ /** It should not be possible for a maliciously designed file to
17
+ * cause an abort() or seg-fault, so these macros are used only
18
+ * for pre-condition violations and internal logic errors.
19
+ */
20
+ #if JSON_USE_EXCEPTION
21
+
22
+ // @todo <= add detail about condition in exception
23
+ # define JSON_ASSERT(condition) \
24
+ {if (!(condition)) {Json::throwLogicError( "assert json failed" );}}
25
+
26
+ # define JSON_FAIL_MESSAGE(message) \
27
+ { \
28
+ JSONCPP_OSTRINGSTREAM oss; oss << message; \
29
+ Json::throwLogicError(oss.str()); \
30
+ abort(); \
31
+ }
32
+
33
+ #else // JSON_USE_EXCEPTION
34
+
35
+ # define JSON_ASSERT(condition) assert(condition)
36
+
37
+ // The call to assert() will show the failure message in debug builds. In
38
+ // release builds we abort, for a core-dump or debugger.
39
+ # define JSON_FAIL_MESSAGE(message) \
40
+ { \
41
+ JSONCPP_OSTRINGSTREAM oss; oss << message; \
42
+ assert(false && oss.str().c_str()); \
43
+ abort(); \
44
+ }
45
+
46
+
47
+ #endif
48
+
49
+ #define JSON_ASSERT_MESSAGE(condition, message) \
50
+ if (!(condition)) { \
51
+ JSON_FAIL_MESSAGE(message); \
52
+ }
53
+
54
+ #endif // CPPTL_JSON_ASSERTIONS_H_INCLUDED
@@ -0,0 +1,25 @@
1
+ // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
2
+ // Distributed under MIT license, or public domain if desired and
3
+ // recognized in your jurisdiction.
4
+ // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5
+
6
+ #ifndef JSON_AUTOLINK_H_INCLUDED
7
+ #define JSON_AUTOLINK_H_INCLUDED
8
+
9
+ #include "config.h"
10
+
11
+ #ifdef JSON_IN_CPPTL
12
+ #include <cpptl/cpptl_autolink.h>
13
+ #endif
14
+
15
+ #if !defined(JSON_NO_AUTOLINK) && !defined(JSON_DLL_BUILD) && \
16
+ !defined(JSON_IN_CPPTL)
17
+ #define CPPTL_AUTOLINK_NAME "json"
18
+ #undef CPPTL_AUTOLINK_DLL
19
+ #ifdef JSON_DLL
20
+ #define CPPTL_AUTOLINK_DLL
21
+ #endif
22
+ #include "autolink.h"
23
+ #endif
24
+
25
+ #endif // JSON_AUTOLINK_H_INCLUDED
@@ -0,0 +1,187 @@
1
+ // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
2
+ // Distributed under MIT license, or public domain if desired and
3
+ // recognized in your jurisdiction.
4
+ // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5
+
6
+ #ifndef JSON_CONFIG_H_INCLUDED
7
+ #define JSON_CONFIG_H_INCLUDED
8
+ #include <stddef.h>
9
+ #include <string> //typedef String
10
+ #include <stdint.h> //typedef int64_t, uint64_t
11
+
12
+ /// If defined, indicates that json library is embedded in CppTL library.
13
+ //# define JSON_IN_CPPTL 1
14
+
15
+ /// If defined, indicates that json may leverage CppTL library
16
+ //# define JSON_USE_CPPTL 1
17
+ /// If defined, indicates that cpptl vector based map should be used instead of
18
+ /// std::map
19
+ /// as Value container.
20
+ //# define JSON_USE_CPPTL_SMALLMAP 1
21
+
22
+ // If non-zero, the library uses exceptions to report bad input instead of C
23
+ // assertion macros. The default is to use exceptions.
24
+ #ifndef JSON_USE_EXCEPTION
25
+ #define JSON_USE_EXCEPTION 1
26
+ #endif
27
+
28
+ /// If defined, indicates that the source file is amalgamated
29
+ /// to prevent private header inclusion.
30
+ /// Remarks: it is automatically defined in the generated amalgamated header.
31
+ // #define JSON_IS_AMALGAMATION
32
+
33
+ #ifdef JSON_IN_CPPTL
34
+ #include <cpptl/config.h>
35
+ #ifndef JSON_USE_CPPTL
36
+ #define JSON_USE_CPPTL 1
37
+ #endif
38
+ #endif
39
+
40
+ #ifdef JSON_IN_CPPTL
41
+ #define JSON_API CPPTL_API
42
+ #elif defined(JSON_DLL_BUILD)
43
+ #if defined(_MSC_VER) || defined(__MINGW32__)
44
+ #define JSON_API __declspec(dllexport)
45
+ #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
46
+ #endif // if defined(_MSC_VER)
47
+ #elif defined(JSON_DLL)
48
+ #if defined(_MSC_VER) || defined(__MINGW32__)
49
+ #define JSON_API __declspec(dllimport)
50
+ #define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
51
+ #endif // if defined(_MSC_VER)
52
+ #endif // ifdef JSON_IN_CPPTL
53
+ #if !defined(JSON_API)
54
+ #define JSON_API
55
+ #endif
56
+
57
+ // If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
58
+ // integer
59
+ // Storages, and 64 bits integer support is disabled.
60
+ // #define JSON_NO_INT64 1
61
+
62
+ #if defined(_MSC_VER) // MSVC
63
+ # if _MSC_VER <= 1200 // MSVC 6
64
+ // Microsoft Visual Studio 6 only support conversion from __int64 to double
65
+ // (no conversion from unsigned __int64).
66
+ # define JSON_USE_INT64_DOUBLE_CONVERSION 1
67
+ // Disable warning 4786 for VS6 caused by STL (identifier was truncated to '255'
68
+ // characters in the debug information)
69
+ // All projects I've ever seen with VS6 were using this globally (not bothering
70
+ // with pragma push/pop).
71
+ # pragma warning(disable : 4786)
72
+ # endif // MSVC 6
73
+
74
+ # if _MSC_VER >= 1500 // MSVC 2008
75
+ /// Indicates that the following function is deprecated.
76
+ # define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
77
+ # endif
78
+
79
+ #endif // defined(_MSC_VER)
80
+
81
+ // In c++11 the override keyword allows you to explicitly define that a function
82
+ // is intended to override the base-class version. This makes the code more
83
+ // managable and fixes a set of common hard-to-find bugs.
84
+ #if __cplusplus >= 201103L
85
+ # define JSONCPP_OVERRIDE override
86
+ # define JSONCPP_NOEXCEPT noexcept
87
+ #elif defined(_MSC_VER) && _MSC_VER > 1600 && _MSC_VER < 1900
88
+ # define JSONCPP_OVERRIDE override
89
+ # define JSONCPP_NOEXCEPT throw()
90
+ #elif defined(_MSC_VER) && _MSC_VER >= 1900
91
+ # define JSONCPP_OVERRIDE override
92
+ # define JSONCPP_NOEXCEPT noexcept
93
+ #else
94
+ # define JSONCPP_OVERRIDE
95
+ # define JSONCPP_NOEXCEPT throw()
96
+ #endif
97
+
98
+ #ifndef JSON_HAS_RVALUE_REFERENCES
99
+
100
+ #if defined(_MSC_VER) && _MSC_VER >= 1600 // MSVC >= 2010
101
+ #define JSON_HAS_RVALUE_REFERENCES 1
102
+ #endif // MSVC >= 2010
103
+
104
+ #ifdef __clang__
105
+ #if __has_feature(cxx_rvalue_references)
106
+ #define JSON_HAS_RVALUE_REFERENCES 1
107
+ #endif // has_feature
108
+
109
+ #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
110
+ #if defined(__GXX_EXPERIMENTAL_CXX0X__) || (__cplusplus >= 201103L)
111
+ #define JSON_HAS_RVALUE_REFERENCES 1
112
+ #endif // GXX_EXPERIMENTAL
113
+
114
+ #endif // __clang__ || __GNUC__
115
+
116
+ #endif // not defined JSON_HAS_RVALUE_REFERENCES
117
+
118
+ #ifndef JSON_HAS_RVALUE_REFERENCES
119
+ #define JSON_HAS_RVALUE_REFERENCES 0
120
+ #endif
121
+
122
+ #ifdef __clang__
123
+ # if __has_extension(attribute_deprecated_with_message)
124
+ # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
125
+ # endif
126
+ #elif defined __GNUC__ // not clang (gcc comes later since clang emulates gcc)
127
+ # if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
128
+ # define JSONCPP_DEPRECATED(message) __attribute__ ((deprecated(message)))
129
+ # elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
130
+ # define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
131
+ # endif // GNUC version
132
+ #endif // __clang__ || __GNUC__
133
+
134
+ #if !defined(JSONCPP_DEPRECATED)
135
+ #define JSONCPP_DEPRECATED(message)
136
+ #endif // if !defined(JSONCPP_DEPRECATED)
137
+
138
+ #if __GNUC__ >= 6
139
+ # define JSON_USE_INT64_DOUBLE_CONVERSION 1
140
+ #endif
141
+
142
+ #if !defined(JSON_IS_AMALGAMATION)
143
+
144
+ # include "version.h"
145
+
146
+ # if JSONCPP_USING_SECURE_MEMORY
147
+ # include "allocator.h" //typedef Allocator
148
+ # endif
149
+
150
+ #endif // if !defined(JSON_IS_AMALGAMATION)
151
+
152
+ namespace Json {
153
+ typedef int Int;
154
+ typedef unsigned int UInt;
155
+ #if defined(JSON_NO_INT64)
156
+ typedef int LargestInt;
157
+ typedef unsigned int LargestUInt;
158
+ #undef JSON_HAS_INT64
159
+ #else // if defined(JSON_NO_INT64)
160
+ // For Microsoft Visual use specific types as long long is not supported
161
+ #if defined(_MSC_VER) // Microsoft Visual Studio
162
+ typedef __int64 Int64;
163
+ typedef unsigned __int64 UInt64;
164
+ #else // if defined(_MSC_VER) // Other platforms, use long long
165
+ typedef int64_t Int64;
166
+ typedef uint64_t UInt64;
167
+ #endif // if defined(_MSC_VER)
168
+ typedef Int64 LargestInt;
169
+ typedef UInt64 LargestUInt;
170
+ #define JSON_HAS_INT64
171
+ #endif // if defined(JSON_NO_INT64)
172
+ #if JSONCPP_USING_SECURE_MEMORY
173
+ #define JSONCPP_STRING std::basic_string<char, std::char_traits<char>, Json::SecureAllocator<char> >
174
+ #define JSONCPP_OSTRINGSTREAM std::basic_ostringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
175
+ #define JSONCPP_OSTREAM std::basic_ostream<char, std::char_traits<char>>
176
+ #define JSONCPP_ISTRINGSTREAM std::basic_istringstream<char, std::char_traits<char>, Json::SecureAllocator<char> >
177
+ #define JSONCPP_ISTREAM std::istream
178
+ #else
179
+ #define JSONCPP_STRING std::string
180
+ #define JSONCPP_OSTRINGSTREAM std::ostringstream
181
+ #define JSONCPP_OSTREAM std::ostream
182
+ #define JSONCPP_ISTRINGSTREAM std::istringstream
183
+ #define JSONCPP_ISTREAM std::istream
184
+ #endif // if JSONCPP_USING_SECURE_MEMORY
185
+ } // end namespace Json
186
+
187
+ #endif // JSON_CONFIG_H_INCLUDED
@@ -0,0 +1,61 @@
1
+ // Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
2
+ // Distributed under MIT license, or public domain if desired and
3
+ // recognized in your jurisdiction.
4
+ // See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
5
+
6
+ #ifndef CPPTL_JSON_FEATURES_H_INCLUDED
7
+ #define CPPTL_JSON_FEATURES_H_INCLUDED
8
+
9
+ #if !defined(JSON_IS_AMALGAMATION)
10
+ #include "forwards.h"
11
+ #endif // if !defined(JSON_IS_AMALGAMATION)
12
+
13
+ #pragma pack(push, 8)
14
+
15
+ namespace Json {
16
+
17
+ /** \brief Configuration passed to reader and writer.
18
+ * This configuration object can be used to force the Reader or Writer
19
+ * to behave in a standard conforming way.
20
+ */
21
+ class JSON_API Features {
22
+ public:
23
+ /** \brief A configuration that allows all features and assumes all strings
24
+ * are UTF-8.
25
+ * - C & C++ comments are allowed
26
+ * - Root object can be any JSON value
27
+ * - Assumes Value strings are encoded in UTF-8
28
+ */
29
+ static Features all();
30
+
31
+ /** \brief A configuration that is strictly compatible with the JSON
32
+ * specification.
33
+ * - Comments are forbidden.
34
+ * - Root object must be either an array or an object value.
35
+ * - Assumes Value strings are encoded in UTF-8
36
+ */
37
+ static Features strictMode();
38
+
39
+ /** \brief Initialize the configuration like JsonConfig::allFeatures;
40
+ */
41
+ Features();
42
+
43
+ /// \c true if comments are allowed. Default: \c true.
44
+ bool allowComments_;
45
+
46
+ /// \c true if root must be either an array or an object value. Default: \c
47
+ /// false.
48
+ bool strictRoot_;
49
+
50
+ /// \c true if dropped null placeholders are allowed. Default: \c false.
51
+ bool allowDroppedNullPlaceholders_;
52
+
53
+ /// \c true if numeric object key are allowed. Default: \c false.
54
+ bool allowNumericKeys_;
55
+ };
56
+
57
+ } // namespace Json
58
+
59
+ #pragma pack(pop)
60
+
61
+ #endif // CPPTL_JSON_FEATURES_H_INCLUDED