@@ -130,6 +130,18 @@ class eppConnection {
130
130
*/
131
131
protected $ allow_self_signed = null ;
132
132
133
+ /**
134
+ * Require verification of SSL certificate used
135
+ * @var boolean
136
+ */
137
+ protected $ verify_peer = true ;
138
+
139
+ /**
140
+ * Require verification of peer name
141
+ * @var boolean
142
+ */
143
+ protected $ verify_peer_name = true ;
144
+
133
145
protected $ logentries = array ();
134
146
135
147
protected $ checktransactionids = true ;
@@ -375,7 +387,11 @@ public function connect($hostname = null, $port = null) {
375
387
}
376
388
if (isset ($ this ->allow_self_signed )) {
377
389
stream_context_set_option ($ context , 'ssl ' , 'allow_self_signed ' , $ this ->allow_self_signed );
390
+ stream_context_set_option ($ context , 'ssl ' , 'verify_peer ' , false );
391
+ } else {
392
+ stream_context_set_option ($ context , 'ssl ' , 'verify_peer ' , $ this ->verify_peer );
378
393
}
394
+ stream_context_set_option ($ context , 'ssl ' , 'verify_peer_name ' , $ this ->verify_peer_name );
379
395
if ($ this ->connection = stream_socket_client ($ target , $ errno , $ errstr , $ this ->timeout , STREAM_CLIENT_CONNECT , $ context )) {
380
396
$ this ->writeLog ("Connection made " ,"CONNECT " );
381
397
$ this ->connected = true ;
@@ -888,6 +904,14 @@ public function setPort($port) {
888
904
$ this ->port = $ port ;
889
905
}
890
906
907
+ public function setVerifyPeer ($ verify_peer ) {
908
+ $ this ->verify_peer = $ verify_peer ;
909
+ }
910
+
911
+ public function setVerifyPeerName ($ verify_peer_name ) {
912
+ $ this ->verify_peer_name = $ verify_peer_name ;
913
+ }
914
+
891
915
public function getRetry ()
892
916
{
893
917
return $ this ->retry ;
0 commit comments