मुख्य सामग्री पर जाएँ
Skillpedia
सिक्योरिटी35k · #8065

implementing-jwt-signing-and-verification

यह क्या करती है

यह टूल JWT नाम के सिक्योरिटी टोकन बनाने और जांचने में मदद करता है। इनका इस्तेमाल यह सुनिश्चित करने के लिए होता है कि वेबसाइट और ऐप की जानकारी सिर्फ़ अधिकृत लोग ही देख सकें, और इससे हैकर्स से बचाव होता है।

कब इस्तेमाल करें

  • ✓किसी वेबसाइट या ऐप की सिक्योरिटी सेट करते समय।
  • ✓यह जांचते समय कि एक्सेस टोकन सही हैं या नहीं।
  • ✓संवेदनशील डेटा को बिना अनुमति के एक्सेस से बचाते समय।

Skill का लिंक

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-jwt-signing-and-verification/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/implementing-jwt-signing-and-verification/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“इस JWT टोकन को वेरिफ़ाई करो और देखो कि यह सुरक्षित है और इसमें छेड़छाड़ नहीं हुई है।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

यह टूल टोकन बनते समय क्रिप्टोग्राफ़िक तरीकों से उन पर साइन करता है, जिससे उनकी असली पहचान सुनिश्चित होती है। जब कोई टोकन मिलता है, तो वही क्रिप्टोग्राफ़ी इस्तेमाल करके जांचा जाता है कि वह वैध है और उसमें कोई बदलाव नहीं हुआ है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Implementing JWT Signing and Verification

Overview

JSON Web Tokens (JWT) defined in RFC 7519 are compact, URL-safe tokens used for authentication and authorization in web applications. This skill covers implementing secure JWT signing with HMAC-SHA256, RSA-PSS, and EdDSA algorithms, along with verification, token expiration, claims validation, and defense against common JWT attacks (algorithm confusion, none algorithm, key injection).

When to Use

  • When deploying or configuring implementing jwt signing and verification capabilities in your environment
  • When establishing security controls aligned to compliance requirements
  • When building or improving security architecture for this domain
  • When conducting security assessments that require this implementation

Prerequisites

  • Familiarity with cryptography concepts and tools
  • Access to a test or lab environment for safe execution
  • Python 3.8+ with required dependencies installed
  • Appropriate authorization for any testing activities

Objectives

  • Implement JWT signing with HS256, RS256, ES256, and EdDSA
  • Verify JWT signatures and validate standard claims
  • Implement token expiration, not-before, and audience validation
  • Defend against algorithm confusion and none algorithm attacks
  • Implement JWT key rotation with JWK Sets
  • Build a complete authentication middleware

Key Concepts

JWT Algorithms

Algorithm Type Key Security Level
HS256 Symmetric (HMAC) Shared secret 128-bit
RS256 Asymmetric (RSA) RSA key pair 112-bit
ES256 Asymmetric (ECDSA) P-256 key pair 128-bit
EdDSA Asymmetric (Ed25519) Ed25519 pair 128-bit

Common JWT Attacks

  • Algorithm confusion: Switching from RS256 to HS256, using public key as HMAC secret
  • None algorithm: Setting alg=none to bypass signature verification
  • Key injection: Embedding key in JWK header
  • Weak secrets: Brute-forcing short HMAC secrets
  • Token replay: Reusing valid tokens without expiration

Security Considerations

  • Always validate the algorithm header against an allowlist
  • Never accept alg=none in production
  • Use asymmetric algorithms (RS256, ES256) for distributed systems
  • Set short expiration times (15 min for access tokens)
  • Implement token refresh mechanism
  • Store secrets securely (not in source code)

Validation Criteria

  • JWT signing produces valid tokens for all algorithms
  • Signature verification rejects tampered tokens
  • Expired tokens are rejected
  • Algorithm confusion attack is prevented
  • None algorithm is rejected
  • JWK key rotation works correctly
  • Claims validation enforces all required claims
अक्सर पूछे जाने वाले सवाल

JWT क्या है?

JWT का पूरा नाम JSON Web Token है। यह एक डिजिटल पहचान पत्र की तरह है जो सुरक्षित और छोटे रूप में बताता है कि आप कौन हैं, किसी वेबसाइट या ऐप को।

HS256, RS256 जैसे अलग-अलग एल्गोरिदम क्यों इस्तेमाल होते हैं?

हर एल्गोरिदम टोकन पर साइन करने और उसे वेरिफ़ाई करने के लिए अलग तरह की 'key' इस्तेमाल करता है। कुछ एक साझा गुप्त key (HS256) इस्तेमाल करते हैं, जबकि बड़े सिस्टम में ज़्यादा सुरक्षा के लिए key pair (एक public और एक private) इस्तेमाल होती है (RS256, ES256, EdDSA)।

'algorithm confusion' या 'none algorithm' जैसे हमले क्या हैं?

ये हैकर्स की वे कोशिशें हैं जिनसे सिस्टम को धोखा दिया जाता है। जैसे सिस्टम को यह यकीन दिलाना कि टोकन किसी सुरक्षित तरीके से साइन हुआ है, जबकि ऐसा नहीं था, या बिना सिग्नेचर वाला टोकन भेजकर सुरक्षा को पार करने की कोशिश करना।

जानकारी

लेखक का मूल विवरण

Implements secure JWT (RFC 7519) signing and verification using HMAC-SHA256, RSA-PSS, ES256, and EdDSA, including token expiration, claims validation, and defenses against algorithm-confusion, none-algorithm, and key-injection attacks. Use when adding or hardening JWT-based authentication/authorization, or when auditing token verification code for common JWT vulnerabilities.

repo: mukul975/Anthropic-Cybersecurity-Skills

लोकप्रियता

GitHub स्टार
35k
रैंकिंग में स्थान
#8065
लाइसेंस
Apache-2.0
अपडेट की गई
31/8/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

मिलती-जुलती skills