Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Protected Member Functions
Zend_Mail_Protocol_Smtp_Auth_Crammd5 Class Reference
Inheritance diagram for Zend_Mail_Protocol_Smtp_Auth_Crammd5:
Zend_Mail_Protocol_Smtp Zend_Mail_Protocol_Abstract

Public Member Functions

 __construct ($host='127.0.0.1', $port=null, $config=null)
 
 auth ()
 
- Public Member Functions inherited from Zend_Mail_Protocol_Smtp
 __construct ($host='127.0.0.1', $port=null, array $config=array())
 
 connect ()
 
 helo ($host='127.0.0.1')
 
 mail ($from)
 
 rcpt ($to)
 
 data ($data)
 
 rset ()
 
 noop ()
 
 vrfy ($user)
 
 quit ()
 
 auth ()
 
 disconnect ()
 
- Public Member Functions inherited from Zend_Mail_Protocol_Abstract
 __construct ($host='127.0.0.1', $port=null)
 
 __destruct ()
 
 setMaximumLog ($maximumLog)
 
 getMaximumLog ()
 
 connect ()
 
 getRequest ()
 
 getResponse ()
 
 getLog ()
 
 resetLog ()
 

Protected Member Functions

 _hmacMd5 ($key, $data, $block=64)
 
- Protected Member Functions inherited from Zend_Mail_Protocol_Smtp
 _ehlo ($host)
 
 _startSession ()
 
 _stopSession ()
 
- Protected Member Functions inherited from Zend_Mail_Protocol_Abstract
 _addLog ($value)
 
 _connect ($remote)
 
 _disconnect ()
 
 _send ($request)
 
 _receive ($timeout=null)
 
 _expect ($code, $timeout=null)
 
 _setStreamTimeout ($timeout)
 

Additional Inherited Members

- Data Fields inherited from Zend_Mail_Protocol_Abstract
const EOL = "\r\n"
 
const TIMEOUT_CONNECTION = 30
 
- Protected Attributes inherited from Zend_Mail_Protocol_Smtp
 $_transport = 'tcp'
 
 $_secure
 
 $_sess = false
 
 $_helo = false
 
 $_auth = false
 
 $_mail = false
 
 $_rcpt = false
 
 $_data = null
 
- Protected Attributes inherited from Zend_Mail_Protocol_Abstract
 $_maximumLog = 64
 
 $_host
 
 $_port
 
 $_validHost
 
 $_socket
 
 $_request
 
 $_response
 
 $_template = '%d%s'
 

Detailed Description

Definition at line 39 of file Crammd5.php.

Constructor & Destructor Documentation

◆ __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$configAuth-specific parameters
Returns
void

Definition at line 49 of file Crammd5.php.

50  {
51  if (is_array($config)) {
52  if (isset($config['username'])) {
53  $this->_username = $config['username'];
54  }
55  if (isset($config['password'])) {
56  $this->_password = $config['password'];
57  }
58  }
59 
60  parent::__construct($host, $port, $config);
61  }
$config
Definition: fraud_order.php:17

Member Function Documentation

◆ _hmacMd5()

_hmacMd5 (   $key,
  $data,
  $block = 64 
)
protected

Prepare CRAM-MD5 response to server's ticket

Parameters
string$keyChallenge key (usually password)
string$dataChallenge data
string$blockLength of blocks
Returns
string

Definition at line 92 of file Crammd5.php.

93  {
94  if (strlen($key) > 64) {
95  $key = pack('H32', md5($key));
96  } elseif (strlen($key) < 64) {
97  $key = str_pad($key, $block, "\0");
98  }
99 
100  $k_ipad = substr($key, 0, 64) ^ str_repeat(chr(0x36), 64);
101  $k_opad = substr($key, 0, 64) ^ str_repeat(chr(0x5C), 64);
102 
103  $inner = pack('H32', md5($k_ipad . $data));
104  $digest = md5($k_opad . $inner);
105 
106  return $digest;
107  }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$block
Definition: block.php:8

◆ auth()

auth ( )
Todo:
Perform CRAM-MD5 authentication with supplied credentials
Returns
void

Definition at line 69 of file Crammd5.php.

70  {
71  // Ensure AUTH has not already been initiated.
72  parent::auth();
73 
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));
79  $this->_expect(235);
80  $this->_auth = true;
81  }
_expect($code, $timeout=null)
Definition: Abstract.php:402
_hmacMd5($key, $data, $block=64)
Definition: Crammd5.php:92

The documentation for this class was generated from the following file: