ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
SAML2\Certificate\Key Class Reference

Simple DTO wrapper for (X509) keys. More...

+ Inheritance diagram for SAML2\Certificate\Key:
+ Collaboration diagram for SAML2\Certificate\Key:

Public Member Functions

 __construct (array $keyData)
 
 canBeUsedFor ($usage)
 Whether or not the key is configured to be used for usage given. More...
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 

Static Public Member Functions

static getValidKeyUsages ()
 Returns the list of valid key usage options. More...
 

Data Fields

const USAGE_SIGNING = 'signing'
 
const USAGE_ENCRYPTION = 'encryption'
 

Protected Member Functions

 assertIsString ($test)
 Asserts that the parameter is of type string. More...
 

Protected Attributes

 $keyData = array()
 

Detailed Description

Simple DTO wrapper for (X509) keys.

Implements ArrayAccess for easier backwards compatibility.

Definition at line 12 of file Key.php.

Constructor & Destructor Documentation

◆ __construct()

SAML2\Certificate\Key::__construct ( array  $keyData)
Parameters
array$keyData

Definition at line 26 of file Key.php.

References SAML2\Certificate\Key\offsetSet().

27  {
28  // forcing usage of offsetSet
29  foreach ($keyData as $property => $value) {
30  $this->offsetSet($property, $value);
31  }
32  }
offsetSet($offset, $value)
Definition: Key.php:73
+ Here is the call graph for this function:

Member Function Documentation

◆ assertIsString()

SAML2\Certificate\Key::assertIsString (   $test)
protected

Asserts that the parameter is of type string.

Parameters
mixed$test
Exceptions

Definition at line 93 of file Key.php.

References $test, and SAML2\Exception\InvalidArgumentException\invalidType().

Referenced by SAML2\Certificate\Key\offsetGet(), SAML2\Certificate\Key\offsetSet(), and SAML2\Certificate\Key\offsetUnset().

94  {
95  if (!is_string($test)) {
97  }
98  }
$test
Definition: Utf8Test.php:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ canBeUsedFor()

SAML2\Certificate\Key::canBeUsedFor (   $usage)

Whether or not the key is configured to be used for usage given.

Parameters
string$usage
Returns
bool

Definition at line 40 of file Key.php.

41  {
42  if (!in_array($usage, static::getValidKeyUsages())) {
43  throw new InvalidKeyUsageException($usage);
44  }
45 
46  return isset($this->keyData[$usage]) && $this->keyData[$usage];
47  }

◆ getValidKeyUsages()

static SAML2\Certificate\Key::getValidKeyUsages ( )
static

Returns the list of valid key usage options.

Returns
array

Definition at line 53 of file Key.php.

References array.

Referenced by SAML2\Certificate\Exception\InvalidKeyUsageException\__construct().

54  {
55  return array(
56  self::USAGE_ENCRYPTION,
57  self::USAGE_SIGNING
58  );
59  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ offsetExists()

SAML2\Certificate\Key::offsetExists (   $offset)

Definition at line 61 of file Key.php.

62  {
63  return array_key_exists($offset, $this->keyData);
64  }

◆ offsetGet()

SAML2\Certificate\Key::offsetGet (   $offset)

Definition at line 66 of file Key.php.

References SAML2\Certificate\Key\assertIsString().

67  {
68  $this->assertIsString($offset);
69 
70  return $this->keyData[$offset];
71  }
assertIsString($test)
Asserts that the parameter is of type string.
Definition: Key.php:93
+ Here is the call graph for this function:

◆ offsetSet()

SAML2\Certificate\Key::offsetSet (   $offset,
  $value 
)

Definition at line 73 of file Key.php.

References SAML2\Certificate\Key\assertIsString().

Referenced by SAML2\Certificate\Key\__construct().

74  {
75  $this->assertIsString($offset);
76 
77  $this->keyData[$offset] = $value;
78  }
assertIsString($test)
Asserts that the parameter is of type string.
Definition: Key.php:93
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ offsetUnset()

SAML2\Certificate\Key::offsetUnset (   $offset)

Definition at line 80 of file Key.php.

References SAML2\Certificate\Key\assertIsString().

81  {
82  $this->assertIsString($offset);
83 
84  unset($this->keyData[$offset]);
85  }
assertIsString($test)
Asserts that the parameter is of type string.
Definition: Key.php:93
+ Here is the call graph for this function:

Field Documentation

◆ $keyData

SAML2\Certificate\Key::$keyData = array()
protected

Definition at line 21 of file Key.php.

Referenced by SAML2\Certificate\PrivateKey\create().

◆ USAGE_ENCRYPTION

const SAML2\Certificate\Key::USAGE_ENCRYPTION = 'encryption'

Definition at line 16 of file Key.php.

◆ USAGE_SIGNING

const SAML2\Certificate\Key::USAGE_SIGNING = 'signing'

Definition at line 15 of file Key.php.


The documentation for this class was generated from the following file: