本文整理汇总了PHP中XMLSecurityDSig::generate_GUID方法的典型用法代码示例。如果您正苦于以下问题:PHP XMLSecurityDSig::generate_GUID方法的具体用法?PHP XMLSecurityDSig::generate_GUID怎么用?PHP XMLSecurityDSig::generate_GUID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XMLSecurityDSig
的用法示例。
在下文中一共展示了XMLSecurityDSig::generate_GUID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addReference
public function addReference($name, $node, $type)
{
if (!$node instanceof \DOMNode) {
throw new \Exception('$node is not of type \\DOMNode');
}
$curencdoc = $this->encdoc;
$this->_resetTemplate();
$encdoc = $this->encdoc;
$this->encdoc = $curencdoc;
$refuri = XMLSecurityDSig::generate_GUID();
$element = $encdoc->documentElement;
$element->setAttribute("Id", $refuri);
$this->references[$name] = array("node" => $node, "type" => $type, "encnode" => $encdoc, "refuri" => $refuri);
}
示例2: EncryptBody
public function EncryptBody($siteKey, $objKey, $token)
{
$enc = new XMLSecEnc();
foreach ($this->envelope->childNodes as $node) {
if ($node->namespaceURI == $this->soapNS && $node->localName == 'Body') {
break;
}
}
$enc->setNode($node);
/* encrypt the symmetric key */
$enc->encryptKey($siteKey, $objKey, false);
$enc->type = XMLSecEnc::Content;
/* Using the symmetric key to actually encrypt the data */
$encNode = $enc->encryptNode($objKey);
$guid = XMLSecurityDSig::generate_GUID();
$encNode->setAttribute('Id', $guid);
$refNode = $encNode->firstChild;
while ($refNode && $refNode->nodeType != XML_ELEMENT_NODE) {
$refNode = $refNode->nextSibling;
}
if ($refNode) {
$refNode = $refNode->nextSibling;
}
if ($this->addEncryptedKey($encNode, $enc, $token)) {
$this->AddReference($enc->encKey, $guid);
}
}
示例3: addBinaryToken
public function addBinaryToken($cert, $isPEMFormat = TRUE, $isDSig = TRUE)
{
$security = $this->locateSecurityHeader();
$data = XMLSecurityDSig::get509XCert($cert, $isPEMFormat);
$token = $this->SOAPDoc->createElementNS(WSSESoap::WSSENS, WSSESoap::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(WSSESoap::WSUNS, WSSESoap::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;
}
示例4: addRefInternal
private function addRefInternal($sinfoNode, $node, $algorithm, $arTransforms = NULL, $options = NULL)
{
$prefix = NULL;
$prefix_ns = NULL;
$id_name = 'Id';
$overwrite_id = TRUE;
$force_uri = FALSE;
if (is_array($options)) {
$prefix = empty($options['prefix']) ? NULL : $options['prefix'];
$prefix_ns = empty($options['prefix_ns']) ? NULL : $options['prefix_ns'];
$id_name = empty($options['id_name']) ? 'Id' : $options['id_name'];
$overwrite_id = !isset($options['overwrite']) ? TRUE : (bool) $options['overwrite'];
$force_uri = !isset($options['force_uri']) ? FALSE : (bool) $options['force_uri'];
}
$attname = $id_name;
if (!empty($prefix)) {
$attname = $prefix . ':' . $attname;
}
$refNode = $this->createNewSignNode('Reference');
$sinfoNode->appendChild($refNode);
if (!$node instanceof DOMDocument) {
$uri = NULL;
if (!$overwrite_id) {
$uri = $node->getAttributeNS($prefix_ns, $attname);
}
if (empty($uri)) {
$uri = XMLSecurityDSig::generate_GUID();
$node->setAttributeNS($prefix_ns, $attname, $uri);
}
$refNode->setAttribute("URI", '#' . $uri);
} elseif ($force_uri) {
$refNode->setAttribute("URI", '');
}
$transNodes = $this->createNewSignNode('Transforms');
$refNode->appendChild($transNodes);
if (is_array($arTransforms)) {
foreach ($arTransforms as $transform) {
$transNode = $this->createNewSignNode('Transform');
$transNodes->appendChild($transNode);
if (is_array($transform) && !empty($transform['http://www.w3.org/TR/1999/REC-xpath-19991116']) && !empty($transform['http://www.w3.org/TR/1999/REC-xpath-19991116']['query'])) {
$transNode->setAttribute('Algorithm', 'http://www.w3.org/TR/1999/REC-xpath-19991116');
$XPathNode = $this->createNewSignNode('XPath', $transform['http://www.w3.org/TR/1999/REC-xpath-19991116']['query']);
$transNode->appendChild($XPathNode);
if (!empty($transform['http://www.w3.org/TR/1999/REC-xpath-19991116']['namespaces'])) {
foreach ($transform['http://www.w3.org/TR/1999/REC-xpath-19991116']['namespaces'] as $prefix => $namespace) {
$XPathNode->setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:{$prefix}", $namespace);
}
}
} else {
$transNode->setAttribute('Algorithm', $transform);
}
}
} elseif (!empty($this->canonicalMethod)) {
$transNode = $this->createNewSignNode('Transform');
$transNodes->appendChild($transNode);
$transNode->setAttribute('Algorithm', $this->canonicalMethod);
}
$canonicalData = $this->processTransforms($refNode, $node);
$digValue = $this->calculateDigest($algorithm, $canonicalData);
$digestMethod = $this->createNewSignNode('DigestMethod');
$refNode->appendChild($digestMethod);
$digestMethod->setAttribute('Algorithm', $algorithm);
$digestValue = $this->createNewSignNode('DigestValue', $digValue);
$refNode->appendChild($digestValue);
}
示例5: addRefInternal
private function addRefInternal($sinfoNode, $node, $algorithm, $arTransforms = NULL, $options = NULL)
{
$prefix = NULL;
$prefix_ns = NULL;
if (is_array($options)) {
$prefix = empty($options['prefix']) ? NULL : $options['prefix'];
$prefix_ns = empty($options['prefix_ns']) ? NULL : $options['prefix_ns'];
$id_name = empty($options['id_name']) ? 'Id' : $options['id_name'];
}
$refNode = $this->createNewSignNode('Reference');
$sinfoNode->appendChild($refNode);
if ($node instanceof DOMDocument) {
$uri = NULL;
} else {
/* Do wer really need to set a prefix? */
$uri = XMLSecurityDSig::generate_GUID();
$refNode->setAttribute("URI", '#' . $uri);
}
$transNodes = $this->createNewSignNode('Transforms');
$refNode->appendChild($transNodes);
if (is_array($arTransforms)) {
foreach ($arTransforms as $transform) {
$transNode = $this->createNewSignNode('Transform');
$transNodes->appendChild($transNode);
$transNode->setAttribute('Algorithm', $transform);
}
} elseif (!empty($this->canonicalMethod)) {
$transNode = $this->createNewSignNode('Transform');
$transNodes->appendChild($transNode);
$transNode->setAttribute('Algorithm', $this->canonicalMethod);
}
if (!empty($uri)) {
$attname = $id_name;
if (!empty($prefix)) {
$attname = $prefix . ':' . $attname;
}
$node->setAttributeNS($prefix_ns, $attname, $uri);
}
$canonicalData = $this->processTransforms($refNode, $node);
$digValue = $this->calculateDigest($algorithm, $canonicalData);
$digestMethod = $this->createNewSignNode('DigestMethod');
$refNode->appendChild($digestMethod);
$digestMethod->setAttribute('Algorithm', $algorithm);
$digestValue = $this->createNewSignNode('DigestValue', $digValue);
$refNode->appendChild($digestValue);
}