Tink の主なコンセプトを理解する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
Tink を初めて使用する場合は、作業を開始する前に理解しておくべき重要なコンセプトがいくつかあります。これらについては、次のセクションで説明します。
プリミティブ
Tink は、基盤となるアルゴリズムを管理する暗号ビルディング ブロックとしてプリミティブを使用して、ユーザーが暗号タスクを安全に実行できるようにします。プリミティブは、暗号アルゴリズムの詳細と鍵タイプを定義します。
Tink でサポートされているプリミティブ:
- 関連データによる認証付き暗号化(AEAD): データ暗号化の最も一般的なプリミティブ。ほとんどの暗号化要件に適しています。AEAD は平文の機密性を提供し、その完全性と真正性を検証できます。関連データによる認証付き暗号化(AEAD)をご覧ください。
- 確定的暗号化: 指定された平文と鍵に対して常に同じ暗号テキストを生成するプリミティブ。攻撃者は特定の平文の入力に対応する暗号テキストを見つけるだけで識別できるため、これは危険です。確定的 AEAD をご覧ください。
- デジタル署名: 署名されたデータの信頼性と完全性を確認するための非対称鍵暗号化(非対称鍵暗号化を参照)のプリミティブ。デジタル署名をご覧ください。
- ハイブリッド暗号化: 非対称鍵暗号化と対称鍵暗号化を組み合わせたプリミティブ(非対称鍵暗号化と対称鍵暗号化を参照)。ハイブリッド暗号化は、対称暗号化の効率と公開鍵暗号化の利便性を組み合わせたものです。メッセージを暗号化するために、新しい対称鍵が生成され、平文データの暗号化に使用されます。一方、受信者の公開鍵は、対称鍵の暗号化にのみ使用されます。最終的な暗号テキストは、対称暗号テキストと暗号化された対称鍵で構成されます。ハイブリッド暗号化をご覧ください。
- メッセージ認証コード(MAC): データの信頼性と完全性を確認するための対称(対称鍵暗号化)プリミティブ。メッセージ認証コード(MAC)をご覧ください。
- ストリーミング AEAD: ストリーミング データの認証済み暗号化を提供するプリミティブ。暗号化するデータが大きすぎて 1 つのステップで処理できない場合に便利です。ストリーミング AEAD をご覧ください。
互換性については、言語ごとにサポートされるプリミティブをご覧ください。
詳細については、プリミティブ デザインをご覧ください。
キーのタイプ
鍵型は特定のプリミティブを実装します。ほとんどのプリミティブには、セキュリティ、ランタイム、スペースの要件に応じていくつかのキータイプがあります。たとえば、AES128_GCM は、ほとんどのニーズに対して高速で効果的な AEAD です。詳細については、言語でサポートされているキータイプをご覧ください。
鍵セットと鍵セット ハンドル
Tink は鍵の管理に鍵セットを使用します。鍵セットとは基本的に、鍵のローテーションを容易にする鍵のセットです。鍵セットの注目すべきプロパティは次のとおりです。
- 鍵セット内の各鍵には一意の ID があり、この ID は鍵セット内で一意です。この ID は通常、生成された各暗号テキスト、署名、またはタグに接頭辞として追加され、使用された鍵を示します(詳細については、Tink が暗号テキストにタグ付けする方法をご覧ください)。
- 鍵セット内では一度に 1 つの鍵のみが primary になります。鍵セットの主キーは、その時点で「使用中」の鍵です。
- 鍵セット内のすべての鍵は、同じプリミティブ(AEAD など)の実装である必要がありますが、異なる鍵タイプ(AES-GCM 鍵や XCHACHA20-POLY1305 鍵など)を持つことができます。
Tink の各実装には、キーセットを作成または編集するための API が用意されています。ただし、CLI ツール Tinkey を使用することをおすすめします。
ユーザーは、鍵セット ハンドルを使用して鍵セットを操作する。鍵セット ハンドルは実際の機密鍵マテリアルの公開を制限します。また、鍵セットを抽象化し、鍵セット全体を「ラップ」するプリミティブをユーザーが取得できるようにします。たとえば、N
鍵を使用して鍵セットの AEAD プリミティブを取得できます。取得したプリミティブでの暗号化と復号では、鍵セットの主キーが使用されます。
詳細については、鍵セットの設計をご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[null,null,["最終更新日 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)."]]