ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Public Member Functions | |
__construct ($prefix='ds') | |
locateSignature ($objDoc, $pos=0) | |
createNewSignNode ($name, $value=null) | |
setCanonicalMethod ($method) | |
canonicalizeSignedInfo () | |
calculateDigest ($digestAlgorithm, $data, $encode=true) | |
validateDigest ($refNode, $data) | |
processTransforms ($refNode, $objData, $includeCommentNodes=true) | |
processRefNode ($refNode) | |
getRefNodeID ($refNode) | |
getRefIDs () | |
validateReference () | |
addReference ($node, $algorithm, $arTransforms=null, $options=null) | |
addReferenceList ($arNodes, $algorithm, $arTransforms=null, $options=null) | |
addObject ($data, $mimetype=null, $encoding=null) | |
locateKey ($node=null) | |
verify ($objKey) | |
Returns: Bool when verifying HMAC_SHA1; Int otherwise, with following meanings: 1 on succesful signature verification, 0 when signature verification failed, -1 if an error occurred during processing. More... | |
signData ($objKey, $data) | |
sign ($objKey, $appendToNode=null) | |
appendCert () | |
appendKey ($objKey, $parent=null) | |
insertSignature ($node, $beforeNode=null) | |
This function inserts the signature element. More... | |
appendSignature ($parentNode, $insertBefore=false) | |
add509Cert ($cert, $isPEMFormat=true, $isURL=false, $options=null) | |
appendToKeyInfo ($node) | |
This function appends a node to the KeyInfo. More... | |
getValidatedNodes () | |
This function retrieves an associative array of the validated nodes. More... | |
Static Public Member Functions | |
static | generateGUID ($prefix='pfx') |
Generate guid. More... | |
static | generate_GUID ($prefix='pfx') |
Generate guid. More... | |
static | get509XCert ($cert, $isPEMFormat=true) |
static | staticGet509XCerts ($certs, $isPEMFormat=true) |
static | staticAdd509Cert ($parentRef, $cert, $isPEMFormat=true, $isURL=false, $xpath=null, $options=null) |
Data Fields | |
const | XMLDSIGNS = 'http://www.w3.org/2000/09/xmldsig#' |
const | SHA1 = 'http://www.w3.org/2000/09/xmldsig#sha1' |
const | SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256' |
const | SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#sha384' |
const | SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512' |
const | RIPEMD160 = 'http://www.w3.org/2001/04/xmlenc#ripemd160' |
const | C14N = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315' |
const | C14N_COMMENTS = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments' |
const | EXC_C14N = 'http://www.w3.org/2001/10/xml-exc-c14n#' |
const | EXC_C14N_COMMENTS = 'http://www.w3.org/2001/10/xml-exc-c14n#WithComments' |
const | template |
const | BASE_TEMPLATE |
$sigNode = null | |
$idKeys = array() | |
$idNS = array() | |
Private Member Functions | |
resetXPathObj () | |
Reset the XPathObj to null. More... | |
getXPathObj () | |
Returns the XPathObj or null if xPathCtx is set and sigNode is empty. More... | |
canonicalizeData ($node, $canonicalmethod, $arXPath=null, $prefixList=null) | |
addRefInternal ($sinfoNode, $node, $algorithm, $arTransforms=null, $options=null) | |
Private Attributes | |
$signedInfo = null | |
$xPathCtx = null | |
$canonicalMethod = null | |
$prefix = '' | |
$searchpfx = 'secdsig' | |
$validatedNodes = null | |
Copyright (c) 2007-2019, Robert Richards rrich. All rights reserved. ards @cdat azon e.org
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Definition at line 51 of file XMLSecurityDSig.php.
RobRichards\XMLSecLibs\XMLSecurityDSig::__construct | ( | $prefix = 'ds' | ) |
string | $prefix |
Definition at line 110 of file XMLSecurityDSig.php.
References RobRichards\XMLSecLibs\XMLSecurityDSig\$prefix, and $template.
RobRichards\XMLSecLibs\XMLSecurityDSig::add509Cert | ( | $cert, | |
$isPEMFormat = true , |
|||
$isURL = false , |
|||
$options = null |
|||
) |
string | $cert | |
bool | $isPEMFormat | |
bool | $isURL | |
null | array | $options |
Definition at line 1079 of file XMLSecurityDSig.php.
References PHPMailer\PHPMailer\$options, and RobRichards\XMLSecLibs\XMLSecurityDSig\getXPathObj().
RobRichards\XMLSecLibs\XMLSecurityDSig::addObject | ( | $data, | |
$mimetype = null , |
|||
$encoding = null |
|||
) |
DOMElement | string | $data | |
null | string | $mimetype | |
null | string | $encoding |
Definition at line 734 of file XMLSecurityDSig.php.
References $data, and RobRichards\XMLSecLibs\XMLSecurityDSig\createNewSignNode().
RobRichards\XMLSecLibs\XMLSecurityDSig::addReference | ( | $node, | |
$algorithm, | |||
$arTransforms = null , |
|||
$options = null |
|||
) |
DOMDocument | $node | |
string | $algorithm | |
null | array | $arTransforms | |
null | array | $options |
Definition at line 698 of file XMLSecurityDSig.php.
References PHPMailer\PHPMailer\$options, $query, RobRichards\XMLSecLibs\XMLSecurityDSig\addRefInternal(), and RobRichards\XMLSecLibs\XMLSecurityDSig\getXPathObj().
RobRichards\XMLSecLibs\XMLSecurityDSig::addReferenceList | ( | $arNodes, | |
$algorithm, | |||
$arTransforms = null , |
|||
$options = null |
|||
) |
array | $arNodes | |
string | $algorithm | |
null | array | $arTransforms | |
null | array | $options |
Definition at line 715 of file XMLSecurityDSig.php.
References PHPMailer\PHPMailer\$options, $query, RobRichards\XMLSecLibs\XMLSecurityDSig\addRefInternal(), and RobRichards\XMLSecLibs\XMLSecurityDSig\getXPathObj().
|
private |
DOMNode | $sinfoNode | |
DOMDocument | $node | |
string | $algorithm | |
null | array | $arTransforms | |
null | array | $options |
Definition at line 615 of file XMLSecurityDSig.php.
References $namespace, PHPMailer\PHPMailer\$options, RobRichards\XMLSecLibs\XMLSecurityDSig\$prefix, RobRichards\XMLSecLibs\XMLSecurityDSig\calculateDigest(), RobRichards\XMLSecLibs\XMLSecurityDSig\createNewSignNode(), and RobRichards\XMLSecLibs\XMLSecurityDSig\processTransforms().
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\addReference(), and RobRichards\XMLSecLibs\XMLSecurityDSig\addReferenceList().
RobRichards\XMLSecLibs\XMLSecurityDSig::appendCert | ( | ) |
Definition at line 855 of file XMLSecurityDSig.php.
RobRichards\XMLSecLibs\XMLSecurityDSig::appendKey | ( | $objKey, | |
$parent = null |
|||
) |
XMLSecurityKey | $objKey | |
null | DOMNode | $parent |
Definition at line 864 of file XMLSecurityDSig.php.
RobRichards\XMLSecLibs\XMLSecurityDSig::appendSignature | ( | $parentNode, | |
$insertBefore = false |
|||
) |
DOMNode | $parentNode | |
bool | $insertBefore |
Definition at line 899 of file XMLSecurityDSig.php.
References RobRichards\XMLSecLibs\XMLSecurityDSig\insertSignature().
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\sign().
RobRichards\XMLSecLibs\XMLSecurityDSig::appendToKeyInfo | ( | $node | ) |
This function appends a node to the KeyInfo.
The KeyInfo element will be created if one does not exist in the document.
DOMNode | $node | The node to append to the KeyInfo. |
Definition at line 1095 of file XMLSecurityDSig.php.
References $query, RobRichards\XMLSecLibs\XMLSecurityDSig\$sigNode, and RobRichards\XMLSecLibs\XMLSecurityDSig\getXPathObj().
RobRichards\XMLSecLibs\XMLSecurityDSig::calculateDigest | ( | $digestAlgorithm, | |
$data, | |||
$encode = true |
|||
) |
string | $digestAlgorithm | |
string | $data | |
bool | $encode |
Exception |
Definition at line 334 of file XMLSecurityDSig.php.
References $data, and GuzzleHttp\Psr7\hash().
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\addRefInternal(), and RobRichards\XMLSecLibs\XMLSecurityDSig\validateDigest().
|
private |
DOMNode | $node | |
string | $canonicalmethod | |
null | array | $arXPath | |
null | array | $prefixList |
Definition at line 261 of file XMLSecurityDSig.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\canonicalizeSignedInfo(), RobRichards\XMLSecLibs\XMLSecurityDSig\processTransforms(), and RobRichards\XMLSecLibs\XMLSecurityDSig\sign().
RobRichards\XMLSecLibs\XMLSecurityDSig::canonicalizeSignedInfo | ( | ) |
Definition at line 302 of file XMLSecurityDSig.php.
References $query, RobRichards\XMLSecLibs\XMLSecurityDSig\$signedInfo, RobRichards\XMLSecLibs\XMLSecurityDSig\canonicalizeData(), and RobRichards\XMLSecLibs\XMLSecurityDSig\getXPathObj().
RobRichards\XMLSecLibs\XMLSecurityDSig::createNewSignNode | ( | $name, | |
$value = null |
|||
) |
string | $name | |
null | string | $value |
Definition at line 212 of file XMLSecurityDSig.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\addObject(), RobRichards\XMLSecLibs\XMLSecurityDSig\addRefInternal(), RobRichards\XMLSecLibs\XMLSecurityDSig\setCanonicalMethod(), and RobRichards\XMLSecLibs\XMLSecurityDSig\sign().
|
static |
Generate guid.
string | $prefix | Prefix to use for guid. defaults to pfx |
Definition at line 174 of file XMLSecurityDSig.php.
References RobRichards\XMLSecLibs\XMLSecurityDSig\$prefix.
|
static |
Generate guid.
string | $prefix | Prefix to use for guid. defaults to pfx |
Definition at line 154 of file XMLSecurityDSig.php.
References RobRichards\XMLSecLibs\XMLSecurityDSig\$prefix.
Referenced by RobRichards\XMLSecLibs\XMLSecEnc\addReference().
|
static |
string | $cert | |
bool | $isPEMFormat |
Definition at line 910 of file XMLSecurityDSig.php.
RobRichards\XMLSecLibs\XMLSecurityDSig::getRefIDs | ( | ) |
Exception |
Definition at line 560 of file XMLSecurityDSig.php.
References $query, RobRichards\XMLSecLibs\XMLSecurityDSig\getRefNodeID(), and RobRichards\XMLSecLibs\XMLSecurityDSig\getXPathObj().
RobRichards\XMLSecLibs\XMLSecurityDSig::getRefNodeID | ( | $refNode | ) |
DOMNode | $refNode |
Definition at line 543 of file XMLSecurityDSig.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\getRefIDs().
RobRichards\XMLSecLibs\XMLSecurityDSig::getValidatedNodes | ( | ) |
This function retrieves an associative array of the validated nodes.
The array will contain the id of the referenced node as the key and the node itself as the value.
Returns: An associative array of validated nodes or null if no nodes have been validated.
Definition at line 1146 of file XMLSecurityDSig.php.
References RobRichards\XMLSecLibs\XMLSecurityDSig\$validatedNodes.
|
private |
Returns the XPathObj or null if xPathCtx is set and sigNode is empty.
Definition at line 137 of file XMLSecurityDSig.php.
References RobRichards\XMLSecLibs\XMLSecurityDSig\$xPathCtx.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\add509Cert(), RobRichards\XMLSecLibs\XMLSecurityDSig\addReference(), RobRichards\XMLSecLibs\XMLSecurityDSig\addReferenceList(), RobRichards\XMLSecLibs\XMLSecurityDSig\appendToKeyInfo(), RobRichards\XMLSecLibs\XMLSecurityDSig\canonicalizeSignedInfo(), RobRichards\XMLSecLibs\XMLSecurityDSig\getRefIDs(), RobRichards\XMLSecLibs\XMLSecurityDSig\setCanonicalMethod(), RobRichards\XMLSecLibs\XMLSecurityDSig\sign(), and RobRichards\XMLSecLibs\XMLSecurityDSig\validateReference().
RobRichards\XMLSecLibs\XMLSecurityDSig::insertSignature | ( | $node, | |
$beforeNode = null |
|||
) |
This function inserts the signature element.
The signature element will be appended to the element, unless $beforeNode is specified. If $beforeNode is specified, the signature element will be inserted as the last element before $beforeNode.
DOMNode | $node | The node the signature element should be inserted into. |
DOMNode | $beforeNode | The node the signature element should be located before. |
Definition at line 881 of file XMLSecurityDSig.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\appendSignature().
RobRichards\XMLSecLibs\XMLSecurityDSig::locateKey | ( | $node = null | ) |
null | DOMNode | $node |
Definition at line 759 of file XMLSecurityDSig.php.
References $query, and RobRichards\XMLSecLibs\XMLSecurityDSig\$sigNode.
RobRichards\XMLSecLibs\XMLSecurityDSig::locateSignature | ( | $objDoc, | |
$pos = 0 |
|||
) |
DOMDocument | $objDoc | |
int | $pos |
Definition at line 184 of file XMLSecurityDSig.php.
References $query, and RobRichards\XMLSecLibs\XMLSecurityDSig\$sigNode.
RobRichards\XMLSecLibs\XMLSecurityDSig::processRefNode | ( | $refNode | ) |
DOMNode | $refNode |
Definition at line 475 of file XMLSecurityDSig.php.
References $data, $query, RobRichards\XMLSecLibs\XMLSecurityDSig\processTransforms(), and RobRichards\XMLSecLibs\XMLSecurityDSig\validateDigest().
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\validateReference().
RobRichards\XMLSecLibs\XMLSecurityDSig::processTransforms | ( | $refNode, | |
$objData, | |||
$includeCommentNodes = true |
|||
) |
$refNode | ||
DOMNode | $objData | |
bool | $includeCommentNodes |
Definition at line 387 of file XMLSecurityDSig.php.
References RobRichards\XMLSecLibs\XMLSecurityDSig\$canonicalMethod, $data, $query, and RobRichards\XMLSecLibs\XMLSecurityDSig\canonicalizeData().
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\addRefInternal(), and RobRichards\XMLSecLibs\XMLSecurityDSig\processRefNode().
|
private |
Reset the XPathObj to null.
Definition at line 127 of file XMLSecurityDSig.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\sign().
RobRichards\XMLSecLibs\XMLSecurityDSig::setCanonicalMethod | ( | $method | ) |
string | $method |
Exception |
Definition at line 227 of file XMLSecurityDSig.php.
References $query, RobRichards\XMLSecLibs\XMLSecurityDSig\createNewSignNode(), and RobRichards\XMLSecLibs\XMLSecurityDSig\getXPathObj().
RobRichards\XMLSecLibs\XMLSecurityDSig::sign | ( | $objKey, | |
$appendToNode = null |
|||
) |
XMLSecurityKey | $objKey | |
null | DOMNode | $appendToNode |
Definition at line 827 of file XMLSecurityDSig.php.
References $data, $query, RobRichards\XMLSecLibs\XMLSecurityDSig\appendSignature(), RobRichards\XMLSecLibs\XMLSecurityDSig\canonicalizeData(), RobRichards\XMLSecLibs\XMLSecurityDSig\createNewSignNode(), RobRichards\XMLSecLibs\XMLSecurityDSig\getXPathObj(), RobRichards\XMLSecLibs\XMLSecurityDSig\resetXPathObj(), and RobRichards\XMLSecLibs\XMLSecurityDSig\signData().
RobRichards\XMLSecLibs\XMLSecurityDSig::signData | ( | $objKey, | |
$data | |||
) |
XMLSecurityKey | $objKey | |
string | $data |
Definition at line 818 of file XMLSecurityDSig.php.
References $data.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\sign().
|
static |
DOMElement | $parentRef | |
string | $cert | |
bool | $isPEMFormat | |
bool | $isURL | |
null | DOMXPath | $xpath | |
null | array | $options |
Exception |
Definition at line 961 of file XMLSecurityDSig.php.
References $key, PHPMailer\PHPMailer\$options, and $query.
|
static |
string | $certs | |
bool | $isPEMFormat |
Definition at line 924 of file XMLSecurityDSig.php.
References $data.
RobRichards\XMLSecLibs\XMLSecurityDSig::validateDigest | ( | $refNode, | |
$data | |||
) |
$refNode | ||
string | $data |
Definition at line 369 of file XMLSecurityDSig.php.
References $data, $query, and RobRichards\XMLSecLibs\XMLSecurityDSig\calculateDigest().
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\processRefNode().
RobRichards\XMLSecLibs\XMLSecurityDSig::validateReference | ( | ) |
Exception |
Definition at line 580 of file XMLSecurityDSig.php.
References $query, RobRichards\XMLSecLibs\XMLSecurityDSig\getXPathObj(), and RobRichards\XMLSecLibs\XMLSecurityDSig\processRefNode().
RobRichards\XMLSecLibs\XMLSecurityDSig::verify | ( | $objKey | ) |
Returns: Bool when verifying HMAC_SHA1; Int otherwise, with following meanings: 1 on succesful signature verification, 0 when signature verification failed, -1 if an error occurred during processing.
NOTE: be very careful when checking the int return value, because in PHP, -1 will be cast to True when in boolean context. Always check the return value in a strictly typed way, e.g. "$obj->verify(...) === 1".
XMLSecurityKey | $objKey |
Exception |
Definition at line 800 of file XMLSecurityDSig.php.
References $query.
|
private |
Definition at line 93 of file XMLSecurityDSig.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\processTransforms().
RobRichards\XMLSecLibs\XMLSecurityDSig::$idKeys = array() |
Definition at line 81 of file XMLSecurityDSig.php.
RobRichards\XMLSecLibs\XMLSecurityDSig::$idNS = array() |
Definition at line 84 of file XMLSecurityDSig.php.
|
private |
|
private |
Definition at line 99 of file XMLSecurityDSig.php.
|
private |
Definition at line 87 of file XMLSecurityDSig.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\canonicalizeSignedInfo().
RobRichards\XMLSecLibs\XMLSecurityDSig::$sigNode = null |
Definition at line 78 of file XMLSecurityDSig.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\appendToKeyInfo(), RobRichards\XMLSecLibs\XMLSecurityDSig\locateKey(), and RobRichards\XMLSecLibs\XMLSecurityDSig\locateSignature().
|
private |
Definition at line 105 of file XMLSecurityDSig.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\getValidatedNodes().
|
private |
Definition at line 90 of file XMLSecurityDSig.php.
Referenced by RobRichards\XMLSecLibs\XMLSecurityDSig\getXPathObj().
const RobRichards\XMLSecLibs\XMLSecurityDSig::BASE_TEMPLATE |
Definition at line 71 of file XMLSecurityDSig.php.
const RobRichards\XMLSecLibs\XMLSecurityDSig::C14N = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315' |
Definition at line 60 of file XMLSecurityDSig.php.
const RobRichards\XMLSecLibs\XMLSecurityDSig::C14N_COMMENTS = 'http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments' |
Definition at line 61 of file XMLSecurityDSig.php.
const RobRichards\XMLSecLibs\XMLSecurityDSig::EXC_C14N = 'http://www.w3.org/2001/10/xml-exc-c14n#' |
Definition at line 62 of file XMLSecurityDSig.php.
Referenced by SimpleSAML\XML\Signer\addCertificate().
const RobRichards\XMLSecLibs\XMLSecurityDSig::EXC_C14N_COMMENTS = 'http://www.w3.org/2001/10/xml-exc-c14n#WithComments' |
Definition at line 63 of file XMLSecurityDSig.php.
const RobRichards\XMLSecLibs\XMLSecurityDSig::RIPEMD160 = 'http://www.w3.org/2001/04/xmlenc#ripemd160' |
Definition at line 58 of file XMLSecurityDSig.php.
const RobRichards\XMLSecLibs\XMLSecurityDSig::SHA1 = 'http://www.w3.org/2000/09/xmldsig#sha1' |
Definition at line 54 of file XMLSecurityDSig.php.
const RobRichards\XMLSecLibs\XMLSecurityDSig::SHA256 = 'http://www.w3.org/2001/04/xmlenc#sha256' |
Definition at line 55 of file XMLSecurityDSig.php.
Referenced by SimpleSAML\XML\Signer\addCertificate().
const RobRichards\XMLSecLibs\XMLSecurityDSig::SHA384 = 'http://www.w3.org/2001/04/xmldsig-more#sha384' |
Definition at line 56 of file XMLSecurityDSig.php.
const RobRichards\XMLSecLibs\XMLSecurityDSig::SHA512 = 'http://www.w3.org/2001/04/xmlenc#sha512' |
Definition at line 57 of file XMLSecurityDSig.php.
const RobRichards\XMLSecLibs\XMLSecurityDSig::template |
Definition at line 65 of file XMLSecurityDSig.php.
const RobRichards\XMLSecLibs\XMLSecurityDSig::XMLDSIGNS = 'http://www.w3.org/2000/09/xmldsig#' |
Definition at line 53 of file XMLSecurityDSig.php.
Referenced by SAML2\XML\ds\X509Data\__construct(), SAML2\XML\ds\KeyInfo\__construct(), SAML2\XML\saml\SubjectConfirmationData\__construct(), RobRichards\XMLSecLibs\XMLSecEnc\staticLocateKeyInfo(), SAML2\XML\ds\KeyName\toXML(), and SAML2\XML\ds\X509Certificate\toXML().