|
21 | 21 | unused_qualifications |
22 | 22 | )] |
23 | 23 |
|
| 24 | +//! ## Conventions used in this crate |
| 25 | +//! |
| 26 | +//! This crate uses the following type labels which are described in |
| 27 | +//! [RFC4251 § 5]: |
| 28 | +//! |
| 29 | +//! #### `byte`, `byte[n]`, `byte[]` |
| 30 | +//! |
| 31 | +//! A byte represents an arbitrary 8-bit value (octet). |
| 32 | +//! |
| 33 | +//! Fixed length data is sometimes represented as an array of bytes, written |
| 34 | +//! `byte[n]` where `n` is the number of bytes in the array. |
| 35 | +//! |
| 36 | +//! `byte[]` is a newer convention from OpenSSH for describing arbitrary |
| 37 | +//! length bytestrings (similar to `string`, see below) but identifies data |
| 38 | +//! which is inherently binary in nature, as opposed to text. |
| 39 | +//! |
| 40 | +//! #### `boolean` |
| 41 | +//! |
| 42 | +//! A boolean value is stored as a single byte. |
| 43 | +//! |
| 44 | +//! The value 0 represents FALSE, and the value 1 represents TRUE. All non-zero |
| 45 | +//! values MUST be interpreted as TRUE; however, applications MUST NOT |
| 46 | +//! store values other than 0 and 1. |
| 47 | +//! |
| 48 | +//! #### `uint32` |
| 49 | +//! |
| 50 | +//! Represents a 32-bit unsigned integer. |
| 51 | +//! |
| 52 | +//! Stored as four bytes in the order of decreasing significance (network byte order). |
| 53 | +//! |
| 54 | +//! For example: the value `699921578` (`0x29b7f4aa`) is stored as |
| 55 | +//! `29 b7 f4 aa`. |
| 56 | +//! |
| 57 | +//! #### `uint64` |
| 58 | +//! |
| 59 | +//! Represents a 64-bit unsigned integer. |
| 60 | +//! |
| 61 | +//! Stored as eight bytes in the order of decreasing significance (network byte order). |
| 62 | +//! |
| 63 | +//! #### `string` |
| 64 | +//! |
| 65 | +//! Arbitrary length binary string. |
| 66 | +//! |
| 67 | +//! Strings are allowed to contain arbitrary binary data, including null characters and 8-bit |
| 68 | +//! characters. |
| 69 | +//! |
| 70 | +//! They are stored as a `uint32` containing its length |
| 71 | +//! (number of bytes that follow) and zero (= empty string) or more |
| 72 | +//! bytes that are the value of the string. Terminating null |
| 73 | +//! characters are not used. |
| 74 | +//! |
| 75 | +//! Strings are also used to store text. In that case, US-ASCII is |
| 76 | +//! used for internal names, and ISO-10646 UTF-8 for text that might |
| 77 | +//! be displayed to the user. The terminating null character SHOULD |
| 78 | +//! NOT normally be stored in the string. For example: the US-ASCII |
| 79 | +//! string "testing" is represented as `00 00 00 07 t e s t i n g`. The |
| 80 | +//! UTF-8 mapping does not alter the encoding of US-ASCII characters. |
| 81 | +//! |
| 82 | +//! #### `mpint` |
| 83 | +//! |
| 84 | +//! Represents multiple precision integers in two's complement format, |
| 85 | +//! stored as a string, 8 bits per byte, MSB first. |
| 86 | +//! |
| 87 | +//! Negative numbers have the value 1 as the most significant bit of the first byte of |
| 88 | +//! the data partition. If the most significant bit would be set for |
| 89 | +//! a positive number, the number MUST be preceded by a zero byte. |
| 90 | +//! Unnecessary leading bytes with the value 0 or 255 MUST NOT be |
| 91 | +//! included. The value zero MUST be stored as a string with zero |
| 92 | +//! bytes of data. |
| 93 | +//! |
| 94 | +//! By convention, a number that is used in modular computations in |
| 95 | +//! `Z_n` SHOULD be represented in the range `0 <= x < n`. |
| 96 | +//! |
| 97 | +//! Examples: |
| 98 | +//! |
| 99 | +//! value (hex) | representation (hex) |
| 100 | +//! -------------------|--------------------- |
| 101 | +//! `0` | `00 00 00 00` |
| 102 | +//! `9a378f9b2e332a7` | `00 00 00 08 09 a3 78 f9 b2 e3 32 a7` |
| 103 | +//! `80` | `00 00 00 02 00 80` |
| 104 | +//! `-1234` | `00 00 00 02 ed cc` |
| 105 | +//! `-deadbeef` | `00 00 00 05 ff 21 52 41 11` |
| 106 | +//! |
| 107 | +//! #### `name-list` |
| 108 | +//! |
| 109 | +//! A string containing a comma-separated list of names. |
| 110 | +//! |
| 111 | +//! A `name-list` is represented as a `uint32` containing its length |
| 112 | +//! (number of bytes that follow) followed by a comma-separated list of zero or more |
| 113 | +//! names. A name MUST have a non-zero length, and it MUST NOT |
| 114 | +//! contain a comma (","). |
| 115 | +//! |
| 116 | +//! As this is a list of names, all the elements contained are names and MUST be in US-ASCII. |
| 117 | +//! |
| 118 | +//! Context may impose additional restrictions on the names. For example, |
| 119 | +//! the names in a name-list may have to be a list of valid algorithm |
| 120 | +//! identifiers (see Section 6 below), or a list of [RFC3066] language |
| 121 | +//! tags. The order of the names in a name-list may or may not be |
| 122 | +//! significant. Again, this depends on the context in which the list |
| 123 | +//! is used. |
| 124 | +//! |
| 125 | +//! Terminating null characters MUST NOT be used, neither |
| 126 | +//! for the individual names, nor for the list as a whole. |
| 127 | +//! |
| 128 | +//! Examples: |
| 129 | +//! |
| 130 | +//! value | representation (hex) |
| 131 | +//! ---------------------------|--------------------- |
| 132 | +//! `()`, the empty name-list | `00 00 00 00` |
| 133 | +//! `("zlib")` | `00 00 00 04 7a 6c 69 62` |
| 134 | +//! `("zlib,none")` | `00 00 00 09 7a 6c 69 62 2c 6e 6f 6e 65` |
| 135 | +//! |
| 136 | +//! [RFC3066]: https://datatracker.ietf.org/doc/html/rfc3066 |
| 137 | +//! [RFC4251 § 5]: https://datatracker.ietf.org/doc/html/rfc4251#section-5 |
| 138 | +
|
24 | 139 | #[cfg(feature = "alloc")] |
25 | 140 | #[macro_use] |
26 | 141 | extern crate alloc; |
|
0 commit comments