为什么 DKIM public 密钥总是以 'IDAQAB' 结尾?

Why do DKIM public keys always end with 'IDAQAB'?

我注意到生成的所有 DKIM public 密钥总是以字符串 'IDAQAB' 结尾。 任何原因或是否存在 DKIM public 密钥不会始终以相同字符串结尾的情况?

DKIM public 密钥以指数的二进制 DER format and shared as Base64 in the DNS. RSA public keys consist of a modulus and an exponent. The exponent is typically 65537, which is 01 00 01 in hexadecimal. DER prefixes this value with 02 for the integer type and 03 for the length 编码,以字节为单位。 02 03 01 00 01 的 Base64 编码是 IDAQAB(在右边的偏移处)。

在每个 RSA public 密钥唯一的模数之前,有嵌套的长度前缀和对象标识符。对于相同长度的 RSA 密钥,此信息是相同的,这就是为什么您会发现许多 DKIM public 密钥也共享相同的前缀,例如 MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA.