Exemple #1
0
 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::generateGUID();
     $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($enc, $token)) {
         $this->addReference($enc->encKey, $guid);
     }
 }
 public function locateKeyInfo($objBaseKey = null, $node = null)
 {
     if (empty($node)) {
         $node = $this->rawNode;
     }
     return XMLSecEnc::staticLocateKeyInfo($objBaseKey, $node);
 }