class XMLSecurityDSig

Constants

XMLDSIGNS

SHA1

SHA256

SHA384

SHA512

RIPEMD160

C14N

C14N_COMMENTS

EXC_C14N

EXC_C14N_COMMENTS

template

BASE_TEMPLATE

Properties

DOMElement|null $sigNode
array $idKeys
array $idNS

Methods

__construct(string $prefix = 'ds')

No description

static string
generateGUID(string $prefix = 'pfx')

Generate guid

static string
generate_GUID(string $prefix = 'pfx') deprecated

Generate guid

DOMNode|null
locateSignature(DOMDocument $objDoc, int $pos = 0)

No description

createNewSignNode(string $name, null|string $value = null)

No description

setCanonicalMethod(string $method)

No description

null|string
canonicalizeSignedInfo()

No description

string
calculateDigest(string $digestAlgorithm, string $data, bool $encode = true)

No description

bool
validateDigest($refNode, string $data)

No description

string
processTransforms($refNode, DOMNode $objData, bool $includeCommentNodes = true)

No description

bool
processRefNode(DOMElement $refNode)

No description

null
getRefNodeID(DOMElement $refNode)

No description

array
getRefIDs()

No description

bool
validateReference()

No description

addReference(DOMDocument $node, string $algorithm, null|array $arTransforms = null, null|array $options = null)

No description

addReferenceList(array $arNodes, string $algorithm, null|array $arTransforms = null, null|array $options = null)

No description

addObject(DOMElement|string $data, null|string $mimetype = null, null|string $encoding = null)

No description

locateKey(null|DOMNode $node = null)

No description

bool|int
verify(XMLSecurityKey $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.

mixed|string
signData(XMLSecurityKey $objKey, string $data)

No description

sign(XMLSecurityKey $objKey, null|DOMNode $appendToNode = null)

No description

appendCert()

No description

insertSignature(DOMNode $node, DOMNode $beforeNode = null)

This function inserts the signature element.

appendSignature(DOMNode $parentNode, bool $insertBefore = false)

No description

static string
get509XCert(string $cert, bool $isPEMFormat = true)

No description

static array
staticGet509XCerts(string $certs, bool $isPEMFormat = true)

No description

static 
staticAdd509Cert(DOMElement $parentRef, string $cert, bool $isPEMFormat = true, bool $isURL = false, null|DOMXPath $xpath = null, null|array $options = null)

No description

add509Cert(string $cert, bool $isPEMFormat = true, bool $isURL = false, null|array $options = null)

No description

appendToKeyInfo(DOMNode $node)

This function appends a node to the KeyInfo.

array
getValidatedNodes()

This function retrieves an associative array of the validated nodes.

Details

at line 66
__construct(string $prefix = 'ds')

Parameters

string $prefix

at line 110
static string generateGUID(string $prefix = 'pfx')

Generate guid

Parameters

string $prefix Prefix to use for guid. defaults to pfx

Return Value

string The generated guid

at line 130
static string generate_GUID(string $prefix = 'pfx') deprecated

deprecated Method deprecated in Release 1.4.1

Generate guid

Parameters

string $prefix Prefix to use for guid. defaults to pfx

Return Value

string The generated guid

at line 140
DOMNode|null locateSignature(DOMDocument $objDoc, int $pos = 0)

Parameters

DOMDocument $objDoc
int $pos

Return Value

DOMNode|null

at line 161
DOMElement createNewSignNode(string $name, null|string $value = null)

Parameters

string $name
null|string $value

Return Value

DOMElement

at line 176
setCanonicalMethod(string $method)

Parameters

string $method

Exceptions

Exception

at line 251
null|string canonicalizeSignedInfo()

Return Value

null|string

at line 280
string calculateDigest(string $digestAlgorithm, string $data, bool $encode = true)

Parameters

string $digestAlgorithm
string $data
bool $encode

Return Value

string

Exceptions

Exception

at line 316
bool validateDigest($refNode, string $data)

Parameters

$refNode
string $data

Return Value

bool

Exceptions

Exception

at line 334
string processTransforms($refNode, DOMNode $objData, bool $includeCommentNodes = true)

Parameters

$refNode
DOMNode $objData
bool $includeCommentNodes

Return Value

string

at line 423
bool processRefNode(DOMElement $refNode)

Parameters

DOMElement $refNode

Return Value

bool

Exceptions

Exception

at line 491
null getRefNodeID(DOMElement $refNode)

Parameters

DOMElement $refNode

Return Value

null

at line 508
array getRefIDs()

Return Value

array

Exceptions

Exception

at line 528
bool validateReference()

Return Value

bool

Exceptions

Exception

at line 648
addReference(DOMDocument $node, string $algorithm, null|array $arTransforms = null, null|array $options = null)

Parameters

DOMDocument $node
string $algorithm
null|array $arTransforms
null|array $options

Exceptions

Exception

at line 666
addReferenceList(array $arNodes, string $algorithm, null|array $arTransforms = null, null|array $options = null)

Parameters

array $arNodes
string $algorithm
null|array $arTransforms
null|array $options

Exceptions

Exception

at line 685
DOMElement addObject(DOMElement|string $data, null|string $mimetype = null, null|string $encoding = null)

Parameters

DOMElement|string $data
null|string $mimetype
null|string $encoding

Return Value

DOMElement

at line 710
null|XMLSecurityKey locateKey(null|DOMNode $node = null)

Parameters

null|DOMNode $node

Return Value

null|XMLSecurityKey

at line 751
bool|int verify(XMLSecurityKey $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".

Parameters

XMLSecurityKey $objKey

Return Value

bool|int

Exceptions

Exception

at line 770
mixed|string signData(XMLSecurityKey $objKey, string $data)

Parameters

XMLSecurityKey $objKey
string $data

Return Value

mixed|string

Exceptions

Exception

at line 780
sign(XMLSecurityKey $objKey, null|DOMNode $appendToNode = null)

Parameters

XMLSecurityKey $objKey
null|DOMNode $appendToNode

Exceptions

Exception

at line 808
appendCert()

at line 825
DOMNode insertSignature(DOMNode $node, DOMNode $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.

Parameters

DOMNode $node The node the signature element should be inserted into.
DOMNode $beforeNode The node the signature element should be located before.

Return Value

DOMNode The signature element node

at line 843
DOMNode appendSignature(DOMNode $parentNode, bool $insertBefore = false)

Parameters

DOMNode $parentNode
bool $insertBefore

Return Value

DOMNode

at line 854
static string get509XCert(string $cert, bool $isPEMFormat = true)

Parameters

string $cert
bool $isPEMFormat

Return Value

string

at line 868
static array staticGet509XCerts(string $certs, bool $isPEMFormat = true)

Parameters

string $certs
bool $isPEMFormat

Return Value

array

at line 905
static staticAdd509Cert(DOMElement $parentRef, string $cert, bool $isPEMFormat = true, bool $isURL = false, null|DOMXPath $xpath = null, null|array $options = null)

Parameters

DOMElement $parentRef
string $cert
bool $isPEMFormat
bool $isURL
null|DOMXPath $xpath
null|array $options

Exceptions

Exception

at line 1024
add509Cert(string $cert, bool $isPEMFormat = true, bool $isURL = false, null|array $options = null)

Parameters

string $cert
bool $isPEMFormat
bool $isURL
null|array $options

Exceptions

Exception

at line 1040
DOMNode appendToKeyInfo(DOMNode $node)

This function appends a node to the KeyInfo.

The KeyInfo element will be created if one does not exist in the document.

Parameters

DOMNode $node The node to append to the KeyInfo.

Return Value

DOMNode The KeyInfo element node

at line 1091
array 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.</p> <p>Returns: An associative array of validated nodes or null if no nodes have been validated.

Return Value

array Associative array of validated nodes