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


PHP XMLSecurityDSig::get509XCert方法代码示例

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


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

示例1: add509Cert

 public function add509Cert($cert, $isPEMFormat = TRUE)
 {
     $data = XMLSecurityDSig::get509XCert($cert, $isPEMFormat);
     if ($xpath = $this->getXPathObj()) {
         $query = "./secdsig:KeyInfo";
         $nodeset = $xpath->query($query, $this->sigNode);
         $keyInfo = $nodeset->item(0);
         if (!$keyInfo) {
             $inserted = FALSE;
             $keyInfo = $this->createNewSignNode('KeyInfo');
             if ($xpath = $this->getXPathObj()) {
                 $query = "./secdsig:Object";
                 $nodeset = $xpath->query($query, $this->sigNode);
                 if ($sObject = $nodeset->item(0)) {
                     $sObject->parentNode->insertBefore($keyInfo, $sObject);
                     $inserted = TRUE;
                 }
             }
             if (!$inserted) {
                 $this->sigNode->appendChild($keyInfo);
             }
         }
         $x509DataNode = $this->createNewSignNode('X509Data');
         $keyInfo->appendChild($x509DataNode);
         $x509CertNode = $this->createNewSignNode('X509Certificate', $data);
         $x509DataNode->appendChild($x509CertNode);
     }
 }
开发者ID:aenetworks,项目名称:exacttarget,代码行数:28,代码来源:xmlseclibs.php

示例2: addBinaryToken

 public function addBinaryToken($cert, $isPEMFormat = true, $isDSig = true)
 {
     $security = $this->locateSecurityHeader();
     $data = XMLSecurityDSig::get509XCert($cert, $isPEMFormat);
     $token = $this->soapDoc->createElementNS(self::WSSENS, self::WSSEPFX . ':BinarySecurityToken', $data);
     $security->insertBefore($token, $security->firstChild);
     $token->setAttribute('EncodingType', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary');
     $token->setAttributeNS(self::WSUNS, self::WSUPFX . ':Id', XMLSecurityDSig::generate_GUID());
     $token->setAttribute('ValueType', 'http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3');
     return $token;
 }
开发者ID:KoenLav,项目名称:wse-php,代码行数:11,代码来源: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::get509XCert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。