Note that there are some explanatory texts on larger screens.

plurals
  1. POLook for a step by step Domain-Key Signature creation guide for PHP
    primarykey
    data
    text
    <p>So, I've lost some sleep, I've scoured the net and I've found libraries, explanations, etc., but I have not found a step by step guide to create a Domain-Key Signature to be added to an email header to sign my authenticated email sent from a PHP program. Actually, I have found some instructions but it always seems that a step is missing!</p> <p>Reading Jeff Atwood's <a href="http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html" rel="nofollow">"So You'd Like to Send Some Email (Through Code)"</a> helped me out a great deal, and actually informed me about all of these signing methods. Thus far I have:</p> <ul> <li><p>Created a public/private key pair using openVPN and the following openssl commands</p> <ol> <li><p><code>openssl genrsa -out rsa.private 1024 -</code></p></li> <li><p><code>openssl rsa -in rsa.private -out rsa.public -pubout -outform PEM</code></p></li> </ol></li> <li><p>Had the necessary TXT DNS records added (global policy and the public base64 key) </p></li> <li>Added (what seem to be) the necessary parameters in the email header</li> </ul> <p>However, using Port25's Authentication Report returns:</p> <pre> DomainKeys check details: ---------------------------------------------------------- Result: fail (bad signature) ID(s) verified: header.From=truth@truthuniversal.com DNS record(s): truthuniversal._domainkey.truthuniversal.com. 86400 IN TXT "k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDdxr0auyWOszMhdPW0LR3/Duf3t6XcvlwTpYuoS1lzCuT35voqcEhctCh2dTzq2RAXOrinbG8HuTg/IBde3GWaRwBMSQRJ/ZwiNZHomMfqnZEhC9MT+J9OAEbm5TdwZ0HcIOKGBGi0fZvhYs5kw34mk0cwO7AacgSInDf+QjOE+QIDAQAB" </pre> <p>You can see the TXT Record there, which utilizes the key. </p> <p>Here's my public key produced with the openssl command -- file rsa.public:</p> <pre> -----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDdxr0auyWOszMhdPW0LR3/Duf3 t6XcvlwTpYuoS1lzCuT35voqcEhctCh2dTzq2RAXOrinbG8HuTg/IBde3GWaRwBM SQRJ/ZwiNZHomMfqnZEhC9MT+J9OAEbm5TdwZ0HcIOKGBGi0fZvhYs5kw34mk0cw O7AacgSInDf+QjOE+QIDAQAB -----END PUBLIC KEY----- </pre> <p>In PHP, I'm constructing the header this way:</p> <pre><code> $pkey="MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDdxr0auyWOszMhdPW0LR3/Duf3t6XcvlwTpYuoS1lzCuT35voqcEhctCh2dTzq2RAXOrinbG8HuTg/IBde3GWaRwBMSQRJ/ZwiNZHomMfqnZEhC9MT+J9OAEbm5TdwZ0HcIOKGBGi0fZvhYs5kw34mk0cwO7AacgSInDf+QjOE+QIDAQAB"; $dkeysig = "DomainKey-Signature: a=rsa-sha1; s=truthuniversal;d=truthuniversal.com;c=simple;q=dns;b=$pkey;" $newLine = "\r\n"; //Construct Headers $headers = "MIME-Version: 1.0" . $newLine; $headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine; $headers .= "$dkeysig" . $newLine; </code></pre> <p>When I check the header of the received message it looks this way:</p> <blockquote> <p>DomainKey-Signature: a=rsa-sha1; s=truthuniversal;d=truthuniversal.com;c=simple;q=dns;b=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDdxr0auyWOszMhdPW0LR3/Duf3t6XcvlwTpYuoS1lzCuT35voqcEhctCh2dTzq2RAXOrinbG8HuTg/IBde3GWaRwBMSQRJ/ZwiNZHomMfqnZEhC9MT+J9OAEbm5TdwZ0HcIOKGBGi0fZvhYs5kw34mk0cwO7AacgSInDf+QjOE+QIDAQAB;</p> </blockquote> <p>What am I missing?</p> <p>Is there another step?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload