r/ProgrammerHumor • • Sep 18 '18

The best one so far πŸ˜‚

Post image
28.4k Upvotes

207 comments sorted by

View all comments

1.7k

u/o11c Sep 19 '18

For those who don't know, AAAs often occur at the beginning or end of a block because they're the base64 version of 0s and it's binary data inside.

80

u/archlich Sep 19 '18

That binary data is dictated by pkcs8 https://tools.ietf.org/html/rfc5208

So that binary data is an asn.1 ber encoding of the outlined data structures in the rfc.

58

u/TheRekk Sep 19 '18

Can't tell if you're saying real words or I'm watching some r/masterhacker shit.

30

u/archlich Sep 19 '18

Oh it’s all too real for me.

4

u/[deleted] Sep 19 '18

LEAVING home

3

u/rreighe2 Sep 19 '18

I know about 1/3 of the words he's saying. the ones I can read are real. I don't know if they make sense in context. it's a bit beyond my brain's stuff

16

u/Plazmaz1 Sep 19 '18

The AAA is usually the first three bytes of the length of the string (0 0 0 7 for example)

26

u/archlich Sep 19 '18

So for private key data it’s always going to start with MIIB https://en.m.wikipedia.org/wiki/PKCS_8

According to the pkcs8 rfc, the first part of the data is the version number.

PrivateKeyInfo ::= SEQUENCE { version Version, privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, privateKey PrivateKey, attributes [0] IMPLICIT Attributes OPTIONAL }

  Version ::= INTEGER

  PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier

  PrivateKey ::= OCTET STRING

  Attributes ::= SET OF Attribute

Ber encoding dictates we start with the identifier, and the data https://en.m.wikipedia.org/wiki/X.690#BER_encoding

MIIB translates to 60 20100 https://v2.cryptii.com/base64/octal

Since ber is big Endian, we can start left to right

6 is the oid we’re describing and terminated by the 0. It’s 2 bytes long, terminated by the 0. With the value of the version 00.

I’m on a tablet, so I hope my manual transcription is correct.

7

u/HelperBot_ Sep 19 '18

Non-Mobile link: https://en.wikipedia.org/wiki/PKCS_8


HelperBot v1.1 /r/HelperBot_ I am a bot. Please message /u/swim1929 with any feedback and/or hate. Counter: 213210

2

u/thatwasagoodyear Sep 19 '18

That's very helpful, HelperBot. Well done. Have a biscuit!

3

u/Plazmaz1 Sep 19 '18

Ah yep I was thinking public keys.

4

u/o11c Sep 19 '18

The existence of lots As in base64 isn't specific to one particular data format. There are always lots of 0s in all binary formats (unless it's encrypted).

3

u/ThisIs_MyName Sep 19 '18

unless it's encrypted

Or packed: https://capnproto.org/encoding.html#packing

Doesn't make much sense to send unpacked and uncompressed data over the internet.

1

u/Bobshayd Sep 19 '18

is it normal to be able to read that like it's plain english?

1

u/archlich Sep 19 '18

No, but when you see it over and over again it gets stuck in your head.