ทำความเข้าใจแนวคิดหลักใน Tink
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เมื่อเริ่มทำงานกับ Tink เป็นครั้งแรก คุณควรทำความเข้าใจแนวคิดสำคัญบางอย่างก่อนเริ่มต้นเส้นทางการดำเนินงาน โดยเราได้อธิบายไว้ในส่วนต่อไปนี้
แบบพื้นฐาน
Tink ใช้ Primitives เป็นองค์ประกอบที่ใช้สร้างสรรค์แบบเข้ารหัสที่จัดการอัลกอริทึมเบื้องหลัง เพื่อให้ผู้ใช้ดำเนินงานในวิทยาการเข้ารหัสลับได้อย่างปลอดภัย แบบพื้นฐานจะกำหนดรายละเอียดของอัลกอริทึมการเข้ารหัสและประเภทคีย์
แบบพื้นฐานที่ Tink รองรับ:
- การเข้ารหัสที่ตรวจสอบสิทธิ์ด้วยข้อมูลที่เกี่ยวข้อง (AEAD): เป็นวิธีพื้นฐานที่สุดสำหรับการเข้ารหัสข้อมูล ซึ่งเหมาะสำหรับความต้องการในการเข้ารหัสส่วนใหญ่ โดย AEAD จะรักษาข้อมูลที่เป็นความลับแบบข้อความธรรมดา และให้ผู้ใช้ยืนยันความสมบูรณ์และความถูกต้อง โปรดดูการเข้ารหัสที่ตรวจสอบสิทธิ์แล้วด้วยข้อมูลที่เกี่ยวข้อง (AEAD)
- การเข้ารหัสเชิงกำหนด: รูปแบบพื้นฐานที่จะสร้างข้อความเข้ารหัสเดียวกันเสมอสำหรับข้อความธรรมดาและคีย์ที่ระบุ ซึ่งเป็นวิธีที่มีความเสี่ยง เนื่องจากผู้โจมตีต้องการเพียงแค่ค้นหาว่าข้อความเข้ารหัสใดที่สอดคล้องกับอินพุตข้อความธรรมดาที่ระบุเพื่อที่จะระบุถึงข้อมูลนั้น ดูกำหนด AEAD
- ลายเซ็นดิจิทัล: แบบอสมมาตร (ดูการเข้ารหัสคีย์แบบอสมมาตร) แบบพื้นฐานเพื่อยืนยันความถูกต้องและความสมบูรณ์ของข้อมูลที่ลงชื่อ ดูลายเซ็นดิจิทัล
- การเข้ารหัสแบบผสม: แบบพื้นฐานที่รวมการเข้ารหัสคีย์แบบอสมมาตรและการเข้ารหัสคีย์แบบสมมาตร (ดูการเข้ารหัสคีย์แบบอสมมาตรและการเข้ารหัสคีย์แบบสมมาตร) การเข้ารหัสแบบผสมรวมประสิทธิภาพของการเข้ารหัสแบบสมมาตรเข้ากับความสะดวกของการเข้ารหัสคีย์สาธารณะ ในการเข้ารหัสข้อความ จะมีการสร้างคีย์สมมาตรใหม่และใช้ในการเข้ารหัสข้อมูลข้อความธรรมดา ในขณะที่คีย์สาธารณะของผู้รับจะใช้เพื่อเข้ารหัสคีย์แบบสมมาตรเท่านั้น ข้อความเข้ารหัสขั้นสุดท้ายประกอบด้วยข้อความที่เข้ารหัสแบบสมมาตรและคีย์แบบสมมาตรที่เข้ารหัส โปรดดูการเข้ารหัสแบบผสม
- รหัสการตรวจสอบสิทธิ์ข้อความ (MAC): ค่าพื้นฐานแบบสมมาตร (ดูการเข้ารหัสคีย์แบบสมมาตร) พื้นฐานสำหรับการยืนยันความถูกต้องและความสมบูรณ์ของข้อมูล โปรดดูรหัสการตรวจสอบสิทธิ์ข้อความ (MAC)
- AEAD สำหรับสตรีมมิง: การเข้ารหัสแบบพื้นฐานที่มีการตรวจสอบสิทธิ์สำหรับข้อมูลสตรีมมิง ซึ่งมีประโยชน์เมื่อข้อมูลที่จะเข้ารหัสมีขนาดใหญ่เกินกว่าจะได้รับการประมวลผลในขั้นตอนเดียว ดูสตรีมมิง AEAD
โปรดดูค่าพื้นฐานที่รองรับตามภาษาสำหรับข้อมูลความเข้ากันได้
ดูข้อมูลเพิ่มเติมได้ที่การออกแบบพื้นฐาน
ประเภทคีย์
ประเภทคีย์มีการใช้ค่าพื้นฐานที่เฉพาะเจาะจง ประเภทพื้นฐานส่วนใหญ่จะมีคีย์หลายประเภทให้เลือก ขึ้นอยู่กับข้อกำหนดด้านความปลอดภัย รันไทม์ และพื้นที่ ตัวอย่างเช่น AES128_GCM เป็น AEAD ที่รวดเร็วและมีประสิทธิภาพสำหรับความต้องการส่วนใหญ่ ดูรายละเอียดเพิ่มเติมได้ที่ประเภทคีย์ที่รองรับตามภาษา
คีย์เซ็ตและชุดคีย์
Tink ใช้ชุดคีย์ในการจัดการคีย์ โดยพื้นฐานแล้ว ชุดคีย์คือชุดของคีย์
ที่อำนวยความสะดวกในการหมุนเวียนคีย์ คุณสมบัติที่โดดเด่นของชุดคีย์ ได้แก่
- แต่ละคีย์ในชุดคีย์จะมีรหัสที่ไม่ซ้ำกัน ซึ่งไม่ซ้ำกันภายในชุดคีย์ โดยปกติแล้ว ระบบจะเพิ่มรหัสนี้เป็นคำนำหน้าข้อความเข้ารหัส ลายเซ็น หรือแท็กแต่ละรายการที่สร้างขึ้นเพื่อระบุว่ามีการใช้คีย์ใด (ดูข้อมูลเพิ่มเติมในข้อความเข้ารหัสของแท็ก Tink)
- คีย์ในชุดคีย์เป็นคีย์หลักเพียงครั้งละ 1 คีย์ คีย์หลักในชุดคีย์คือคีย์ที่ "ใช้งานอยู่" ในขณะนี้
- คีย์ทั้งหมดในชุดคีย์ต้องเป็นการติดตั้งใช้งานคีย์ดั้งเดิมเดียวกัน (เช่น AEAD) แต่อาจมีประเภทคีย์ต่างกันได้ (เช่น คีย์ AES-GCM และ XCHACHA20-POLY1305)
การใช้งาน Tink แต่ละครั้งจะมี API สำหรับสร้างหรือแก้ไขชุดคีย์ อย่างไรก็ตาม เราขอแนะนำให้ใช้ Tinkey ในเครื่องมือ CLI
ผู้ใช้ดำเนินการผ่านชุดคีย์โดยใช้แฮนเดิลชุดคีย์ แฮนเดิลชุดคีย์จะจำกัดการเปิดเผยเนื้อหาคีย์ที่มีความละเอียดอ่อนจริง และยังแยกชุดคีย์ที่ทำให้ผู้ใช้ได้มาซึ่งค่าพื้นฐานที่ "รวม" ชุดคีย์ทั้งชุด ตัวอย่างเช่น คุณสามารถรับค่าพื้นฐาน AEAD ของชุดคีย์ที่มีคีย์ N
การเข้ารหัสและการถอดรหัสด้วยค่าดั้งเดิมที่ได้มา จากนั้นจะใช้คีย์หลักในชุดคีย์
ดูข้อมูลเพิ่มเติมได้ที่การออกแบบชุดคีย์
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 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)."]]