Using this code to retrieve the public key bytes...
var pubKey =
AppDomain.CurrentDomain.DomainManager.EntryAssembly
.GetName().GetPublicKey();
What is this common structure at the start (first 32 bytes) of the key? It's not ASN.1 and it might not be variable. I can google it and get repeats.
// 00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31
Is it all reversed or just part of it (e.g. the modulus at the end)? 52 53 41 31
is a string of RSA1
.
My key's modulus is 1024 bit, so I was looking for something that described the length.
0x0400
(00 04
B.E.) would be 1024 (bits), 0x80
would be 128 (bytes, 1024/8).
// 00 04 00 00 01 00 01 00
Are these last 4 to 6 the public exponent? Big or little endian? Is the last null a terminator or spacer?
Investigations into implementations (.NET and Mono) of RSAPKCS1SignatureFormatter
and RSAPKCS1SignatureDeformatter
are not easy going.
Removed edits, answering own question... unless someone comes up with a better answer or adds detail including the whys.