Puoi compilare Tink dal codice sorgente o utilizzare pacchetti specifici per la lingua. Le seguenti istruzioni ti aiuteranno a iniziare.
Dopo aver installato e configurato Tink, vai ai passaggi successivi alla fine di questa pagina.
C++
Tink fornisce le seguenti librerie C++:
- Una libreria C++ di base, tink-cc. L'ultima release è 2.3.0
- Un'estensione AWS KMS, tink-cc-awskms La versione più recente è 2.0.1.
- Un'estensione Google Cloud KMS, tink-cc-gcpkms. L'ultima release è 2.2.0.
Tink C++ (tink-cc)
Tink C++ dipende da:
- Protobuf 26.1
- Abseil LTS 20230802.0
- BoringSSL o OpenSSL >=1.1.1
- RapidJSON 1.1.0
- googletest 1.14.0 (solo per test)
- Wycheproof (solo per test)
Tink C++ supporta:
- C++ >= 14
- Sistema operativo:
- UbuntuLTS >= 20.04 (x86_64)
- macOS >= 12.5 Monterey (x86_64)
- Windows Server >= 2019 (x86_64)
- Compilatore:
- GCC >= 7.5.0
- Apple Clang >= 14
- MSVC >= 2019
- Sistema di compilazione:
CMake
Devi aggiungere tink-cc
come dipendenza all'interno dell'albero. Ad esempio:
cmake_minimum_required(VERSION 3.13)
project(YourProject CXX)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 14)
include(FetchContent)
# Import Tink as an in-tree dependency.
FetchContent_Declare(
tink
URL https://github.com/tink-crypto/tink-cc/archive/refs/tags/v2.3.0.zip
URL_HASH SHA256=363ce671ab5ce0b24f279d3647185597a25f407c3608db007315f79f151f436b
)
FetchContent_GetProperties(tink)
if(NOT googletest_POPULATED)
FetchContent_Populate(tink)
add_subdirectory(${tink_SOURCE_DIR} ${tink_BINARY_DIR} EXCLUDE_FROM_ALL)
endif()
add_executable(your_app your_app.cc)
target_link_libraries(your_app tink::static)
Bazel
Bzlmod
Se utilizzi Bazel con i moduli, aggiungi quanto segue al file MODULE.bazel
:
bazel_dep(name = "tink_cc", version = "2.3.0")
WORKSPACE
Se utilizzi Bazel con i file WORKSPACE
, aggiungi quanto segue al
WORKSPACE
file:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "tink_cc",
urls = ["https://github.com/tink-crypto/tink-cc/archive/refs/tags/v2.3.0.zip"],
strip_prefix = "tink-2.3.0",
sha256 = "363ce671ab5ce0b24f279d3647185597a25f407c3608db007315f79f151f436b",
)
load("@tink_cc//:tink_cc_deps.bzl", "tink_cc_deps")
tink_cc_deps()
load("@tink_cc//:tink_cc_deps_init.bzl", "tink_cc_deps_init")
tink_cc_deps_init()
Estensione Tink C++ AWS KMS (tink-cc-awskms)
Tink C++ Google Cloud KMS dipende da:
- Tink C++ 2.1.0
- AWS C++ SDK 1.7.345
- googletest 1.11.0 (solo per test)
Tink C++ AWS KMS supporta:
- C++ >= 14
- Sistema operativo:
- UbuntuLTS >= 20.04 (x86_64)
- macOS >= 12.5 Monterey (x86_64)
- Compilatore:
- GCC >= 7.5.0
- Apple Clang >= 14
- Sistema di compilazione:
- Bazel >= 6 LTS
Bazel
Devi aggiungere quanto segue al file WORKSPACE
del progetto:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "tink_cc",
urls = ["https://github.com/tink-crypto/tink-cc/archive/refs/tags/v2.3.0.zip"],
strip_prefix = "tink-2.3.0",
sha256 = "363ce671ab5ce0b24f279d3647185597a25f407c3608db007315f79f151f436b",
)
load("@tink_cc//:tink_cc_deps.bzl", "tink_cc_deps")
tink_cc_deps()
load("@tink_cc//:tink_cc_deps_init.bzl", "tink_cc_deps_init")
tink_cc_deps_init()
http_archive(
name = "tink_cc_awskms",
urls = ["https://github.com/tink-crypto/tink-cc-awskms/archive/refs/tags/v2.0.1.zip"],
strip_prefix = "tink-cc-awskms-2.0.1",
sha256 = "366319b269f62af120ee312ce4c99ce3738ceb23ce3f9491b4859432f8b991a4",
)
load("@tink_cc_awskms//:tink_cc_awskms_deps.bzl", "tink_cc_awskms_deps")
tink_cc_awskms_deps()
Estensione Tink C++ per Google Cloud KMS (tink-cc-gcpkms)
Tink C++ Google Cloud KMS dipende da:
- Tink C++ 2.1.0
- gRPC 1.59.3
- Librerie client C++ di Google Cloud 2.16.0
- googletest 1.11.0 (solo per test)
Tink C++ Google Cloud KMS supporta:
- C++ >= 14
- Sistema operativo:
- UbuntuLTS >= 20.04 (x86_64)
- macOS >= 12.5 Monterey (x86_64)
- Compilatore:
- GCC >= 7.5.0
- Apple Clang >= 14
- Sistema di compilazione:
- Bazel >= 6 LTS
Bazel
Devi aggiungere quanto segue al file WORKSPACE
del progetto:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "tink_cc_gcpkms",
urls = ["https://github.com/tink-crypto/tink-cc-gcpkms/releases/download/v2.2.0/tink-cc-gcpkms-2.2.0.zip"],
strip_prefix = "tink-cc-gcpkms-2.2.0",
sha256 = "ffb9d05c64ca28b5eb54fe79e7c3f93fad68f00e45f74f6b9ce1bd3a32b3d6fd",
)
load("@tink_cc_gcpkms//:tink_cc_gcpkms_deps.bzl", "tink_cc_gcpkms_deps")
tink_cc_gcpkms_deps()
load("@tink_cc_gcpkms//:tink_cc_gcpkms_deps_init.bzl", "tink_cc_gcpkms_deps_init")
tink_cc_gcpkms_deps_init(register_go = True)
Vai
Tink fornisce le seguenti librerie Go:
- Una libreria Tink di base, tink-go. La release più recente è v2.2.0
- Un'estensione AWS KMS, tink-go-awskms La versione più recente è 2.1.0.
- Un'estensione Google Cloud KMS, tink-go-gcpkms. La release più recente è 2.2.0.
- Un'estensione di HashiCorp Vault, tink-go-hcvault. La release più recente è 2.1.0.
Tutte le librerie Tink Go vengono pubblicate come moduli Go che possono essere utilizzati con gli strumenti Go standard o con Bazel.
Tink Go (tink-go)
Strumenti Go
Esegui il seguente comando dalla directory del progetto:
go get github.com/tink-crypto/tink-go/v2@v2.2.0
Consulta la documentazione ufficiale di Go.
Bazel
Se vuoi utilizzare Tink Go con Bazel,
devi utilizzare
bazel-gazelle
.
Puoi utilizzarlo nel seguente modo in WORKSPACE
:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
integrity = "sha256-gKmCd60TEdrNg3+bFttiiHcC6fHRxMn3ltASGkbI4YQ=",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip",
],
)
http_archive(
name = "bazel_gazelle",
integrity = "sha256-MpOL2hbmcABjA1R5Bj2dJMYO2o15/Uc5Vj9Q0zHLMgk=",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
],
)
TINK_GO_VERSION="2.2.0"
TINK_GO_SHA256="fea1ff9ed06a7302e3496587834a53f91235085e45e3de03af80b897514b7a1b"
http_archive(
name = "com_github_tink_crypto_tink_go_v2",
urls = ["https://github.com/tink-crypto/tink-go/releases/download/v%s/tink-go-%s.zip" % (TINK_GO_VERSION, TINK_GO_VERSION)],
strip_prefix = "tink-go-%s" % TINK_GO_VERSION,
sha256 = TINK_GO_SHA256,
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
load("@com_github_tink_crypto_tink_go_v2//:deps.bzl", tink_go_dependencies="go_dependencies")
tink_go_dependencies()
#######################################
#
# Your project dependencies here.
#
#######################################
go_rules_dependencies()
go_register_toolchains(version = "1.20.10")
gazelle_dependencies()
Estensione Tink Go AWS KMS (tink-go-awskms)
Strumenti Go
Esegui il seguente comando dalla directory del progetto:
go get github.com/tink-crypto/tink-go-awskms/v2@2.1.0
Consulta la documentazione ufficiale di Go.
Bazel
Se vuoi utilizzare l'estensione Tink Go AWS KMS con
Bazel, devi utilizzare
bazel-gazelle
.
Puoi utilizzarlo nel seguente modo in WORKSPACE
:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
],
)
http_archive(
name = "bazel_gazelle",
sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
],
)
# [Optional]: tink-go is imported as a go_repository by tink_go_awskms_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# TINK_GO_VERSION="2.2.0"
# TINK_GO_SHA256="fea1ff9ed06a7302e3496587834a53f91235085e45e3de03af80b897514b7a1b"
#
# http_archive(
# name = "com_github_tink_crypto_tink_go_v2",
# urls = ["https://github.com/tink-crypto/tink-go/releases/download/v%s/tink-go-%s.zip" % (TINK_GO_VERSION, TINK_GO_VERSION)],
# strip_prefix = "tink-go-%s" % TINK_GO_VERSION,
# sha256 = TINK_GO_SHA256,
# )
http_archive(
name = "com_github_tink_crypto_tink_go_awskms_v2",
urls = ["https://github.com/tink-crypto/tink-go-awskms/releases/tag/v2.1.0.zip"],
strip_prefix = "tink-go-awskms-2.1.0",
sha256 = "2d99ea5dd0106703385cc12c7a969fca86b338a03e6694dbcf5b273011b5fdba",
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
# [Optional]: tink-go is imported as a go_repository by tink_go_awskms_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# load("@com_github_tink_crypto_tink_go_v2//:deps.bzl", tink_go_dependencies="go_dependencies")
#
# tink_go_dependencies()
load("@com_github_tink_crypto_tink_go_awskms_v2//:deps.bzl", "tink_go_awskms_dependencies")
tink_go_awskms_dependencies()
#######################################
#
# Your project dependencies here.
#
#######################################
go_rules_dependencies()
go_register_toolchains(version = "1.19.9")
gazelle_dependencies()
Estensione Tink Go Google Cloud KMS (tink-go-gcpkms)
Strumenti Go
Esegui il seguente comando dalla directory del progetto:
go get github.com/tink-crypto/tink-go-gcpkms/v2@v2.2.0
Consulta la documentazione ufficiale di Go.
Bazel
Se vuoi utilizzare l'estensione Tink Go Google Cloud KMS con
Bazel, devi utilizzare
bazel-gazelle
.
Puoi utilizzarlo nel seguente modo in WORKSPACE
:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Release X.25.2 from 2024-01-09.
http_archive(
name = "com_google_protobuf",
sha256 = "5e8e2b369a6fcaa24fada21135782eef147aec467cd286c108936a3277e88d2b",
strip_prefix = "protobuf-25.2",
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protobuf-25.2.zip"],
)
# Release from 2023-04-20
http_archive(
name = "io_bazel_rules_go",
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
],
)
# Release from 2023-01-14
http_archive(
name = "bazel_gazelle",
sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
],
)
# [Optional]: tink-go is imported as a go_repository by tink_go_gcpkms_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# TINK_GO_VERSION="2.2.0"
# TINK_GO_SHA256="fea1ff9ed06a7302e3496587834a53f91235085e45e3de03af80b897514b7a1b"
#
# http_archive(
# name = "com_github_tink_crypto_tink_go_v2",
# urls = ["https://github.com/tink-crypto/tink-go/releases/download/v%s/tink-go-%s.zip" % (TINK_GO_VERSION, TINK_GO_VERSION)],
# strip_prefix = "tink-go-%s" % TINK_GO_VERSION,
# sha256 = TINK_GO_SHA256,
# )
http_archive(
name = "com_github_tink_crypto_tink_go_gcpkms_v2",
urls = ["https://github.com/tink-crypto/tink-go-gcpkms/download/v2.2.0/tink-go-gcpkms-2.2.0.zip"],
strip_prefix = "tink-go-gcpkms-2.2.0",
sha256 = "78177646479314e19c467a9eac90ab96667581b4d6ea5e485c5d2643dfc9b55b",
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
# [Optional]: tink-go is imported as a go_repository by tink_go_gcpkms_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# load("@com_github_tink_crypto_tink_go_v2//:deps.bzl", tink_go_dependencies="go_dependencies")
#
# tink_go_dependencies()
load("@com_github_tink_crypto_tink_go_gcpkms_v2//:deps.bzl", "tink_go_gcpkms_dependencies")
tink_go_awskms_dependencies()
#######################################
#
# Your project dependencies here.
#
#######################################
go_rules_dependencies()
go_register_toolchains(version = "1.20.13")
gazelle_dependencies()
Estensione HashiCorp Vault di Tink Go (tink-go-hcvault)
Strumenti Go
Esegui il seguente comando dalla directory del progetto:
go get github.com/tink-crypto/tink-go-hcvault/v2@v2.1.0
Consulta la documentazione ufficiale di Go.
Bazel
Se vuoi utilizzare l'estensione Tink HashiCorp Vault con
Bazel, devi utilizzare
bazel-gazelle
.
Puoi utilizzarlo nel seguente modo in WORKSPACE
:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_go",
sha256 = "6dc2da7ab4cf5d7bfc7c949776b1b7c733f05e56edc4bcd9022bb249d2e2a996",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.39.1/rules_go-v0.39.1.zip",
],
)
http_archive(
name = "bazel_gazelle",
sha256 = "ecba0f04f96b4960a5b250c8e8eeec42281035970aa8852dda73098274d14a1d",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.29.0/bazel-gazelle-v0.29.0.tar.gz",
],
)
# [Optional]: tink-go is imported as a go_repository by tink_go_hcvault_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# TINK_GO_VERSION="2.2.0"
# TINK_GO_SHA256="fea1ff9ed06a7302e3496587834a53f91235085e45e3de03af80b897514b7a1b"
#
# http_archive(
# name = "com_github_tink_crypto_tink_go_v2",
# urls = ["https://github.com/tink-crypto/tink-go/releases/download/v%s/tink-go-%s.zip" % (TINK_GO_VERSION, TINK_GO_VERSION)],
# strip_prefix = "tink-go-%s" % TINK_GO_VERSION,
# sha256 = TINK_GO_SHA256,
# )
http_archive(
name = "com_github_tink_crypto_tink_go_hcvault_v2",
urls = ["https://github.com/tink-crypto/tink-go-hcvault/download/v2.1.0/tink-go-hcvault-2.1.0.zip"],
strip_prefix = "tink-go-hcvault-2.1.0",
sha256 = "b053b67ccc308cfe1cff92d6a74b573d058c5ffe950263026f3d46cb67653def",
)
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
# [Optional]: tink-go is imported as a go_repository by tink_go_hcvault_dependencies.
# this is needed only if the user wants to pin to a specific commit/version of tink-go.
# load("@com_github_tink_crypto_tink_go_v2//:deps.bzl", tink_go_dependencies="go_dependencies")
#
# tink_go_dependencies()
load("@com_github_tink_crypto_tink_go_hcvault_v2//:deps.bzl", "tink_go_hcvault_dependencies")
tink_go_awskms_dependencies()
#######################################
#
# Your project dependencies here.
#
#######################################
go_rules_dependencies()
go_register_toolchains(version = "1.20.14")
gazelle_dependencies()
Java
Tink fornisce le seguenti librerie Java:
- Una libreria di base Java e Android, tink-java La release più recente è 1.15.0
- Un'estensione AWS KMS, tink-java-awskms La versione più recente è 1.10.1.
- Un'estensione Google Cloud KMS, tink-java-gcpkms. La release più recente è 1.10.0
- Una libreria, tink-java-apps che fornisce implementazioni per Token metodo di pagamento Google, Verifica lato server degli annunci con premio di Google AdMob e RFC 8291 - Crittografia dei messaggi per le notifiche push web. La release più recente è 1.11.0.
La versione Java di Tink supporta Java 8 o versioni successive. Puoi includere gli artefatti Maven di Tink Java nel tuo progetto Maven o Gradle oppure utilizzare Bazel.
Tink Android è completamente supportato a partire dal livello API 24. La maggior parte delle parti di Tink dovrebbe funzionare a partire dal livello API 21. Le parti in cui Tink non funziona immediatamente con il livello API 21 sono:
- La libreria JWT richiede il livello API 24 poiché utilizza classi come
java.util.Optional
. Questa limitazione può essere evitata con la rimozione del codice non necessario. - Le classi in
com.google.crypto.tink.integration.android
sono completamente testate solo a partire dal livello API 23. - Alcune API in
com.google.crypto.tink.streamingaead
utilizzanoSeekableByteBufferChannel
, che è disponibile solo a partire dal livello API 24.
Tieni presente che, per motivi tecnici, testiamo Tink su Android solo sull'infrastruttura interna di Google. Non prevediamo problemi a causa di questo, ma se riscontri problemi, invia un report.
Tink Android non richiede alcuna configurazione di ProGuard.
Tink Java (tink-java)
Maven
Puoi includere Tink Java e la libreria Tink Android utilizzando Maven:
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>tink</artifactId>
<version>1.15.0</version>
</dependency>
Se scegli come target Android, puoi utilizzare tink-android
da
Gradle utilizzando:
dependencies {
implementation 'com.google.crypto.tink:tink-android:1.15.0'
}
Bazel
Il modo consigliato per gli utenti di Bazel per aggiungere Tink Java come dipendenza è installare l'elemento di release Maven utilizzando lo strumento rules_jvm_external
nel file WORKSPACE
:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
RULES_JVM_EXTERNAL_TAG = "6.1"
RULES_JVM_EXTERNAL_SHA ="d31e369b854322ca5098ea12c69d7175ded971435e55c18dd9dd5f29cc5249ac"
http_archive(
name = "rules_jvm_external",
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
sha256 = RULES_JVM_EXTERNAL_SHA,
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (RULES_JVM_EXTERNAL_TAG, RULES_JVM_EXTERNAL_TAG)
)
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
rules_jvm_external_deps()
load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")
rules_jvm_external_setup()
load("@rules_jvm_external//:defs.bzl", "maven_install")
maven_install(
artifacts = [
"com.google.crypto.tink:tink:1.15.0",
# ... other dependencies ...
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
Se vuoi compilare tink-java
dal codice sorgente, ad esempio per bloccare un commit specifico, puoi includerlo come http_archive
nel file WORKSPACE
:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
TINK_COMMIT="f4127f6b6ab9c367d41ade1f50db6f0ef9909044"
TINK_SHA256="e246f848f7749e37f558955ecb50345b04d79ddb9d8d1e8ae19f61e8de530582"
http_archive(
name = "tink_java",
urls = ["https://github.com/tink-crypto/tink-java/archive/%s.zip" % TINK_COMMIT],
strip_prefix = "tink-%s" % TINK_COMMIT,
sha256 = TINK_SHA256
)
load("@tink_java//:tink_java_deps.bzl", "TINK_MAVEN_ARTIFACTS", "tink_java_deps")
tink_java_deps()
load("@tink_java//:tink_java_deps_init.bzl", "tink_java_deps_init")
tink_java_deps_init()
# rules_jvm_external is imported and initialized by tink_java_deps and
# tink_java_deps_init.
load("@rules_jvm_external//:defs.bzl", "maven_install")
maven_install(
artifacts = TINK_MAVEN_ARTIFACTS + # ... other dependencies ...
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
Estensione Tink Java AWS KMS (tink-java-awskms)
Maven
Puoi includere Tink Java e la libreria Tink Android utilizzando Maven:
<dependencies>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>tink-awskms</artifactId>
<version>1.10.1</version>
</dependency>
</dependencies>
Bazel
Puoi installare l'elemento Maven com.google.crypto.tink:tink-awskms
insieme a com.google.crypto.tink:tink
utilizzando lo strumento rules_jvm_external
.
# ...
maven_install(
artifacts = [
"com.google.crypto.tink:tink:1.15.0",
"com.google.crypto.tink:tink-awskms:1.10.1",
# ... other dependencies ...
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
In alternativa, puoi includerlo come dipendenza http_archive
:
# ...
http_archive(
name = "tink_java",
urls = ["https://github.com/tink-crypto/tink-java/releases/download/v1.15.0/tink-java-1.15.0.zip"],
strip_prefix = "tink-java-1.15.0",
sha256 = "e246f848f7749e37f558955ecb50345b04d79ddb9d8d1e8ae19f61e8de530582",
)
load("@tink_java//:tink_java_deps.bzl", "TINK_MAVEN_ARTIFACTS", "tink_java_deps")
tink_java_deps()
load("@tink_java//:tink_java_deps_init.bzl", "tink_java_deps_init")
tink_java_deps_init()
http_archive(
name = "tink_java_awskms",
urls = ["https://github.com/tink-crypto/tink-java-awskms/releases/download/v1.10.1/tink-java-awskms-1.10.1.zip"],
strip_prefix = "tink-java-awskms-1.10.1",
sha256 = "5f08f3a343fb2028784ee2344e102cf4f753b4d23252318b3f8ac48208d3e2fa",
)
load("@tink_java_awskms//:tink_java_awskms_deps.bzl", "TINK_JAVA_AWSKMS_MAVEN_ARTIFACTS")
maven_install(
artifacts = TINK_MAVEN_ARTIFACTS + TINK_JAVA_AWSKMS_MAVEN_ARTIFACTS + [
# ... other dependencies ...
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
Estensione Tink Java per Google Cloud KMS (tink-java-gcpkms)
Maven
<dependencies>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>tink-gcpkms</artifactId>
<version>1.10.0/version>
</dependency>
</dependencies>
Bazel
Puoi installare l'elemento Maven com.google.crypto.tink:tink-gcpkms
insieme a com.google.crypto.tink:tink
utilizzando lo strumento rules_jvm_external
.
# ...
maven_install(
artifacts = [
"com.google.crypto.tink:tink:1.15.0",
"com.google.crypto.tink:tink-gcpkms:1.10.0",
# ... other dependencies ...
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
In alternativa, puoi includerlo come dipendenza http_archive
:
# ...
http_archive(
name = "tink_java",
urls = ["https://github.com/tink-crypto/tink-java/releases/download/v1.15.0/tink-java-1.15.0.zip"],
strip_prefix = "tink-java-1.15.0",
sha256 = "e246f848f7749e37f558955ecb50345b04d79ddb9d8d1e8ae19f61e8de530582",
)
load("@tink_java//:tink_java_deps.bzl", "TINK_MAVEN_ARTIFACTS", "tink_java_deps")
tink_java_deps()
load("@tink_java//:tink_java_deps_init.bzl", "tink_java_deps_init")
tink_java_deps_init()
http_archive(
name = "tink_java_gcpkms",
urls = ["https://github.com/tink-crypto/tink-java-gcpkms/releases/download/v1.10.0/tink-java-gcpkms-1.10.0.zip"],
strip_prefix = "tink-java-gcpkms-1.10.0",
sha256 = "ad85625cc4409f2f6ab13a8eef39c965501585e9323d59652cce322b3d2c09a2",
)
load("@tink_java_gcpkms//:tink_java_gcpkms_deps.bzl", "TINK_JAVA_GCPKMS_MAVEN_ARTIFACTS")
maven_install(
artifacts = TINK_MAVEN_ARTIFACTS + TINK_JAVA_GCPKMS_MAVEN_ARTIFACTS + [
# ... other dependencies ...
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
Estensioni Tink Java Apps (tink-java-apps)
Maven
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>apps-webpush</artifactId>
<version>1.11.0</version>
</dependency>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>apps-paymentmethodtoken</artifactId>
<version>1.11.0</version>
</dependency>
<dependency>
<groupId>com.google.crypto.tink</groupId>
<artifactId>apps-rewardedads</artifactId>
<version>1.11.0</version>
</dependency>
Bazel
Puoi installare qualsiasi elemento Maven
utilizzando lo strumento rules_jvm_external
.com.google.crypto.tink:apps-*
# ...
maven_install(
artifacts = [
"com.google.crypto.tink:apps-webpush:1.11.0",
"com.google.crypto.tink:apps-paymentmethodtoken:1.11.0",
"com.google.crypto.tink:apps-rewardedads:1.11.0",
# ... other dependencies ...
],
repositories = [
"https://maven.google.com",
"https://repo1.maven.org/maven2",
],
)
ObjC
Consulta la documentazione su GitHub
Python
La libreria Python di Tink, tink-py, supporta Python 3.8 o versioni successive su macOS (x86-64 e ARM64), Linux (x86-64 e ARM64) e Windows (x86-64). La release più recente è 1.10.0. Può essere installato localmente utilizzando Pip o utilizzato con Bazel.
Tink Python fornisce integrazioni con AWS KMS, Google Cloud KMS e HashiCorp Vault.
Pip
Puoi installare la release binaria di Tink Python per il tuo sistema da PyPI, eseguendo il seguente comando:
pip3 install tink==1.10.0
# Core Tink + Google Cloud KMS extension.
pip3 install tink[gcpkms]==1.10.0
# Core Tink + AWS KMS extension.
pip3 install tink[awskms]==1.10.0
# Core Tink + HashiCorp Vault KMS extension.
pip3 install tink[hcvault]==1.10.0
# Core Tink + all the KMS extensions.
pip3 install tink[all]==1.10.0
Se non è stato pubblicato un pacchetto binario per il tuo ambiente, pip
ricorre automaticamente alla compilazione del progetto utilizzando la distribuzione di origine
pubblicata su PyPI. In questo caso, devi installare Bazel o Bazelisk e il compilatore protobuf per compilare correttamente il progetto.
Bazel
Gli utenti di Bazel possono includere Tink Python nel loro
WORKSPACE
file come segue:
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "tink_py",
urls = ["https://github.com/tink-crypto/tink-py/releases/download/v1.10.0/tink-py-1.10.0.zip"],
strip_prefix = "tink-py-1.10.0",
sha256 = "767453aae4aad6de4fbb4162992184aa427b7b27864fe9912c270b24c673e1cc",
)
load("@tink_py//:tink_py_deps.bzl", "tink_py_deps")
tink_py_deps()
load("@rules_python//python:repositories.bzl", "py_repositories")
py_repositories()
load("@tink_py//:tink_py_deps_init.bzl", "tink_py_deps_init")
tink_py_deps_init("tink_py")
Passaggi successivi
Dopo aver completato la configurazione di Tink, continua con i passaggi di utilizzo standard di Tink:
- Scegli una primitiva: decidi quale primitiva utilizzare in base al tuo caso d'uso
- Gestisci le chiavi: proteggi le tue chiavi con il KMS esterno, genera insiemi di chiavi e ruota le chiavi