Skip to content

Commit 3bae11c

Browse files
committed
fix: off-by-one
1 parent 8995171 commit 3bae11c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/blog/what-does-my-rsa-public-key-actually-mean.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ f0 10 75 73 65 72 40 65 78 61 6d 70 6c 65 2e 63 |[email protected]|
102102
6f 6d f1 0b 6d 79 5f 75 73 65 72 6e 61 6d 65 |om..my_username|
103103
```
104104

105-
The idea is that the first byte (or bytes, depending on the format) represent a **tag**. In the basic example above, the byte `f0` means email, and the byte `f1` means username. The next byte(s) indicates the **length** of the information. So, `f0 10` means that we're expecting a 16 byte long email next. So, we read the next 16 bytes `75 73 65 72 40 65 78 61 6d 70 6c 65 2e 63 6f 6d` and that should be an email **value**. If we decode those bytes as ASCII, what do we get? `[email protected]`. _Voilà!_ Now rinse and repeat for the next bytes: a `f1` username… that is `0b 10` bytes long… `6d 79 5f 75 73 65 72 6e 61 6d 65`—`my_username`!
105+
The idea is that the first byte (or bytes, depending on the format) represent a **tag**. In the basic example above, the byte `f0` means email, and the byte `f1` means username. The next byte(s) indicates the **length** of the information. So, `f0 10` means that we're expecting a 16 byte-long email next. So, we read the next 16 bytes `75 73 65 72 40 65 78 61 6d 70 6c 65 2e 63 6f 6d` and that should be an email **value**. If we decode those bytes as ASCII, what do we get? `[email protected]`. _Voilà!_ Now rinse and repeat for the next bytes: a `f1` username… that is `0b` 11 bytes long… `6d 79 5f 75 73 65 72 6e 61 6d 65`—`my_username`!
106106

107107
ASN.1 (Abstract Syntax Notation One) is a notation for describing data structures. It can represent integers, strings, sequences, booleans, etc. [There are lots of different ASN.1 encoding rules](https://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One#Encodings), but we're interested in the ones for binary, specifically, the [Distinguished Encoding Rules (DER)](https://docs.microsoft.com/en-us/windows/win32/seccertenroll/about-der-encoding-of-asn-1-types).
108108

0 commit comments

Comments
 (0)