我想tink
为我的应用程序使用 Google库。我使用 android 绑定了我的代码ndk
。但是,我无法tink
使用bazel
. 我已经在 github ( https://github.com/google/tink )上尝试过他们的例子。此外,我没有任何使用bazel
. 因此,如果有人知道如何以tink
任何方式构建 Google库,我也愿意接受这些选择。
我正在使用:
我试图遵循https://github.com/google/tink/blob/master/examples/cc/helloworld/README.md但它导致错误:
bazel build ...
Starting local Bazel server and connecting to it...
ERROR: error loading package 'javascript/aead/internal': Unable to find package for @npm//@bazel/typescript:index.bzl: The repository '@npm' could not be resolved.
INFO: Elapsed time: 6.455s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (1 packages loaded)
currently loading: javascript/binary ... (6 packages)
当README.md
写好后,整个项目是在一个单一的巴泽尔的工作空间。现在examples
子目录是它自己独立的工作区,所以你需要cd
在执行之前进入它bazel
。
正确说明:
# Build the code.
git clone https://github.com/google/tink
cd tink/examples/cc
bazel build ...
# Create some input.
echo "some plaintext" > foo.txt
# Encrypt.
./bazel-bin/helloworld/hello_world ./helloworld/aes128_gcm_test_keyset_json.txt \
encrypt foo.txt "some aad" foo.encrypted
# Decrypt.
./bazel-bin/helloworld/hello_world ./helloworld/aes128_gcm_test_keyset_json.txt \
decrypt foo.encrypted "some aad" foo-decrypted.txt
# Inspect the output.
cat foo-decrypted.txt
请注意,C++ 实现还支持使用 CMake,这可能更容易满足您的目的。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句