SSH पब्लिक key क्या है?

SSH पब्लिक key एक क्रिप्टोग्राफिक key pair का आधा हिस्सा है, जिसका उपयोग SSH (Secure Shell) protocol पर सुरक्षित authentication के लिए किया जाता है। जब आप SSH key pair generate करते हैं, तो आपको एक private key (जो आपकी मशीन पर गुप्त रखी जाती है) और एक public key (जो उन servers के साथ साझा की जाती है जिन तक आप access करना चाहते हैं) मिलती है। Server आपकी पहचान verify करने के लिए आपकी public key का उपयोग करता है, बिना कोई password transmit किए।

SSH पब्लिक keys को OpenSSH format में text की एक single line के रूप में store किया जाता है, जिसमें तीन भाग होते हैं: key type (जैसे ssh-rsa या ssh-ed25519), base64-encoded key data, और एक optional comment (आमतौर पर user@hostname)। Base64 data के अंदर structured binary information होती है, जिसमें algorithm parameters और वास्तविक क्रिप्टोग्राफिक सामग्री शामिल होती है।

Fingerprints, key data के छोटे, human-readable hashes होते हैं। ये पूरी base64 string पढ़े बिना keys को verify और compare करना आसान बनाते हैं। दो सबसे सामान्य fingerprint formats हैं SHA-256 (आधुनिक default) और MD5 (colon-separated hex pairs वाला legacy format)।

Tool का विवरण

यह tool OpenSSH format में SSH पब्लिक keys को parse करता है और सभी महत्वपूर्ण metadata निकालता है। अपनी public key paste करें और तुरंत key type, algorithm, bits में key size, comment, और SHA-256 तथा MD5 दोनों fingerprints देखें — जो ssh-keygen -l से मिलने वाले output से मेल खाते हैं।

उदाहरण

Input:

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl user@laptop

Output:

फ़ील्ड मान
Key type ssh-ed25519
Algorithm Ed25519
Key size 256 bits
Comment user@laptop
Fingerprint SHA-256 SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
Fingerprint MD5 MD5:16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48

विशेषताएँ

  • RSA, Ed25519, ECDSA (P-256, P-384, P-521), DSA, और Security Key (FIDO) key types को support करता है
  • Standard OpenSSH format में SHA-256 और MD5 fingerprints compute करता है
  • Binary key data से सीधे bits में key size निकालता है
  • Base64 integrity और embedded type consistency सहित key structure को validate करता है
  • Public key line से optional comment field को parse करता है

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

यह tool input को तीन भागों में विभाजित करता है: key type, base64 data, और comment। फिर यह base64 data को binary में decode करता है और SSH के length-prefixed format का उपयोग करके internal structure को पढ़ता है, जहाँ प्रत्येक field 4-byte big-endian length से शुरू होती है, जिसके बाद field data आता है। Key size algorithm-specific parameters से निर्धारित होती है — RSA के लिए यह modulus n की bit length है, DSA के लिए यह prime p है, और elliptic curve keys के लिए यह curve name से derived होती है। Fingerprints, raw binary key data को SHA-256 और MD5 से hash करके compute किए जाते हैं।

समर्थित key types

Type identifier Algorithm
ssh-rsa RSA
ssh-ed25519 Ed25519
ecdsa-sha2-nistp256 ECDSA (P-256)
ecdsa-sha2-nistp384 ECDSA (P-384)
ecdsa-sha2-nistp521 ECDSA (P-521)
ssh-dss DSA
sk-ssh-ed25519@openssh.com Ed25519-SK (Security Key)
sk-ecdsa-sha2-nistp256@openssh.com ECDSA-SK (Security Key)

उपयोग के मामले

  • Key fingerprints verify करना — यह confirm करें कि कोई public key, authorized_keys या किसी Git hosting service में जोड़ने से पहले expected fingerprint से मेल खाती है
  • Server access की जाँच करना — अपनी authorized_keys file में keys के algorithm और key size को जल्दी से पहचानें, ताकि कमज़ोर या पुरानी keys खोजी जा सकें
  • SSH समस्याओं को debug करना — जाँचें कि कोई key सही format में है, expected algorithm का उपयोग करती है, और उसकी structure valid है

अक्सर पूछे जाने वाले प्रश्न

मुझे अपनी SSH पब्लिक key कहाँ मिलेगी? अधिकांश systems पर यह ~/.ssh/id_ed25519.pub, ~/.ssh/id_rsa.pub, या algorithm के आधार पर किसी समान path पर store होती है। आप अपने SSH agent में load की गई keys की सूची देखने के लिए ssh-add -L भी चला सकते हैं।

क्या अपनी public key साझा करना सुरक्षित है? हाँ। Public key को साझा करने के लिए ही बनाया गया है। इसका उपयोग private key derive करने या आपकी ओर से authenticate करने के लिए नहीं किया जा सकता।

SHA-256 और MD5 fingerprints अलग-अलग क्यों दिखते हैं? SHA-256 fingerprints base64-encoded होते हैं और SHA256: से prefixed होते हैं, जबकि MD5 fingerprints colon-separated hexadecimal pairs का उपयोग करते हैं और MD5: से prefixed होते हैं। SHA-256 आधुनिक OpenSSH versions में default है।