Skip to content

Commit

Permalink
Psalm-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tvdijen committed May 11, 2020
1 parent 75fa5a5 commit bf6339b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/XMLSecEnc.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,20 @@ public function encryptNode(XMLSecurityKey $objKey, bool $replace = true)
if (empty($this->rawNode)) {
throw new Exception('Node to encrypt has not been set');
}

if (!($objKey instanceof XMLSecurityKey)) {
throw new Exception('Invalid Key');
}

$doc = $this->rawNode->ownerDocument;
$xPath = new DOMXPath($this->encdoc);
$objList = $xPath->query('/xenc:EncryptedData/xenc:CipherData/xenc:CipherValue');

$cipherValue = $objList->item(0);
if ($cipherValue == null) {
throw new Exception('Error locating CipherValue element within template');
}

switch ($this->type) {
case (self::ELEMENT):
$data = $doc->saveXML($this->rawNode);
Expand Down

0 comments on commit bf6339b

Please sign in to comment.