Documentation

XMLSecEnc
in package

xmlseclibs.php

Copyright (c) 2007-2017, Robert Richards rrichards@cdatazone.org. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of Robert Richards nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

Tags
author

Robert Richards rrichards@cdatazone.org

copyright

2007-2017 Robert Richards rrichards@cdatazone.org

license

http://www.opensource.org/licenses/bsd-license.php BSD License

Table of Contents

Content  = 'http://www.w3.org/2001/04/xmlenc#Content'
Element  = 'http://www.w3.org/2001/04/xmlenc#Element'
template  = "<xenc:EncryptedData xmlns:xenc='http://www.w3.org/2001/04/xmlenc#'> <xenc:CipherData> <xenc:CipherValue></xenc:CipherValue> </xenc:CipherData> </xenc:EncryptedData>"
URI  = 3
XMLENCNS  = 'http://www.w3.org/2001/04/xmlenc#'
$encKey  : null|DOMElement
$type  : null|string
$encdoc  : null|DOMDocument
$rawNode  : null|DOMNode
$references  : array<string|int, mixed>
__construct()  : mixed
addReference()  : mixed
decryptKey()  : DOMElement|string
decryptNode()  : string|DOMElement
Decrypt this encrypted node.
encryptKey()  : mixed
Encrypt the XMLSecurityKey
encryptNode()  : DOMElement
Encrypt the selected node with the given key.
encryptReferences()  : mixed
getCipherValue()  : string|null
Retrieve the CipherValue text from this encrypted node.
locateEncryptedData()  : DOMNode|null
locateKey()  : null|XMLSecurityKey
Returns the key from the DOM
locateKeyInfo()  : null|XMLSecurityKey
setNode()  : mixed
staticLocateKeyInfo()  : null|XMLSecurityKey
_resetTemplate()  : mixed

Constants

Content

public mixed Content = 'http://www.w3.org/2001/04/xmlenc#Content'

Element

public mixed Element = 'http://www.w3.org/2001/04/xmlenc#Element'

template

public mixed template = "<xenc:EncryptedData xmlns:xenc='http://www.w3.org/2001/04/xmlenc#'> <xenc:CipherData> <xenc:CipherValue></xenc:CipherValue> </xenc:CipherData> </xenc:EncryptedData>"

XMLENCNS

public mixed XMLENCNS = 'http://www.w3.org/2001/04/xmlenc#'

Properties

$encKey

public null|DOMElement $encKey = null

$encdoc

private null|DOMDocument $encdoc = null

$rawNode

private null|DOMNode $rawNode = null

$references

private array<string|int, mixed> $references = array()

Methods

__construct()

public __construct() : mixed
Return values
mixed

addReference()

public addReference(string $name, DOMNode $node, string $type) : mixed
Parameters
$name : string
$node : DOMNode
$type : string
Tags
throws
Exception
Return values
mixed

decryptNode()

Decrypt this encrypted node.

public decryptNode(XMLSecurityKey $objKey[, bool $replace = true ]) : string|DOMElement

The behaviour of this function depends on the value of $replace. If $replace is false, we will return the decrypted data as a string. If $replace is true, we will insert the decrypted element(s) into the document, and return the decrypted element(s).

Parameters
$objKey : XMLSecurityKey

The decryption key that should be used when decrypting the node.

$replace : bool = true

Whether we should replace the encrypted node in the XML document with the decrypted data. The default is true.

Return values
string|DOMElement

The decrypted data.

encryptNode()

Encrypt the selected node with the given key.

public encryptNode(XMLSecurityKey $objKey[, bool $replace = true ]) : DOMElement
Parameters
$objKey : XMLSecurityKey

The encryption key and algorithm.

$replace : bool = true

Whether the encrypted node should be replaced in the original tree. Default is true.

Tags
throws
Exception
Return values
DOMElement

The xenc:EncryptedData-element.

getCipherValue()

Retrieve the CipherValue text from this encrypted node.

public getCipherValue() : string|null
Tags
throws
Exception
Return values
string|null

The Ciphervalue text, or null if no CipherValue is found.

locateEncryptedData()

public locateEncryptedData(DOMDocument $element) : DOMNode|null
Parameters
$element : DOMDocument
Return values
DOMNode|null

locateKey()

Returns the key from the DOM

public locateKey([null|DOMNode $node = null ]) : null|XMLSecurityKey
Parameters
$node : null|DOMNode = null
Return values
null|XMLSecurityKey

setNode()

public setNode(DOMNode $node) : mixed
Parameters
$node : DOMNode
Return values
mixed

_resetTemplate()

private _resetTemplate() : mixed
Return values
mixed

Search results