我承認我不擅長密鑰驗證。我擁有的是從POP3服務器下載消息的腳本,我試圖驗證PHP中的DKIM簽名。我已經想出了body hash(bh)驗證檢查,但我無法弄清頭標驗證。如何在PHP中驗證DKIM簽名?
http://www.dkim.org/specs/rfc4871-dkimbase.html#rfc.section.6.1.3
下面是我的消息頭的一個例子。我已經能夠使用Mail :: DKIM包來驗證Perl中的簽名,所以我知道這很好。我似乎無法弄清RFC中的說明並將它們轉換爲PHP代碼。
DomainKey-Signature: q=dns; a=rsa-sha1; c=nofws;
s=angrychimp-1.bh; d=angrychimp.net;
h=From:X-Outgoing;
b=RVkenibHQ7GwO5Y3tun2CNn5wSnooBSXPHA1Kmxsw6miJDnVp4XKmA9cUELwftf9
nGiRCd3rLc6eswAcVyNhQ6mRSsF55OkGJgDNHiwte/pP5Z47Lo/fd6m7rfCnYxq3
DKIM-Signature: v=1; a=rsa-sha1; d=angrychimp.net; s=angrychimp-1.bh; c=relaxed/simple;
q=dns/txt; [email protected]; t=1268436255;
h=From:Subject:X-Outgoing:Date;
bh=gqhC2GEWbg1t7T3IfGMUKzt1NCc=;
b=ZmeavryIfp5jNDIwbpifsy1UcavMnMwRL6Fy6axocQFDOBd2KjnjXpCkHxs6yBZn
Wu+UCFeAP+1xwN80JW+4yOdAiK5+6IS8fiVa7TxdkFDKa0AhmJ1DTHXIlPjGE4n5;
To: [email protected]
Message-ID: <EF.CC.24859.F1DCA9B4>
From: DKIM Tester <[email protected]>
Reply-To: [email protected]
Subject: Automated DKIM Testing (angrychimp.net)
X-Outgoing: dhaka
Date: Fri, 12 Mar 2010 15:24:15 -0800
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline
MIME-Version: 1.0
Return-Path: [email protected]
X-OriginalArrivalTime: 12 Mar 2010 23:25:50.0326 (UTC) FILETIME=[5A0ED160:01CAC23B]
我可以提取我的DNS就好了公共密鑰,並且我相信我正確的進行規範化頭,但我就是不能得到簽名驗證。我不認爲我正在準備我的密鑰或正確計算簽名驗證。
這是可能的(我需要梨擴展或什麼?)或手動驗證PHP中的DKIM簽名不可行嗎?
我把標題放入代碼標籤,如果你不喜歡它可以隨意回滾,但我認爲它更容易閱讀。 – 2010-03-24 19:06:12
謝謝。我以爲我已經做到了,但我想我搞砸了。 – angrychimp 2010-03-24 19:09:23
你知道了嗎? – Xeoncross 2012-11-15 17:26:26