当前位置: 首页>>代码示例>>PHP>>正文


PHP ws_get_key_from_file函数代码示例

本文整理汇总了PHP中ws_get_key_from_file函数的典型用法代码示例。如果您正苦于以下问题:PHP ws_get_key_from_file函数的具体用法?PHP ws_get_key_from_file怎么用?PHP ws_get_key_from_file使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ws_get_key_from_file函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_ws_token

 /**
  * Devuelve un objeto WSF con la configuracion de certificados ssl existente o null
  * @param string $proyecto
  * @param string $servicio
  * @throws toba_error
  * @return WSSecurityToken
  */
 static function get_ws_token($proyecto, $servicio)
 {
     $security_token = null;
     self::get_modelo_proyecto($proyecto);
     $ini_conf = toba_modelo_servicio_web::get_ini_cliente(self::$modelo_proyecto, $servicio);
     $directorio = toba_instancia::instancia()->get_path_instalacion_proyecto($proyecto) . "/servicios_cli/{$servicio}";
     //Directorio perteneciente al servicio
     //Busco los datos para los certificados en el archivo perteneciente al servicio
     if (!is_null($ini_conf) && $ini_conf->existe_entrada('certificado')) {
         chdir($directorio);
         $config = $ini_conf->get_datos_entrada('certificado');
         //Cargo las claves y armo el objeto WSF
         if (!file_exists($config['clave_cliente'])) {
             throw new toba_error("El archivo " . $config['clave_cliente'] . " no existe");
         }
         $clave_cliente = ws_get_key_from_file($config['clave_cliente']);
         if (!file_exists($config['cert_cliente'])) {
             throw new toba_error("El archivo " . $config['cert_cliente'] . " no existe");
         }
         $cert_cliente = ws_get_cert_from_file($config['cert_cliente']);
         if (!file_exists($config['cert_servidor'])) {
             throw new toba_error("El archivo " . $config['cert_servidor'] . " no existe");
         }
         $cert_server = ws_get_cert_from_file($config['cert_servidor']);
         $security_token = new WSSecurityToken(array("privateKey" => $clave_cliente, "receiverCertificate" => $cert_server, "certificate" => $cert_cliente));
     }
     return $security_token;
 }
开发者ID:emma5021,项目名称:toba,代码行数:35,代码来源:toba_servicio_web_cliente_soap.php

示例2: evt__form__enviar

    /**
     * Seguridad programada completamente
     */
    function evt__form__enviar($datos)
    {
        $carpeta = dirname(__FILE__);
        //--1- Arma el mensaje	(incluyendo los headers)
        $this->s__echo = $datos;
        $clave = xml_encode($datos['clave']);
        $valor = xml_encode($datos['valor']);
        $payload = <<<XML
<ns1:test xmlns:ns1="http://siu.edu.ar/toba_referencia/serv_pruebas">
\t<texto>{$clave} {$valor}</texto>
</ns1:test>
XML;
        $mensaje = new toba_servicio_web_mensaje($payload);
        //--2- Arma el servicio indicando certificado del server y clave privada del cliente
        $cert_server = ws_get_cert_from_file($carpeta . '/servidor.crt');
        $clave_privada = ws_get_key_from_file($carpeta . "/cliente.pkey");
        $cert_cliente = ws_get_cert_from_file($carpeta . "/cliente.crt");
        $seguridad = array("sign" => true, "encrypt" => true, "algorithmSuite" => "Basic256Rsa15", "securityTokenReference" => "IssuerSerial");
        $policy = new WSPolicy(array("security" => $seguridad));
        $security_token = new WSSecurityToken(array("privateKey" => $clave_privada, "receiverCertificate" => $cert_server, "certificate" => $cert_cliente));
        $opciones = array('to' => 'http://localhost/' . toba_recurso::url_proyecto() . '/servicios.php/serv_seguro_codigo', 'action' => 'http://siu.edu.ar/toba_referencia/serv_pruebas/test', 'policy' => $policy, 'securityToken' => $security_token);
        $servicio = toba::servicio_web('cli_seguro', $opciones);
        //-- 3 - Muestra la respuesta
        $respuesta = $servicio->request($mensaje);
        toba::notificacion()->info($respuesta->get_payload());
    }
开发者ID:emma5021,项目名称:toba,代码行数:29,代码来源:ci_cliente.php

示例3: requestBags

function requestBags()
{
    /* Generate a random number for the purchase order*/
    $randNum = rand() % 99;
    /* Requested date is two weeks from today*/
    $reqDate = mktime(0, 0, 0, date("m"), date("d") + 14, date("Y"));
    $reqDateStr = date("Y/m/d", $reqDate);
    /* The payload string*/
    $requestPayloadString = <<<XML
          <po:Order xmlns:po="http://www.back_packers.com/ws/purchaseorder">
             <po:OrderId>po-{$randNum}</po:OrderId>
             <po:ReqDate>{$reqDateStr}</po:ReqDate>
             <po:Design>
                <po:FileName>design.jpg</po:FileName>
                <po:Image><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:myid1"></xop:Include></po:Image>
             </po:Design>
          </po:Order>
XML;
    try {
        global $request_str;
        global $response_str;
        /* Load the design*/
        $f = file_get_contents("./design.jpg");
        /* Build the message*/
        $requestMessage = new WSMessage($requestPayloadString, array("to" => "http://localhost/solutions/store/manuf_service.php", "action" => "http://www.back_packers.com/purchaseOrder", "attachments" => array("myid1" => $f)));
        /* Load certificates and keys*/
        $rec_cert = ws_get_cert_from_file("keys/bob_cert.cert");
        $my_cert = ws_get_cert_from_file("keys/alice_cert.cert");
        $my_key = ws_get_key_from_file("keys/alice_key.pem");
        /* Load policy file*/
        $policy_xml = file_get_contents("policy.xml");
        $policy = new WSPolicy($policy_xml);
        /* Ceate a security token with reqd configurations*/
        $sec_token = new WSSecurityToken(array("user" => "Alice", "password" => "abcd!1234", "passwordType" => "Digest", "privateKey" => $my_key, "certificate" => $my_cert, "receiverCertificate" => $rec_cert));
        /* Create a new client*/
        $client = new WSClient(array("useWSA" => TRUE, "useMTOM" => FALSE, "policy" => $policy, "securityToken" => $sec_token));
        /* Request*/
        $responseMessage = $client->request($requestMessage);
        /* to track the messages */
        $request_str = $client->getLastRequest();
        $response_str = $client->getLastResponse();
        $request_str = format_xml($request_str);
        $response_str = format_xml($response_str);
        /* Print the response*/
        print "<div id=\"message\">More Backpacks requested : The purchase order number is {$responseMessage->str}</div>";
    } catch (Exception $e) {
        if ($e instanceof WSFault) {
            printf("Soap Fault: %s\n", $e->Reason);
        } else {
            printf("Message = %s\n", $e->getMessage());
        }
    }
}
开发者ID:ztobs,项目名称:wsf,代码行数:53,代码来源:online_client.php

示例4: echoFunction

<?php

/*
 * Copyright 2005,2008 WSO2, Inc. http://wso2.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
function echoFunction($inMessage)
{
    $returnMessage = new WSMessage($inMessage->str);
    return $returnMessage;
}
$cert = ws_get_cert_from_file("../../keys/bob_cert.cert");
$pvt_key = ws_get_key_from_file("../../keys/bob_key.pem");
$operations = array("echoString" => "echoFunction");
$policy_xml = file_get_contents("policy.xml");
$policy = new WSPolicy($policy_xml);
$sec_token = new WSSecurityToken(array("privateKey" => $pvt_key, "certificate" => $cert));
$actions = array("http://wso2.org/wsfphp/samples/echoString" => "echoString");
$svr = new WSService(array("operations" => $operations, "actions" => $actions, "policy" => $policy, "securityToken" => $sec_token));
$svr->reply();
开发者ID:ztobs,项目名称:wsf,代码行数:31,代码来源:service.php

示例5: ws_get_cert_from_file

 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
$reqPayloadString = <<<XML
<ns1:echo xmlns:ns1="http://wso2.org/wsfphp/samples"><text>Hello World!</text></ns1:echo>
XML;
try {
    $rec_cert = ws_get_cert_from_file("../keys/bob_cert.cert");
    $pvt_key = ws_get_key_from_file("../keys/alice_key.pem");
    $reqMessage = new WSMessage($reqPayloadString, array("to" => "http://localhost/samples/security/encryption/service.php", "action" => "http://wso2.org/wsfphp/samples/echoString"));
    $sec_array = array("encrypt" => TRUE, "algorithmSuite" => "Basic256Rsa15", "securityTokenReference" => "IssuerSerial");
    $policy = new WSPolicy(array("security" => $sec_array));
    $sec_token = new WSSecurityToken(array("privateKey" => $pvt_key, "receiverCertificate" => $rec_cert));
    $client = new WSClient(array("useWSA" => TRUE, "policy" => $policy, "securityToken" => $sec_token));
    $resMessage = $client->request($reqMessage);
    printf("Response = %s \n", $resMessage->str);
} catch (Exception $e) {
    if ($e instanceof WSFault) {
        printf("Soap Fault: %s\n", $e->Reason);
    } else {
        printf("Message = %s\n", $e->getMessage());
    }
}
开发者ID:ztobs,项目名称:wsf,代码行数:31,代码来源:client.php

示例6: file_get_contents

         <po:ReqDate>{$reqDateStr}</po:ReqDate>
         <po:Design>
            <po:FileName>design.jpg</po:FileName>
            <po:Image><xop:Include xmlns:xop="http://www.w3.org/2004/08/xop/include" href="cid:myid1"></xop:Include></po:Image>
         </po:Design>
      </po:Order>
XML;
try {
    /* Load the design*/
    $f = file_get_contents("./design.jpg");
    /* Build the message*/
    $requestMessage = new WSMessage($requestPayloadString, array("to" => "http://localhost:8080/solutions/store/manuf_service.php", "action" => "http://www.back_packers.com/purchaseOrder", "attachments" => array("myid1" => $f)));
    /* Load certificates and keys*/
    $rec_cert = ws_get_cert_from_file("keys/bob_cert.cert");
    $my_cert = ws_get_cert_from_file("keys/alice_cert.cert");
    $my_key = ws_get_key_from_file("keys/alice_key.pem");
    /* Load policy file*/
    $policy_xml = file_get_contents("policy.xml");
    $policy = new WSPolicy($policy_xml);
    /* Ceate a security token with reqd configurations*/
    $sec_token = new WSSecurityToken(array("user" => "Alice", "password" => "abcd!1234", "passwordType" => "Digest", "privateKey" => $my_key, "certificate" => $my_cert, "receiverCertificate" => $rec_cert));
    /* Create a new client*/
    $client = new WSClient(array("useWSA" => TRUE, "useMTOM" => FALSE, "policy" => $policy, "securityToken" => $sec_token));
    /* Request*/
    $responseMessage = $client->request($requestMessage);
    /* Print the response*/
    echo $responseMessage->str;
} catch (Exception $e) {
    if ($e instanceof WSFault) {
        printf("Soap Fault: %s\n", $e->Reason);
    } else {
开发者ID:ztobs,项目名称:wsf,代码行数:31,代码来源:store_client.php

示例7: WSMessage

        $poElems = $dom->documentElement->getElementsByTagName('OrderId');
        $poElem = $poElems->item(0);
        $purchaseOrderNum = $poElem->nodeValue;
    }
    /* The response payload*/
    $resPayload = <<<XML
      <manuf:RecievedOrder xmlns:manuf="http://www.factory.com/ws/purchaseOrder">
         <manuf:OrderId>{$purchaseOrderNum}</manuf:OrderId>
      </manuf:RecievedOrder>
XML;
    /* Create a response message*/
    $returnMessage = new WSMessage($resPayload);
    return $returnMessage;
}
/* Load certificates/keys*/
$rec_cert = ws_get_cert_from_file("keys/alice_cert.cert");
$my_key = ws_get_key_from_file("keys/bob_key.pem");
$my_cert = ws_get_key_from_file("keys/bob_cert.cert");
/*Function mapping = manuf*/
$operations = array("purchaseOrder" => "manuf");
/* Load and create a policy*/
$policy_xml = file_get_contents("policy.xml");
$policy = new WSPolicy($policy_xml);
/* Create a security token*/
$sec_token = new WSSecurityToken(array("passwordType" => "Digest", "password" => "abcd!1234", "user" => "Alice", "privateKey" => $my_key, "certificate" => $my_cert, "receiverCertificate" => $rec_cert));
/* Define actions*/
$actions = array("http://www.back_packers.com/purchaseOrder" => "purchaseOrder");
/* Create a new service*/
$svr = new WSService(array("actions" => $actions, "operations" => $operations, "policy" => $policy, "requestXOP" => TRUE, "securityToken" => $sec_token));
/* Reply*/
$svr->reply();
开发者ID:ztobs,项目名称:wsf,代码行数:31,代码来源:manuf_service.php


注:本文中的ws_get_key_from_file函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。