Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
BUILD.bazel | H A D | 25-Apr-2025 | 1.9 KiB | 78 | 69 | |
README.md | H A D | 25-Apr-2025 | 1.2 KiB | 48 | 34 | |
signature.py | H A D | 25-Apr-2025 | 3.1 KiB | 107 | 65 | |
signature_basic.py | H A D | 25-Apr-2025 | 4.2 KiB | 103 | 50 | |
signature_basic_test.py | H A D | 25-Apr-2025 | 823 | 27 | 8 | |
signature_test.sh | H A D | 25-Apr-2025 | 3.7 KiB | 132 | 64 | |
signature_test_private_keyset.json | H A D | 25-Apr-2025 | 429 | 12 | 11 | |
signature_test_public_keyset.json | H A D | 25-Apr-2025 | 384 | 13 | 12 |
README.md
1# Python digital signature example 2 3This example shows how to sign and verify data with Tink using digital 4signatures. 5 6It demonstrates the basic steps of using Tink, namely loading key material, 7obtaining a primitive, and using the primitive to do crypto. 8 9The key material was generated with: 10 11```shell 12$ tinkey create-keyset --key-template ECDSA_P256 --out-format JSON \ 13 --out signature_test_private_keyset.json 14$ tinkey create-public-keyset --in signature_test_private_keyset.json \ 15 --in-format JSON --out-format JSON --out signature_test_public_keyset.json 16``` 17 18## Build and run 19 20### Bazel 21 22Build the examples: 23 24```shell 25$ git clone https://github.com/google/tink 26$ cd tink/python/examples 27$ bazel build ... 28``` 29 30Generate a signature: 31 32```shell 33$ echo "some data" > data.txt 34$ touch signature_file.txt 35 36$ ./bazel-bin/signature/signature --mode sign \ 37 --keyset_path ./signature/signature_test_private_keyset.json \ 38 --data_path data.txt --signature_path signature_file.txt 39``` 40 41Verify a signature: 42 43```shell 44$ ./bazel-bin/signature/signature --mode verify \ 45 --keyset_path ./signature/signature_test_public_keyset.json \ 46 --data_path data.txt --signature_path signature_file.txt 47``` 48