News for hackers. Stuff that matters.
Re:We Cracked a 512-Bit DKIM Key for Less Than $8 in the Cloud by andix on Wednesday January 08, 2025 @11:26AM (#42635807)
Any tips on how to easily fetch the key length of DKIM-Keys from DNS? Just by looking at the DNS entries I can't easily determine the key length ;)
Re:We Cracked a 512-Bit DKIM Key for Less Than $8 in the Cloud by deathanatos on Wednesday January 08, 2025 @11:46AM (#42636004)
Fetch the TXT record; you should see something like,

  k=rsa; … p=<a bunch of base64 data>
The base64 data is an RSA public key. You can print in textual form with something like,

  your-clipboard-paste-command | base64 -d | openssl rsa -pubin -noout -inform der -text
The first line of output will be something like,

  Public-Key: (2048 bit)
Which is the key length.

If you fetch with `dig`, note that sometimes dig will do this:

  example.com. 1800 IN TXT "k=rsa; t=s; p=blahblahblahblah" "blahblahblah"
I.e., it breaks it up with a `" "`; remove those, that's not part of the data. I.e., concat the strings dig returns, then parse out the p=, then base64 decode, then openssl.

(You can also do that the article does, but without Python, which is jam that base64 between some PEM header guards like the article does, and then feed it to openssl. Same command, but you don't need the -inform der b/c the "in[put] form[at]" is now pem, which is the default.)

Re:We Cracked a 512-Bit DKIM Key for Less Than $8 in the Cloud by awulf on Wednesday January 08, 2025 @11:41AM (#42635944)
An easy way is to check the length of the p= value in the DKIM record. If it's around 216 characters, it's likely a 1024-bit key. A 2048-bit key usually has about 388 characters.
Re:We Cracked a 512-Bit DKIM Key for Less Than $8 in the Cloud by zorgmonkey on Wednesday January 08, 2025 @01:12PM (#42636836)
If you're going to do this you should also check for k=rsa since other key types will be different lengths. But I'd really recommend something like in the other comment where you base64 decode and parse it with something like openssl.