Chuyển đến nội dung
Skillpedia
Kiểm thử8.0k · #12724

wycheproof

Skill này làm gì

Skill này kiểm tra code mật mã với một bộ test vector công khai, gồm các tấn công đã biết và đầu vào khó. Skill dành cho lập trình viên và kiểm toán viên muốn xác nhận thư viện xử lý đúng các trường hợp đó.

Khi nào nên dùng

  • ✓Khi bạn muốn kiểm thử code AES, RSA, ECDSA hoặc ECDH với các trường hợp test chuẩn.
  • ✓Khi bạn cần kiểm tra một thư viện với các tấn công đã biết và trường hợp biên.
  • ✓Khi một bài test Wycheproof thất bại và bạn cần hiểu lý do.

Liên kết skill

https://github.com/trailofbits/skills/blob/main/plugins/testing-handbook-skills/skills/wycheproof/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/trailofbits/skills/blob/main/plugins/testing-handbook-skills/skills/wycheproof/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi muốn chạy bản triển khai ECDSA của chúng tôi với các test vector Wycheproof và xem những trường hợp nào thất bại.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent tải các test vector, nhóm chúng theo kích thước khóa và các thuộc tính khác, rồi kiểm tra từng kết quả với cờ đạt hoặc không đạt mong đợi. Các trường hợp lỗi được liệt kê cùng đầu vào gây ra chúng.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Wycheproof

Wycheproof is an extensive collection of test vectors designed to verify the correctness of cryptographic implementations and test against known attacks. Originally developed by Google, it is now a community-managed project where contributors can add test vectors for specific cryptographic constructions.

Background

Key Concepts

Concept Description
Test vector Input/output pair for validating crypto implementation correctness
Test group Collection of test vectors sharing attributes (key size, IV size, curve)
Result flag Indicates if test should pass (valid), fail (invalid), or is acceptable
Edge case testing Testing for known vulnerabilities and attack patterns

Why This Matters

Cryptographic implementations are notoriously difficult to get right. Even small bugs can:

  • Expose private keys
  • Allow signature forgery
  • Enable message decryption
  • Create consensus problems when different implementations accept/reject the same inputs

Wycheproof has found vulnerabilities in major libraries including OpenJDK's SHA1withDSA, Bouncy Castle's ECDHC, and the elliptic npm package.

When to Use

Apply Wycheproof when:

  • Testing cryptographic implementations (AES-GCM, ECDSA, ECDH, RSA, etc.)
  • Validating that crypto code handles edge cases correctly
  • Verifying implementations against known attack vectors
  • Setting up CI/CD for cryptographic libraries
  • Auditing third-party crypto code for correctness

Consider alternatives when:

  • Testing for timing side-channels (use constant-time testing tools instead)
  • Finding new unknown bugs (use fuzzing instead)
  • Testing custom/experimental cryptographic algorithms (Wycheproof only covers established algorithms)

Quick Reference

Scenario Recommended Approach Notes
AES-GCM implementation Use aes_gcm_test.json 316 test vectors across 44 test groups
ECDSA verification Use ecdsa_*_test.json for specific curves Tests signature malleability, DER encoding
ECDH key exchange Use ecdh_*_test.json Tests invalid curve attacks
RSA signatures Use rsa_*_test.json Tests padding oracle attacks
ChaCha20-Poly1305 Use chacha20_poly1305_test.json Tests AEAD implementation

Testing Workflow

Phase 1: Setup                 Phase 2: Parse Test Vectors
┌─────────────────┐          ┌─────────────────┐
│ Add Wycheproof  │    →     │ Load JSON file  │
│ as submodule    │          │ Filter by params│
└─────────────────┘          └─────────────────┘
         ↓                            ↓
Phase 4: CI Integration        Phase 3: Write Harness
┌─────────────────┐          ┌─────────────────┐
│ Auto-update     │    ←     │ Test valid &    │
│ test vectors    │          │ invalid cases   │
└─────────────────┘          └─────────────────┘

Repository Structure

The Wycheproof repository is organized as follows:

┣ 📜 README.md       : Project overview
┣ 📂 doc             : Documentation
┣ 📂 java            : Java JCE interface testing harness
┣ 📂 javascript      : JavaScript testing harness
┣ 📂 schemas         : Test vector schemas
┣ 📂 testvectors     : Test vectors
┗ 📂 testvectors_v1  : Updated test vectors (more detailed)

The essential folders are testvectors and testvectors_v1. While both contain similar files, testvectors_v1 includes more detailed information and is recommended for new integrations.

Supported Algorithms

Wycheproof provides test vectors for a wide range of cryptographic algorithms:

Category Algorithms
Symmetric Encryption AES-GCM, AES-EAX, ChaCha20-Poly1305
Signatures ECDSA, EdDSA, RSA-PSS, RSA-PKCS1
Key Exchange ECDH, X25519, X448
Hashing HMAC, HKDF
Curves secp256k1, secp256r1, secp384r1, secp521r1, ed25519, ed448

Test File Structure

Each JSON test file tests a specific cryptographic construction. All test files share common attributes:

"algorithm"         : The name of the algorithm tested
"schema"            : The JSON schema (found in schemas folder)
"generatorVersion"  : The version number
"numberOfTests"     : The total number of test vectors in this file
"header"            : Detailed description of test vectors
"notes"             : In-depth explanation of flags in test vectors
"testGroups"        : Array of one or multiple test groups

Test Groups

Te

Câu hỏi thường gặp

Test vector là gì?

Đó là một tập giá trị đầu vào và đầu ra mà bản triển khai đúng phải xử lý theo cách đã biết.

Những thuật toán nào được bao phủ?

Skill đề cập đến AES, RSA, ECDSA, ECDH và nhiều thuật toán khác.

Làm sao để đọc một trường hợp lỗi?

Skill giải thích cách đọc một trường hợp lỗi để bạn hiểu điều gì đã sai.

Chi tiết

Mô tả gốc của tác giả

Validates cryptographic implementations against Project Wycheproof's test vectors, which encode known attacks and edge cases across AES, RSA, ECDSA, ECDH, and more. Covers loading test vectors, mapping result flags onto pass and fail expectations, and reading a failure. Use when testing a crypto implementation against known attacks, checking a library against standard test vectors, or investigating why two implementations disagree on the same input.

repo: trailofbits/skills

Độ phổ biến

Sao GitHub
8.0k
Vị trí xếp hạng
#12724
Giấy phép
CC-BY-SA-4.0
Cập nhật
2/11/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự