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


PHP XMLSecurityDSig::createNewSignNode方法代码示例

本文整理汇总了PHP中XMLSecurityDSig::createNewSignNode方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLSecurityDSig::createNewSignNode方法的具体用法?PHP XMLSecurityDSig::createNewSignNode怎么用?PHP XMLSecurityDSig::createNewSignNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在XMLSecurityDSig的用法示例。


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

示例1: addIssuerSerial

 public function addIssuerSerial($X509Cert)
 {
     $name = getIssuerName($X509Cert);
     $serialNumber = getSerialNumber($X509Cert);
     $objXMLSecDSig = new XMLSecurityDSig();
     if ($objDSig = $objXMLSecDSig->locateSignature($this->soapDoc)) {
         $this->SOAPXPath->registerNamespace('secdsig', XMLSecurityDSig::XMLDSIGNS);
         $query = "./secdsig:KeyInfo";
         $nodeset = $this->SOAPXPath->query($query, $objDSig);
         $keyInfo = $nodeset->item(0);
         if (!$keyInfo) {
             $keyInfo = $objXMLSecDSig->createNewSignNode('KeyInfo');
             $objDSig->appendChild($keyInfo);
         }
         $tokenRef = $this->soapDoc->createElementNS(WSSESoap::WSSENS, WSSESoap::WSSEPFX . ':SecurityTokenReference');
         $keyInfo->appendChild($tokenRef);
         $x509Data = $objXMLSecDSig->createNewSignNode("X509Data");
         $x509IssuerSerial = $objXMLSecDSig->createNewSignNode("X509IssuerSerial");
         $x509Data->appendChild($x509IssuerSerial);
         $x509IssuerName = $objXMLSecDSig->createNewSignNode("X509IssuerName", $name);
         $x509SerialNumber = $objXMLSecDSig->createNewSignNode("X509SerialNumber", $serialNumber);
         $x509IssuerSerial->appendChild($x509IssuerName);
         $x509IssuerSerial->appendChild($x509SerialNumber);
         $tokenRef->appendChild($x509Data);
     } else {
         throw new Exception('Unable to locate digital signature');
     }
 }
开发者ID:cstamariab,项目名称:API-SOAP-WebPay---PHP,代码行数:28,代码来源:soap-wsse.php

示例2: attachTokentoSig

 public function attachTokentoSig($token)
 {
     if (!$token instanceof DOMElement) {
         throw new Exception('Invalid parameter: BinarySecurityToken element expected');
     }
     $objXMLSecDSig = new XMLSecurityDSig();
     if ($objDSig = $objXMLSecDSig->locateSignature($this->soapDoc)) {
         $tokenURI = '#' . $token->getAttributeNS(self::WSUNS, "Id");
         $this->SOAPXPath->registerNamespace('secdsig', XMLSecurityDSig::XMLDSIGNS);
         $query = "./secdsig:KeyInfo";
         $nodeset = $this->SOAPXPath->query($query, $objDSig);
         $keyInfo = $nodeset->item(0);
         if (!$keyInfo) {
             $keyInfo = $objXMLSecDSig->createNewSignNode('KeyInfo');
             $objDSig->appendChild($keyInfo);
         }
         $tokenRef = $this->soapDoc->createElementNS(self::WSSENS, self::WSSEPFX . ':SecurityTokenReference');
         $keyInfo->appendChild($tokenRef);
         $reference = $this->soapDoc->createElementNS(self::WSSENS, self::WSSEPFX . ':Reference');
         $reference->setAttribute('ValueType', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3');
         $reference->setAttribute("URI", $tokenURI);
         $tokenRef->appendChild($reference);
     } else {
         throw new Exception('Unable to locate digital signature');
     }
 }
开发者ID:KoenLav,项目名称:wse-php,代码行数:26,代码来源:WSSESoap.php

示例3: mPayAttachCertificateInfo

 public function mPayAttachCertificateInfo($cert, $isPEMFormat = TRUE)
 {
     $data = XMLSecurityDSig::get509XCert($cert, $isPEMFormat);
     $certData = openssl_x509_parse("-----BEGIN CERTIFICATE-----\n" . chunk_split($data, 64, "\n") . "-----END CERTIFICATE-----\n");
     $objXMLSecDSig = new XMLSecurityDSig();
     if ($objDSig = $objXMLSecDSig->locateSignature($this->soapDoc)) {
         $this->SOAPXPath->registerNamespace('secdsig', XMLSecurityDSig::XMLDSIGNS);
         $query = "./secdsig:KeyInfo";
         $nodeset = $this->SOAPXPath->query($query, $objDSig);
         $keyInfo = $nodeset->item(0);
         if (!$keyInfo) {
             $keyInfo = $objXMLSecDSig->createNewSignNode('KeyInfo');
             $objDSig->appendChild($keyInfo);
         }
         $tokenRef = $this->soapDoc->createElementNS(WSSESoap::WSSENS, WSSESoap::WSSEPFX . ':SecurityTokenReference');
         $keyInfo->appendChild($tokenRef);
         $xdata = $this->soapDoc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:X509Data');
         $tokenRef->appendChild($xdata);
         $serial = $this->soapDoc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:X509IssuerSerial');
         $xdata->appendChild($serial);
         if (!empty($certData['issuer']) && !empty($certData['serialNumber'])) {
             if (is_array($certData['issuer'])) {
                 $parts = array();
                 foreach ($certData['issuer'] as $key => $value) {
                     array_unshift($parts, "{$key}={$value}");
                 }
                 $issuerName = implode(',', $parts);
             } else {
                 $issuerName = $certData['issuer'];
             }
             $issuer_name_x = $this->soapDoc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:X509IssuerName', $issuerName);
             $serial->appendChild($issuer_name_x);
             $serial_number = $this->soapDoc->createElementNS(XMLSecurityDSig::XMLDSIGNS, 'ds:X509SerialNumber', $certData['serialNumber']);
             $serial->appendChild($serial_number);
         }
     } else {
         throw new Exception('Unable to locate digital signature');
     }
 }
开发者ID:Deeplace,项目名称:mpay_integration,代码行数:39,代码来源:soap-wsse.php


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