ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
SAML2\Certificate\PrivateKeyLoader Class Reference
+ Collaboration diagram for SAML2\Certificate\PrivateKeyLoader:

Public Member Functions

 loadPrivateKey (PrivateKeyConfiguration $key)
 Loads a private key based on the configuration given. More...
 
 loadDecryptionKeys (DecryptionProvider $identityProvider, DecryptionProvider $serviceProvider)
 

Private Member Functions

 convertPrivateKeyToRsaKey (PrivateKey $privateKey)
 

Detailed Description

Definition at line 11 of file PrivateKeyLoader.php.

Member Function Documentation

◆ convertPrivateKeyToRsaKey()

SAML2\Certificate\PrivateKeyLoader::convertPrivateKeyToRsaKey ( PrivateKey  $privateKey)
private
Parameters
\SAML2\Certificate\PrivateKey$privateKey
Returns
XMLSecurityKey
Exceptions

Definition at line 68 of file PrivateKeyLoader.php.

References $key, SAML2\Certificate\PrivateKey\getKeyAsString(), SAML2\Certificate\PrivateKey\getPassphrase(), and RobRichards\XMLSecLibs\XMLSecurityKey\RSA_1_5.

Referenced by SAML2\Certificate\PrivateKeyLoader\loadDecryptionKeys().

69  {
70  $key = new XMLSecurityKey(XMLSecurityKey::RSA_1_5, array('type' => 'private'));
71  $passphrase = $privateKey->getPassphrase();
72  if ($passphrase) {
73  $key->passphrase = $passphrase;
74  }
75 
76  $key->loadKey($privateKey->getKeyAsString());
77 
78  return $key;
79  }
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadDecryptionKeys()

SAML2\Certificate\PrivateKeyLoader::loadDecryptionKeys ( DecryptionProvider  $identityProvider,
DecryptionProvider  $serviceProvider 
)
Parameters
\SAML2\Configuration\DecryptionProvider$identityProvider
\SAML2\Configuration\DecryptionProvider$serviceProvider
Returns
Exceptions

Definition at line 34 of file PrivateKeyLoader.php.

References $key, RobRichards\XMLSecLibs\XMLSecurityKey\AES128_CBC, SAML2\Certificate\PrivateKeyLoader\convertPrivateKeyToRsaKey(), SAML2\Configuration\DecryptionProvider\getPrivateKey(), SAML2\Configuration\DecryptionProvider\getSharedKey(), and SAML2\Certificate\PrivateKeyLoader\loadPrivateKey().

37  {
38  $decryptionKeys = new ArrayCollection();
39 
40  $senderSharedKey = $identityProvider->getSharedKey();
41  if ($senderSharedKey) {
42  $key = new XMLSecurityKey(XMLSecurityKey::AES128_CBC);
43  $key->loadKey($senderSharedKey);
44  $decryptionKeys->add($key);
45 
46  return $decryptionKeys;
47  }
48 
49  $newPrivateKey = $serviceProvider->getPrivateKey(PrivateKeyConfiguration::NAME_NEW);
50  if ($newPrivateKey instanceof PrivateKeyConfiguration) {
51  $loadedKey = $this->loadPrivateKey($newPrivateKey);
52  $decryptionKeys->add($this->convertPrivateKeyToRsaKey($loadedKey));
53  }
54 
55  $privateKey = $serviceProvider->getPrivateKey(PrivateKeyConfiguration::NAME_DEFAULT, true);
56  $loadedKey = $this->loadPrivateKey($privateKey);
57  $decryptionKeys->add($this->convertPrivateKeyToRsaKey($loadedKey));
58 
59  return $decryptionKeys;
60  }
convertPrivateKeyToRsaKey(PrivateKey $privateKey)
loadPrivateKey(PrivateKeyConfiguration $key)
Loads a private key based on the configuration given.
$key
Definition: croninfo.php:18
+ Here is the call graph for this function:

◆ loadPrivateKey()

SAML2\Certificate\PrivateKeyLoader::loadPrivateKey ( PrivateKeyConfiguration  $key)

Loads a private key based on the configuration given.

Parameters
\SAML2\Configuration\PrivateKey$key
Returns

Definition at line 20 of file PrivateKeyLoader.php.

References SAML2\Certificate\PrivateKey\create(), and SAML2\Utilities\File\getFileContents().

Referenced by SAML2\Certificate\PrivateKeyLoader\loadDecryptionKeys().

21  {
22  $privateKey = File::getFileContents($key->getFilePath());
23 
24  return PrivateKey::create($privateKey, $key->getPassPhrase());
25  }
static getFileContents($file)
Definition: File.php:18
$key
Definition: croninfo.php:18
static create($keyContents, $passphrase=null)
Definition: PrivateKey.php:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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