DKIM Private and Public Key Generation

Every time this page loads, a new DKIM key will be created and deleted.

Key size 1024

Save your private key in a file:

Public key must be placed in the DNS Server: IN  TXT "v=DKIM1 t=s p=" 

If you use Amavis on your server, you can generate DKIM signatures and verify it.

First you have to add in amavisd.conf the following line:

 $enable_dkim_signing = 1; # loads DKIM signing code

After adding the line you can generate a DKIM signature in 4 steps:

  1. Generate The private key:
    amavisd-new genrsa private.pem
  2. Add te following line in amavisd.conf to load the private keys:
    dkim_key('', 'default', '/path/to/private.pem', h=>'sha256');
  3. Print the public key by typing the following command in your shell:
    amavisd-new showkeys

    The last command would print a similar line to the Public key above. You have to add it to your domain profile on your DNS server.

  4. Test the Key: (type in shell)
    amavisd-new testkeys

    If the test passed, the result would be:

    TESTING#1 => pass