Setting up DKIM Keys for CPanel Server in DNSMadeEasy

I am in the middle of a server migration and am working on DKIM keys for the domains on the affected server. I ran into an issue where the DKIM key data I was getting from CPanel wasn’t working when trying to use it in a txt field DNS record on DNSMadeEasy. I contacted their tech support and figured I’d post the solution here since I couldn’t find it elsewhere and since their documentation on the matter is so sparse.

The key info I was getting from DNSMadeEasy was:

"v=DKIM1; k=rsa; p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7jLS6S0MF4kJFyJOyE4Tm/Dv583oUGkUjbBa9CXWLrP4IYoamSrTqBiOQuXsbKw0yCObgDrJ844hH+yIFlTkw0FlKx/B706fEGPr7DL8L6mdicqZX1fbVqLs7GsX9OE0FOm1rUsr/eHQPug4F2JQ5yNDtjK0Jt07pYEpf6wWxY0HMNtq4oKwU3MBwgfsVx9Xs" xdDYMvs0vtVR2WQD1LAxgL20hWOPtZZ6QwhZhBFpHOuiN4WACSnGDtZhHE6Mxwy642eImQtsFjnJrIe1t0HT/dP2r5B7ptkk8ZgLbH8eiI2VY7GIV7g58sJTL86xvkYLrMXcWjow2L2Ho+MKivmawIDAQAB\;

Upon trying to put this into a txt field entry on DNSMadeEasy I would receive the following error:

Value contains mismatched quotes. All beginning quotes must have a corresponding terminating quote.

After fiddling with the quotes to make sure there were matched pairs, I would get this error:

Contiguous strings may not be longer than 255 characters

I contacted support and they informed me that by the standard, txt fields can’t have continuous strings longer than 255 characters, but can contain multiple strings. By the DKIM standard, any strings found are concatenated before being interpreted.

I broke the string up with double quotes into lengths of less than 255 in a text editor and made sure there were good matching pairs. I also removed the slash and semicolon at the end, as those don’t appear to have been necessary or helpful.

In the end I wound up with a txt record called default._domainkey.[domain] containing:

"v=DKIM1; k=rsa;""p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7jLS6S0MF4kJFyJOyE4Tm/Dv583oUGkUjbBa9CXWLrP4IYoamSrTqBiOQuXsbKw0yCObgDrJ844hH+yIFlTkw0FlKx/B706fEGPr7DL8L6mdicqZX1fbVqLs7GsX9OE0FOm1rUsr/eHQPug4""F2JQ5yNDtjK0Jt07pYEpf6wWxY0HMNtq4oKwU3MBwgfsVx9XsxdDYMvs0vtVR2WQD1LAxgL20hWOPtZZ6QwhZhBFpHOuiN4WACSnGDtZhHE6Mxwy642eImQtsFjnJrIe1t0HT/dP2r5B7ptkk8ZgLbH8eiI2VY7GIV7g58sJTL86xvkYLrMXcWjow2L2Ho+MKivmawIDAQAB"

It appears to work.

Leave a Reply