Definition at line 39 of file Crammd5.php.
◆ __construct()
__construct |
( |
|
$host = '127.0.0.1' , |
|
|
|
$port = null , |
|
|
|
$config = null |
|
) |
| |
Constructor.
- Parameters
-
string | $host | (Default: 127.0.0.1) |
int | $port | (Default: null) |
array | $config | Auth-specific parameters |
- Returns
- void
Definition at line 49 of file Crammd5.php.
52 if (isset(
$config[
'username'])) {
53 $this->_username =
$config[
'username'];
55 if (isset(
$config[
'password'])) {
56 $this->_password =
$config[
'password'];
60 parent::__construct($host, $port,
$config);
◆ _hmacMd5()
_hmacMd5 |
( |
|
$key, |
|
|
|
$data, |
|
|
|
$block = 64 |
|
) |
| |
|
protected |
Prepare CRAM-MD5 response to server's ticket
- Parameters
-
string | $key | Challenge key (usually password) |
string | $data | Challenge data |
string | $block | Length of blocks |
- Returns
- string
Definition at line 92 of file Crammd5.php.
94 if (strlen($key) > 64) {
95 $key = pack(
'H32', md5($key));
96 }
elseif (strlen($key) < 64) {
97 $key = str_pad($key,
$block,
"\0");
100 $k_ipad = substr($key, 0, 64) ^ str_repeat(chr(0x36), 64);
101 $k_opad = substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64);
103 $inner = pack(
'H32', md5($k_ipad .
$data));
104 $digest = md5($k_opad . $inner);
elseif(isset( $params[ 'redirect_parent']))
◆ auth()
- Todo:
- Perform CRAM-MD5 authentication with supplied credentials
- Returns
- void
Definition at line 69 of file Crammd5.php.
74 $this->
_send(
'AUTH CRAM-MD5');
75 $challenge = $this->
_expect(334);
76 $challenge = base64_decode($challenge);
77 $digest = $this->
_hmacMd5($this->_password, $challenge);
78 $this->
_send(base64_encode($this->_username .
' ' . $digest));
_expect($code, $timeout=null)
_hmacMd5($key, $data, $block=64)
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/Mail/Protocol/Smtp/Auth/Crammd5.php