Comprendere i concetti chiave in Tink
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Quando inizi a lavorare con Tink per la prima volta, ci sono alcuni concetti chiave
che dovresti comprendere prima di iniziare il tuo percorso, descritti nelle
sezioni seguenti.
Primitivi
Tink utilizza le primitive come componenti di base crittografici che gestiscono un algoritmo sottostante in modo che gli utenti possano eseguire le attività crittografiche in sicurezza. Una primitiva definisce i dettagli di un algoritmo crittografico e il tipo di chiave.
Primitive supportate da Tink:
- AEAD (Crittografia autenticata con dati associati): la primitiva più comune per la crittografia dei dati, adatta alla maggior parte delle esigenze di crittografia. AEAD fornisce riservatezza in testo non crittografato e consente la verifica della sua integrità e della sua autenticità. Consulta il documento sulla crittografia autenticata con dati associati (AEAD).
- Crittografia deterministica: una primitiva che produce sempre lo stesso
testo crittografato per un testo non crittografato e una chiave specifici. Questo può essere rischioso perché un utente malintenzionato deve solo scoprire quale testo crittografato corrisponde a un determinato input di testo non crittografato. Vedi AEAD deterministici.
- Firma digitale: una primitiva asimmetrica (vedi Crittografia delle chiavi asimmetriche) per confermare l'autenticità e l'integrità dei dati firmati. Consulta Firma digitale.
- Crittografia ibrida: una primitiva che combina crittografia di chiavi asimmetriche e crittografia di chiavi simmetriche (vedi Crittografia a chiave asimmetrica e Crittografia a chiavi simmetriche). La crittografia ibrida combina l'efficienza della crittografia simmetrica con la comodità della crittografia a chiave pubblica. Per criptare un messaggio, viene generata una nuova chiave simmetrica che viene utilizzata per criptare i dati in testo non crittografato, mentre la chiave pubblica del destinatario viene utilizzata solo per criptare la chiave simmetrica. Il testo crittografato finale è costituito dal testo crittografato simmetrico e dalla chiave simmetrica criptata. Vedi Crittografia ibrida.
- MAC (Message Authentication Code): una primitiva simmetrica (vedi Crittografia delle chiavi simmetriche) per confermare l'autenticità e l'integrità dei dati. Vedi MAC (Message Authentication Code).
- Flusso di dati AEAD: una soluzione primitiva che fornisce la crittografia autenticata per i flussi di dati; utile quando i dati da criptare sono troppo grandi per essere elaborati in un solo passaggio. Vedi AEAD streaming.
Vedi Primitive supportate per lingua per informazioni sulla compatibilità.
Per ulteriori informazioni, consulta la pagina dedicata al design primitivo.
Tipi di chiavi
Un tipo di chiave implementa una primitiva specifica. La maggior parte delle primitive ha diversi tipi di chiave tra cui scegliere a seconda dei requisiti di sicurezza, runtime e spazio. Ad esempio, AES128_GCM è un AEAD veloce ed efficace per la maggior parte delle esigenze. Per saperne di più, consulta Tipi di chiavi supportati per lingua.
Set di chiavi e handle
Tink utilizza i set di chiavi per la gestione delle chiavi. Un set di chiavi è essenzialmente un insieme di chiavi
che ne facilitano la rotazione. Le proprietà degne di nota di un set di chiavi sono:
- Ogni chiave di un set di chiavi ha un ID univoco, univoco all'interno di un set di chiavi. Questo ID viene generalmente aggiunto come prefisso a ogni testo crittografato, firma o tag generato per indicare la chiave utilizzata. Per saperne di più, scopri come Tink tagga i testi crittografati.
- Solo una chiave alla volta in un set di chiavi è principale. Una chiave primaria in un set
di chiavi è attualmente "in uso".
- Tutte le chiavi di un set di chiavi devono essere implementazioni della stessa primitiva (ad esempio AEAD), ma possono avere tipi di chiavi diversi (ad esempio una chiave AES-GCM e XCHACHA20-POLY1305).
Ogni implementazione di Tink fornisce API per creare o modificare set di chiavi. Tuttavia, ti consigliamo di utilizzare Tinkey, il nostro strumento di interfaccia a riga di comando.
Gli utenti gestiscono un set di chiavi utilizzando gli handle di set di chiavi. Un handle di set di chiavi limita l'esposizione dell'effettivo materiale della chiave sensibile. Inoltre, astrae un set di chiavi
consentendo agli utenti di ottenere una primitiva che esegue il "wrapping" dell'intero set di chiavi. Ad esempio, puoi ottenere una primitiva AEAD di un set di chiavi con chiavi N
. La crittografia e la decrittografia con la primitiva ottenuta utilizzano quindi la chiave primaria del set di chiavi.
Per maggiori informazioni, consulta la sezione relativa alla progettazione dei set di tasti.
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-25 UTC.
[null,null,["Ultimo aggiornamento 2025-07-25 UTC."],[[["\u003cp\u003eTink utilizes primitives as fundamental cryptographic building blocks for secure data operations, covering encryption, signatures, and message authentication.\u003c/p\u003e\n"],["\u003cp\u003eKeysets in Tink efficiently manage multiple keys for a single purpose, enabling features like key rotation and supporting various key types within a set.\u003c/p\u003e\n"],["\u003cp\u003eKeyset handles provide a secure abstraction layer, allowing users to interact with keys and perform cryptographic operations without directly exposing sensitive key material.\u003c/p\u003e\n"],["\u003cp\u003eTink offers a diverse selection of primitives and key types, accommodating varying security, performance, and storage requirements, with options like AEAD, digital signatures, and hybrid encryption.\u003c/p\u003e\n"]]],["Tink employs cryptographic building blocks called *primitives*, which define algorithms and key types. These include AEAD, Deterministic encryption, Digital signature, Hybrid encryption, MAC, and Streaming AEAD. *Key types* implement primitives, offering choices based on security and performance. *Keysets*, a set of keys with unique IDs, manage key rotation. *Keyset handles* abstract keysets, providing access to a primitive that operates over the entire keyset, including encryption/decryption with the primary key.\n"],null,["# Understand Key Concepts in Tink\n\nWhen you start working with Tink for the first time, there are some key concepts\nyou should understand before you begin your journey; these are described in the\nfollowing sections.\n\nPrimitives\n----------\n\nTink uses *primitives* as cryptographic building blocks that manage an\nunderlying algorithm so users can perform cryptographic tasks safely. A\nprimitive defines the details of a cryptographic algorithm and the key type.\n\nPrimitives supported by Tink:\n\n- **Authenticated Encryption with Associated Data (AEAD)** : The most common primitive for data encryption; suitable for most encryption needs. AEAD provides plaintext confidentiality, and allows verification of its integrity and authenticity. See [Authenticated Encryption with Associated Data\n (AEAD)](/tink/aead).\n- **Deterministic encryption:** A primitive that always produces the same ciphertext for a given plaintext and key. This can be risky, because an attacker only needs to find out which ciphertext corresponds to a given plaintext input to identify it. See [Deterministic\n AEAD](/tink/deterministic-aead).\n- **Digital signature** : An asymmetric (see *Asymmetric key encryption* ) primitive for confirming the authenticity and integrity of signed data. See [Digital signature](/tink/digital-signature).\n- **Hybrid encryption** : A primitive that combines asymmetric key encryption and symmetric key encryption (see *Asymmetric key encryption* and *Symmetric\n key encryption* ). Hybrid encryption combines the efficiency of symmetric encryption with the convenience of public-key encryption. To encrypt a message, a fresh symmetric key is generated and used to encrypt the plaintext data, while the recipient's public key is used to encrypt the symmetric key only. The final ciphertext consists of the symmetric ciphertext and the encrypted symmetric key. See [Hybrid\n encryption](/tink/hybrid).\n- **Message Authentication Code (MAC)** : A symmetric (see *Symmetric key\n encryption* ) primitive for confirming the authenticity and integrity of data. See [Message Authentication Code (MAC)](/tink/mac).\n- **Streaming AEAD** : A primitive providing authenticated encryption for streaming data; useful when the data to be encrypted is too large to be processed in a single step. See [Streaming AEAD](/tink/streaming-aead).\n\nSee [Supported primitives by language](/tink/primitives-by-language) for\ncompatibility information.\n\nFor more info, see [primitive design](/tink/design/primitives_and_interfaces).\n\nKey types\n---------\n\nA *key type* implements a specific primitive. Most primitives have several key\ntypes to choose from depending on your requirements for security, runtime, and\nspace. For example, AES128_GCM is an [AEAD](/tink/aead) that is fast and\neffective for most needs. See more at [Supported key types by\nlanguage](/tink/supported-key-types).\n\nKeysets \\& keyset handles\n-------------------------\n\nTink uses *keysets* for managing keys. A keyset is essentially a set of keys\nthat facilitate key rotation. Noteworthy properties of a keyset are:\n\n- Each key in a keyset has a unique ID, which is unique within a keyset. This ID is usually added as a prefix to each produced ciphertext, signature or tag to indicate which key was used (see how Tink [tags\n ciphertexts](/tink/design/keysets#tagging_ciphertexts) for more info).\n- Only one key at a time in a keyset is *primary*. A primary key in a keyset is the key \"in use\" at the moment.\n- All the keys in a keyset *must* be implementations of the same primitive (such as AEAD), but can have different key types (for example, an AES-GCM and XCHACHA20-POLY1305 key).\n\nEach Tink implementation provides APIs to create or edit keysets. However, we\nrecommend using [Tinkey](/tink/tinkey-overview) our CLI tool.\n\nUsers operate over a keyset using *keyset handles* . A keyset handle limits the\nexposure of the actual sensitive key material. It also abstracts a keyset\nallowing users to obtain a primitive that \"wraps\" the entire keyset. For\nexample, you can get an AEAD primitive of a keyset with `N` keys; encryption and\ndecryption with the obtained primitive then uses the primary key in the keyset.\n\nFor more info, see [keyset design](/tink/design/keysets)."]]