mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-27 08:19:45 +01:00
option to fold dkim signature, which is off by default as recommend for http and sign Authorization header - if given - as required by current iSchedule spec
This commit is contained in:
parent
1d96ed8cf9
commit
5521f110ec
@ -35,7 +35,7 @@ class ischedule_client
|
|||||||
/**
|
/**
|
||||||
* Headers in DKIM signature (DKIM-Signature is always a required header!)
|
* Headers in DKIM signature (DKIM-Signature is always a required header!)
|
||||||
*/
|
*/
|
||||||
const DKIM_HEADERS = 'iSchedule-Version:Content-Type:Originator:Recipient:User-Agent:iSchedule-Message-ID';
|
const DKIM_HEADERS = 'iSchedule-Version:Content-Type:Originator:Recipient:User-Agent:iSchedule-Message-ID:Authorization';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL to use to contact iSchedule receiver
|
* URL to use to contact iSchedule receiver
|
||||||
@ -369,9 +369,10 @@ class ischedule_client
|
|||||||
* @param string $selector='calendar'
|
* @param string $selector='calendar'
|
||||||
* @param string $sign_headers='iSchedule-Version:Content-Type:Originator:Recipient'
|
* @param string $sign_headers='iSchedule-Version:Content-Type:Originator:Recipient'
|
||||||
* @param int $expires seconds the signature is valid, default 300
|
* @param int $expires seconds the signature is valid, default 300
|
||||||
|
* @param boolean $fold=false true: return folded signature, false: return a single line
|
||||||
* @return string DKIM-Signature: ...
|
* @return string DKIM-Signature: ...
|
||||||
*/
|
*/
|
||||||
public function dkim_sign(array $headers, $body, $selector='calendar',$sign_headers=self::DKIM_HEADERS,$expires=300)
|
public function dkim_sign(array $headers, $body, $selector='calendar',$sign_headers=self::DKIM_HEADERS,$expires=300,$fold=false)
|
||||||
{
|
{
|
||||||
$header_values = $header_names = array();
|
$header_values = $header_names = array();
|
||||||
foreach(explode(':', $sign_headers) as $header)
|
foreach(explode(':', $sign_headers) as $header)
|
||||||
@ -402,7 +403,7 @@ class ischedule_client
|
|||||||
"b="); // The signature data (Empty because we will calculate it later));
|
"b="); // The signature data (Empty because we will calculate it later));
|
||||||
|
|
||||||
// as we do http, no need to fold dkim, in fact recommendation is not to
|
// as we do http, no need to fold dkim, in fact recommendation is not to
|
||||||
$dkim = str_replace(array(";\r\n\t", "\r\n\t"), array('; ', ''), $dkim);
|
if (!$fold) $dkim = str_replace(array(";\r\n\t", "\r\n\t"), array('; ', ''), $dkim);
|
||||||
|
|
||||||
return $dkim;
|
return $dkim;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user