Liste de tous les membres
Fonctions membres publiques |
| createPassphraseFile ($passphrase, $passphraseFile, $privateKeyFile, $privateKeyPassphrase) |
| deleteValue ($path) |
| loadKeychain ($keychainFile, $passphraseFile, $publicKeyFile) |
| saveKeychain ($keychainFile, $passphraseFile, $publicKeyFile) |
| __construct ($data=null) |
| __clone () |
| __toString () |
| jsonSerialize () |
| def ($key, $default= '') |
| exists ($path) |
| get ($path, $default=null) |
| loadArray ($array) |
| loadObject ($object) |
| loadFile ($file, $format= 'JSON', $options=array()) |
| loadString ($data, $format= 'JSON', $options=array()) |
| merge ($source) |
| set ($path, $value) |
| toArray () |
| toObject () |
| toString ($format= 'JSON', $options=array()) |
Attributs publics |
| $method = 'aes-128-cbc' |
| $iv = "1234567890123456" |
Description détaillée
Définition à la ligne 19 du fichier keychain.php.
Documentation des fonctions membres
JKeychain::createPassphraseFile |
( |
|
$passphrase, |
|
|
|
$passphraseFile, |
|
|
|
$privateKeyFile, |
|
|
|
$privateKeyPassphrase |
|
) |
| |
Create a passphrase file
- Paramètres:
-
string | $passphrase | The passphrase to store in the passphrase file. |
string | $passphraseFile | Path to the passphrase file to create. |
string | $privateKeyFile | Path to the private key file to encrypt the passphrase file. |
string | $privateKeyPassphrase | The passphrase for the private key. |
- Renvoie:
- boolean Result of writing the passphrase file to disk.
- Depuis:
- 12.3
- Exceptions:
-
Définition à la ligne 46 du fichier keychain.php.
{
$privateKey = openssl_get_privatekey(file_get_contents($privateKeyFile), $privateKeyPassphrase);
if (!$privateKey)
{
throw new RuntimeException("Failed to load private key.");
}
$crypted = '';
if (!openssl_private_encrypt($passphrase, $crypted, $privateKey))
{
throw new RuntimeException("Failed to encrypt data using private key.");
}
return file_put_contents($passphraseFile, $crypted);
}
JKeychain::deleteValue |
( |
|
$path | ) |
|
Delete a registry value (very simple method)
- Paramètres:
-
string | $path | Registry Path (e.g. joomla.content.showauthor) |
- Renvoie:
- mixed Value of old value or boolean false if operation failed
- Depuis:
- 12.3
Définition à la ligne 74 du fichier keychain.php.
{
$result = null;
$nodes = explode('.', $path);
if ($nodes)
{
for ($i = 0, $n = count($nodes) - 1; $i < $n; $i++)
{
if (!isset($node->$nodes[$i]) && ($i != $n))
{
$node->$nodes[$i] = new stdClass;
}
$node = $node->$nodes[$i];
}
$result = $node->$nodes[$i];
unset($node->$nodes[$i]);
}
return $result;
}
JKeychain::getPassphraseFromFile |
( |
|
$passphraseFile, |
|
|
|
$publicKeyFile |
|
) |
| |
|
protected |
Get the passphrase for this keychain
- Paramètres:
-
string | $passphraseFile | The file containing the passphrase to encrypt and decrypt. |
string | $publicKeyFile | The file containing the public key to decrypt the passphrase file. |
- Renvoie:
- string The passphrase in from passphraseFile
- Depuis:
- 12.3
- Exceptions:
-
Définition à la ligne 172 du fichier keychain.php.
{
if (!file_exists($publicKeyFile))
{
throw new RuntimeException('Missing public key file');
}
$publicKey = openssl_get_publickey(file_get_contents($publicKeyFile));
if (!$publicKey)
{
throw new RuntimeException("Failed to load public key.");
}
if (!file_exists($passphraseFile))
{
throw new RuntimeException('Missing passphrase file');
}
$passphrase = '';
if (!openssl_public_decrypt(file_get_contents($passphraseFile), $passphrase, $publicKey))
{
throw new RuntimeException('Failed to decrypt passphrase file');
}
return $passphrase;
}
JKeychain::loadKeychain |
( |
|
$keychainFile, |
|
|
|
$passphraseFile, |
|
|
|
$publicKeyFile |
|
) |
| |
Load a keychain file into this object.
- Paramètres:
-
string | $keychainFile | Path to the keychain file. |
string | $passphraseFile | The path to the passphrase file to decript the keychain. |
string | $publicKeyFile | The file containing the public key to decrypt the passphrase file. |
- Renvoie:
- boolean Result of loading the object.
- Depuis:
- 12.3
- Exceptions:
-
Définition à la ligne 116 du fichier keychain.php.
{
if (!file_exists($keychainFile))
{
throw new RuntimeException('Attempting to load non-existent keychain file');
}
$cleartext = openssl_decrypt(file_get_contents($keychainFile), $this->method, $passphrase, true, $this->iv);
if ($cleartext === false)
{
throw new RuntimeException("Failed to decrypt keychain file");
}
return $this->
loadObject(json_decode($cleartext));
}
JKeychain::saveKeychain |
( |
|
$keychainFile, |
|
|
|
$passphraseFile, |
|
|
|
$publicKeyFile |
|
) |
| |
Save this keychain to a file.
- Paramètres:
-
string | $keychainFile | The path to the keychain file. |
string | $passphraseFile | The path to the passphrase file to encrypt the keychain. |
string | $publicKeyFile | The file containing the public key to decrypt the passphrase file. |
- Renvoie:
- boolean Result of storing the file.
- Depuis:
- 12.3
- Exceptions:
-
Définition à la ligne 146 du fichier keychain.php.
{
$encrypted = @openssl_encrypt(
$data, $this->method, $passphrase,
true, $this->iv);
if ($encrypted === false)
{
throw new RuntimeException('Unable to encrypt keychain');
}
return file_put_contents($keychainFile, $encrypted);
}
Documentation des données membres
JKeychain::$iv = "1234567890123456" |
JKeychain::$method = 'aes-128-cbc' |
La documentation de cette classe a été générée à partir du fichier suivant :