Compare commits
3 Commits
1de61a888d
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a369b9b5b7
|
||
|
|
84838ce0c6
|
||
|
|
ce2081c811
|
@@ -6,3 +6,4 @@ set -e
|
||||
cd "${PWD}/_ref"
|
||||
asciidoctor -o ./KEY_GUIDE.html ./KEY_GUIDE.adoc
|
||||
git add KEY_GUIDE.html
|
||||
echo "Generated KEY_GUIDE.html"
|
||||
|
||||
@@ -635,7 +635,7 @@ pre.rouge .gs {
|
||||
<h1>OpenSSH Key Structure Guide</h1>
|
||||
<div class="details">
|
||||
<span id="author" class="author">brent saner <bts@square-r00t.net>, https://r00t2.io</span><br>
|
||||
<span id="revdate">Last updated 2025-09-01 13:47:06 -0400</span>
|
||||
<span id="revdate">Last updated 2025-09-02 21:33:25 -0400</span>
|
||||
</div>
|
||||
<div id="toc" class="toc2">
|
||||
<div id="toctitle">Table of Contents</div>
|
||||
@@ -1264,7 +1264,7 @@ ftSfkGNUzTzPFbF5iEukTvKm42a7F/I/ExMVgpN/eQxJ7+m5TOgja0KC1h5fCN4L
|
||||
4.0.1.5 uint32 allocator for 4.0.1.5.0 (4 bytes)
|
||||
4.0.1.5.0 private exponent ('d')
|
||||
4.0.1.6 uint32 allocator for 4.0.1.6.0 (4 bytes)
|
||||
4.0.1.6.0 CRT helper value ('q^(-1) % p')
|
||||
4.0.1.6.0 CRT
|
||||
4.0.1.7 uint32 allocator for 4.0.1.7.0 (4 bytes)
|
||||
4.0.1.7.0 prime #1 ('p')
|
||||
4.0.1.8 uint32 allocator for 4.0.1.8.0 (4 bytes)
|
||||
@@ -1289,9 +1289,16 @@ ftSfkGNUzTzPFbF5iEukTvKm42a7F/I/ExMVgpN/eQxJ7+m5TOgja0KC1h5fCN4L
|
||||
<p><strong>Chunk 4.0:</strong> This is technically currently unused; upstream hardcodes to 1 (left zero-padded 0x01).</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p><strong>Chunk 4.0.0.1.0, 4.0.1.4.0:</strong> This is almost always <code>65537</code> for a couple reasons. It’s the <a href="https://en.wikipedia.org/wiki/Fermat_number" target="_blank" rel="noopener">"Fermat Prime"</a> <em>F<sub>4</sub></em>.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p><strong>Chunk 4.0.0.1.0, 4.0.0.2.0, 4.0.1.3.0, 4.0.1.4.0:</strong> Note that the ordering of <code>e</code>/<code>n</code> in <strong>4.0.0</strong> is changed to <code>n</code>/<code>e</code> in <strong>4.0.1</strong>.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p><strong>Chunk 4.0.1.6.0:</strong> The CRT coefficient, or <a href="https://en.wikipedia.org/wiki/Chinese_remainder_theorem" target="_blank" rel="noopener">Chinese Remainder Theorem</a>, is a helper used during decryption and signing. It’s commonly referred to as <code>qnlv</code> or <em>inverse coefficient</em>.
|
||||
The value for this chunk is the result of <code>q^(-1) % p</code>.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p><strong>Chunk 4.0.1.10:</strong> The padding used aligns the private key (<strong>4.0.1.0</strong> to <strong>4.0.1.9.0</strong>) to the cipher blocksize. For plaintext keys, a blocksize of 8 is used.</p>
|
||||
</div>
|
||||
</td>
|
||||
@@ -1301,9 +1308,6 @@ ftSfkGNUzTzPFbF5iEukTvKm42a7F/I/ExMVgpN/eQxJ7+m5TOgja0KC1h5fCN4L
|
||||
</div>
|
||||
<div class="sect5">
|
||||
<h6 id="bkdn_rsa_priv_v1_plain_ex"><a class="link" href="#bkdn_rsa_priv_v1_plain_ex">3.1.2.3.2. Example</a></h6>
|
||||
<div class="paragraph">
|
||||
<p>The following example, being encrypted, is protected with a passphrase. The passphrase used in this example key is <strong><code>test</code></strong>.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="title"><code>id_rsa</code> Format</div>
|
||||
<div class="content">
|
||||
@@ -1368,7 +1372,7 @@ CnIIHn+l1HLBQosH6uXRW2TqHip1CFEv6atlX4ajE0htPMod2OkKzFyfuk1udnUH+6ufOn
|
||||
oAiRAxnBFtR72SSzmUJUO4ig9hJ5UrLY4SkPMCn1Qq6+nAyONs8yloZc1mQ8iSTVZuv0lx
|
||||
gJOZoawJb+Htw7X4cb9e8LTUTg6idiDSBRQuC/z2d7TbAlUyEho/B0WqTQWGMxczJXhVpc
|
||||
7L46xEA9BP8MwMWLfASQS0AhJcK8KmOiDrswnMbz5l2zAaBYuNrOB+cbOPPzWVQz9psZjw
|
||||
cAAAdQU4NHElODRxIAAAAHc3NoLXJzYQAAAgEAt87ARgHOKhLwySTLmjDrmQBmgSyxQ2kZ
|
||||
cAAAdQobGx2KGxsdgAAAAHc3NoLXJzYQAAAgEAt87ARgHOKhLwySTLmjDrmQBmgSyxQ2kZ
|
||||
PzCyuf3Ur8swDJGPKnfWRBDzYXrnyMoxjCV9PE304sQQi7vpOoaJS6FLNXXy9yFQvDgdy/
|
||||
t0LHoZaGb9MYSs6WdhrdoPwpkvbIZtdWmRn8ItnEvw3kBajHbVGaoqUyncaCV3ciml0LdT
|
||||
p4JaiblSdfnAJeIVNDxsiM1mkKIh+K6e9nXuRk3H0RjaQQUH6l1rZIndYK/YpmRkkts+J5
|
||||
@@ -1516,10 +1520,10 @@ hau1VzZBnp8AAAAYVGhpcyBpcyBhIGNvbW1lbnQgc3RyaW5nAQID
|
||||
103
|
||||
104
|
||||
</pre></td><td class="code"><pre>0.0 6f70656e7373682d6b65792d763100 ("openssh-key-v1" + 0x00)
|
||||
1.0 0000000a (10)
|
||||
1.0.0 6165733235362d637472 ("none")
|
||||
2.0 00000006 (6)
|
||||
2.0.0 626372797074 ("none")
|
||||
1.0 00000004 (4)
|
||||
1.0.0 6e6f6e65 ("none")
|
||||
2.0 00000004 (4)
|
||||
2.0.0 6e6f6e65 ("none")
|
||||
3.0 00000000 (0)
|
||||
4.0 00000001 (1)
|
||||
4.0.0 00000217 (535)
|
||||
@@ -1546,8 +1550,8 @@ hau1VzZBnp8AAAAYVGhpcyBpcyBhIGNvbW1lbnQgc3RyaW5nAQID
|
||||
bc2a63a20ebb309cc6f3e65db301a058b8dace07e71b38f3f3595433f69b198f
|
||||
07 (bytes)
|
||||
4.0.1 00000750 (1872)
|
||||
4.0.1.0 53834712 (1401112338)
|
||||
4.0.1.1 53834712 (1401112338)
|
||||
4.0.1.0 a1b1b1d8 (2712777176)
|
||||
4.0.1.1 a1b1b1d8 (2712777176)
|
||||
4.0.1.2 00000007 (7)
|
||||
4.0.1.2.0 7373682d727361 ("ssh-rsa")
|
||||
4.0.1.3 00000201 (513)
|
||||
@@ -1597,7 +1601,7 @@ hau1VzZBnp8AAAAYVGhpcyBpcyBhIGNvbW1lbnQgc3RyaW5nAQID
|
||||
2a52312abee4c6155acfee9384a16348c715346ebe693895fe6d2348d4dedb0a
|
||||
137c487185ff949c209115b9c8a106329991f049e8430c7ba60dd5408d72ac98 (bytes)
|
||||
4.0.1.7 00000101 (257)
|
||||
4.0.1.7.0 00e50b65ba6ae4cb29ae66129c3e41ffeba36cd6ecbaa7045ff90cea71d09bc0
|
||||
00e50b65ba6ae4cb29ae66129c3e41ffeba36cd6ecbaa7045ff90cea71d09bc0
|
||||
56b0b9134dc5754c49da1fe8ab169cd149eedaeccf4913d915f4f241c5fd86c7
|
||||
7511e0c261c344600a84cce78e8cf493e492844cb82c42ab6d1246a53e5cf50a
|
||||
d4759c2a5c09d53b1c5c3b449328eea01434d6e537b3a513928dfaddf0a72728
|
||||
|
||||
@@ -43,7 +43,7 @@ Since plaintext/unencrypted keys do not have a cipher or KDF (as there's no encr
|
||||
4.0.1.5 uint32 allocator for 4.0.1.5.0 (4 bytes)
|
||||
4.0.1.5.0 private exponent ('d')
|
||||
4.0.1.6 uint32 allocator for 4.0.1.6.0 (4 bytes)
|
||||
4.0.1.6.0 CRT helper value ('q^(-1) % p')
|
||||
4.0.1.6.0 CRT
|
||||
4.0.1.7 uint32 allocator for 4.0.1.7.0 (4 bytes)
|
||||
4.0.1.7.0 prime #1 ('p')
|
||||
4.0.1.8 uint32 allocator for 4.0.1.8.0 (4 bytes)
|
||||
@@ -59,16 +59,19 @@ Since plaintext/unencrypted keys do not have a cipher or KDF (as there's no encr
|
||||
|
||||
*Chunk 4.0:* This is technically currently unused; upstream hardcodes to 1 (left zero-padded 0x01).
|
||||
|
||||
*Chunk 4.0.0.1.0, 4.0.1.4.0:* This is almost always `65537` for a couple reasons. It's the https://en.wikipedia.org/wiki/Fermat_number["Fermat Prime"^] __F~4~__.
|
||||
|
||||
*Chunk 4.0.0.1.0, 4.0.0.2.0, 4.0.1.3.0, 4.0.1.4.0:* Note that the ordering of `e`/`n` in *4.0.0* is changed to `n`/`e` in *4.0.1*.
|
||||
|
||||
*Chunk 4.0.1.6.0:* The CRT coefficient, or https://en.wikipedia.org/wiki/Chinese_remainder_theorem[Chinese Remainder Theorem^], is a helper used during decryption and signing. It's commonly referred to as `qnlv` or _inverse coefficient_.
|
||||
The value for this chunk is the result of `q^(-1) % p`.
|
||||
|
||||
*Chunk 4.0.1.10:* The padding used aligns the private key (*4.0.1.0* to *4.0.1.9.0*) to the cipher blocksize. For plaintext keys, a blocksize of 8 is used.
|
||||
====
|
||||
|
||||
[id="bkdn_rsa_priv_v1_plain_ex"]
|
||||
====== Example
|
||||
|
||||
The following example, being encrypted, is protected with a passphrase. The passphrase used in this example key is *`test`*.
|
||||
|
||||
.`id_rsa` Format
|
||||
[source,text,linenums]
|
||||
----
|
||||
@@ -84,7 +87,7 @@ CnIIHn+l1HLBQosH6uXRW2TqHip1CFEv6atlX4ajE0htPMod2OkKzFyfuk1udnUH+6ufOn
|
||||
oAiRAxnBFtR72SSzmUJUO4ig9hJ5UrLY4SkPMCn1Qq6+nAyONs8yloZc1mQ8iSTVZuv0lx
|
||||
gJOZoawJb+Htw7X4cb9e8LTUTg6idiDSBRQuC/z2d7TbAlUyEho/B0WqTQWGMxczJXhVpc
|
||||
7L46xEA9BP8MwMWLfASQS0AhJcK8KmOiDrswnMbz5l2zAaBYuNrOB+cbOPPzWVQz9psZjw
|
||||
cAAAdQU4NHElODRxIAAAAHc3NoLXJzYQAAAgEAt87ARgHOKhLwySTLmjDrmQBmgSyxQ2kZ
|
||||
cAAAdQobGx2KGxsdgAAAAHc3NoLXJzYQAAAgEAt87ARgHOKhLwySTLmjDrmQBmgSyxQ2kZ
|
||||
PzCyuf3Ur8swDJGPKnfWRBDzYXrnyMoxjCV9PE304sQQi7vpOoaJS6FLNXXy9yFQvDgdy/
|
||||
t0LHoZaGb9MYSs6WdhrdoPwpkvbIZtdWmRn8ItnEvw3kBajHbVGaoqUyncaCV3ciml0LdT
|
||||
p4JaiblSdfnAJeIVNDxsiM1mkKIh+K6e9nXuRk3H0RjaQQUH6l1rZIndYK/YpmRkkts+J5
|
||||
@@ -127,10 +130,10 @@ hau1VzZBnp8AAAAYVGhpcyBpcyBhIGNvbW1lbnQgc3RyaW5nAQID
|
||||
[source,text,linenums]
|
||||
----
|
||||
0.0 6f70656e7373682d6b65792d763100 ("openssh-key-v1" + 0x00)
|
||||
1.0 0000000a (10)
|
||||
1.0.0 6165733235362d637472 ("none")
|
||||
2.0 00000006 (6)
|
||||
2.0.0 626372797074 ("none")
|
||||
1.0 00000004 (4)
|
||||
1.0.0 6e6f6e65 ("none")
|
||||
2.0 00000004 (4)
|
||||
2.0.0 6e6f6e65 ("none")
|
||||
3.0 00000000 (0)
|
||||
4.0 00000001 (1)
|
||||
4.0.0 00000217 (535)
|
||||
@@ -157,8 +160,8 @@ hau1VzZBnp8AAAAYVGhpcyBpcyBhIGNvbW1lbnQgc3RyaW5nAQID
|
||||
bc2a63a20ebb309cc6f3e65db301a058b8dace07e71b38f3f3595433f69b198f
|
||||
07 (bytes)
|
||||
4.0.1 00000750 (1872)
|
||||
4.0.1.0 53834712 (1401112338)
|
||||
4.0.1.1 53834712 (1401112338)
|
||||
4.0.1.0 a1b1b1d8 (2712777176)
|
||||
4.0.1.1 a1b1b1d8 (2712777176)
|
||||
4.0.1.2 00000007 (7)
|
||||
4.0.1.2.0 7373682d727361 ("ssh-rsa")
|
||||
4.0.1.3 00000201 (513)
|
||||
@@ -208,7 +211,7 @@ hau1VzZBnp8AAAAYVGhpcyBpcyBhIGNvbW1lbnQgc3RyaW5nAQID
|
||||
2a52312abee4c6155acfee9384a16348c715346ebe693895fe6d2348d4dedb0a
|
||||
137c487185ff949c209115b9c8a106329991f049e8430c7ba60dd5408d72ac98 (bytes)
|
||||
4.0.1.7 00000101 (257)
|
||||
4.0.1.7.0 00e50b65ba6ae4cb29ae66129c3e41ffeba36cd6ecbaa7045ff90cea71d09bc0
|
||||
00e50b65ba6ae4cb29ae66129c3e41ffeba36cd6ecbaa7045ff90cea71d09bc0
|
||||
56b0b9134dc5754c49da1fe8ab169cd149eedaeccf4913d915f4f241c5fd86c7
|
||||
7511e0c261c344600a84cce78e8cf493e492844cb82c42ab6d1246a53e5cf50a
|
||||
d4759c2a5c09d53b1c5c3b449328eea01434d6e537b3a513928dfaddf0a72728
|
||||
|
||||
Reference in New Issue
Block a user