private static function addSSLValidator(Message $msg, $context) : void
    {
        $options = stream_context_get_options($context);
        if (!isset($options['ssl']['peer_certificate'])) {
            return;
        }

        $container = ContainerSingleton::getInstance();
        $key = openssl_pkey_get_public($options['ssl']['peer_certificate']);
        if ($key === false) {
            $container->getLogger()->warning('Unable to get public key from peer certificate.');

            return;
        }

        $keyInfo = openssl_pkey_get_details($key);
        if ($keyInfo === false) {
            $container->getLogger()->warning('Unable to get key details from public key.');

            return;
        }

        if (!isset($keyInfo['key'])) {
            $container->getLogger()->warning('Missing key in public key details.');

            return;
        }

        $msg->addValidator([SOAPClient::class, 'validateSSL'], $keyInfo['key']);
    }
private static function addSSLValidator(Message $msg, $context) : void
    {
        $options = stream_context_get_options($context);
        if (!isset($options['ssl']['peer_certificate'])) {
            return;
        }

        $container = ContainerSingleton::getInstance();
        $key = openssl_pkey_get_public($options['ssl']['peer_certificate']);
        if ($key === false) {
            $container->getLogger()->warning('Unable to get public key from peer certificate.');

            return;
        }

        $keyInfo = openssl_pkey_get_details($key);
        if ($keyInfo === false) {
            $container->getLogger()->warning('Unable to get key details from public key.');

            return;
        }

        if (!isset($keyInfo['key'])) {
            $container->getLogger()->warning('Missing key in public key details.');

            return;
        }

        $msg->addValidator([SOAPClient::class, 'validateSSL'], $keyInfo['key']);
    }
private static function addSSLValidator ( Message $ msg , $ context ) : void { $ options = stream_context_get_options ( $ context ) ; if ( ! isset ( $ options [ 'ssl' ] [ 'peer_certificate' ] ) ) { return ; } $ container = ContainerSingleton :: getInstance ( ) ; $ key = openssl_pkey_get_public ( $ options [ 'ssl' ] [ 'peer_certificate' ] ) ; if ( $ key === false ) { $ container -> getLogger ( ) -> warning ( 'Unable to get public key from peer certificate.' ) ; return ; } $ keyInfo = openssl_pkey_get_details ( $ key ) ; if ( $ keyInfo === false ) { $ container -> getLogger ( ) -> warning ( 'Unable to get key details from public key.' ) ; return ; } if ( ! isset ( $ keyInfo [ 'key' ] ) ) { $ container -> getLogger ( ) -> warning ( 'Missing key in public key details.' ) ; return ; } $ msg -> addValidator ( [ SOAPClient :: class , 'validateSSL' ] , $ keyInfo [ 'key' ] ) ; }
Add a signature validator based on a SSL context.

@param \SAML2\Message $msg The message we should add a validator to.
@param resource $context The stream context.
@return void
Add a signature validator based on a SSL context .