PHP Class SAML2\SignedElementHelper

Can either be inherited from, or can be used by proxy.
Inheritance: implements saml2\SignedElement
Show file Open project: simplesamlphp/saml2 Class Usage Examples

Public Methods

Method Description
addValidator ( callback $function, mixed $data ) Add a method for validating this element.
getCertificates ( ) : array Retrieve the certificates that are included in the message.
getSignatureKey ( ) : XMLSecurityKey | null Retrieve the private key we should use to sign the message.
getValidatingCertificates ( ) : array Retrieve certificates that sign this element.
setCertificates ( array $certificates ) Set the certificates that should be included in the message.
setSignatureKey ( XMLsecurityKey $signatureKey = null ) Set the private key we should use to sign the message.
validate ( XMLSecurityKey $key ) : boolean Validate this element against a public key.

Protected Methods

Method Description
__construct ( DOMElement $xml = null ) Initialize the helper class.
signElement ( DOMElement $root, DOMElement $insertBefore = null ) : DOMElement | null Sign the given XML element.

Method Details

__construct() protected method

Initialize the helper class.
protected __construct ( DOMElement $xml = null )
$xml DOMElement The XML element which may be signed.

addValidator() public method

This function is used for custom validation extensions
public addValidator ( callback $function, mixed $data )
$function callback The function which should be called.
$data mixed The data that should be included as the first parameter to the function.

getCertificates() public method

Retrieve the certificates that are included in the message.
public getCertificates ( ) : array
return array An array of certificates.

getSignatureKey() public method

Retrieve the private key we should use to sign the message.
public getSignatureKey ( ) : XMLSecurityKey | null
return RobRichards\XMLSecLibs\XMLSecurityKey | null The key, or NULL if no key is specified.

getValidatingCertificates() public method

Retrieve certificates that sign this element.
public getValidatingCertificates ( ) : array
return array Array with certificates.

setCertificates() public method

The certificates should be strings with the PEM encoded data.
public setCertificates ( array $certificates )
$certificates array An array of certificates.

setSignatureKey() public method

If the key is null, the message will be sent unsigned.
public setSignatureKey ( XMLsecurityKey $signatureKey = null )
$signatureKey XMLsecurityKey

signElement() protected method

Sign the given XML element.
protected signElement ( DOMElement $root, DOMElement $insertBefore = null ) : DOMElement | null
$root DOMElement The element we should sign.
$insertBefore DOMElement The element we should insert the signature node before.
return DOMElement | null

validate() public method

true is returned on success, false is returned if we don't have any signature we can validate. An exception is thrown if the signature validation fails.
public validate ( XMLSecurityKey $key ) : boolean
$key RobRichards\XMLSecLibs\XMLSecurityKey The key we should check against.
return boolean true on success, false when we don't have a signature.