Joomla Platform  13.1
Documentation des API du framework Joomla Platform
 Tout Classes Espaces de nommage Fichiers Fonctions Variables Pages
Référence de la classe JKeychain
+ Graphe d'héritage de JKeychain:
+ Graphe de collaboration de JKeychain:

Liste de tous les membres

Fonctions membres publiques

 createPassphraseFile ($passphrase, $passphraseFile, $privateKeyFile, $privateKeyPassphrase)
 deleteValue ($path)
 loadKeychain ($keychainFile, $passphraseFile, $publicKeyFile)
 saveKeychain ($keychainFile, $passphraseFile, $publicKeyFile)
- Fonctions membres publiques inherited from JRegistry
 __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"

Fonctions membres protégées

 getPassphraseFromFile ($passphraseFile, $publicKeyFile)
- Fonctions membres protégées inherited from JRegistry
 bindData ($parent, $data)
 asArray ($data)

Additional Inherited Members

- Fonctions membres publiques statiques inherited from JRegistry
static getInstance ($id)
- Attributs protégés inherited from JRegistry
 $data
- Attributs protégés statiques inherited from JRegistry
static $instances = array()

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$passphraseThe passphrase to store in the passphrase file.
string$passphraseFilePath to the passphrase file to create.
string$privateKeyFilePath to the private key file to encrypt the passphrase file.
string$privateKeyPassphraseThe passphrase for the private key.
Renvoie:
boolean Result of writing the passphrase file to disk.
Depuis:
12.3
Exceptions:
RuntimeException

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$pathRegistry 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;
// Explode the registry path into an array
$nodes = explode('.', $path);
if ($nodes)
{
// Initialize the current node to be the registry root.
$node = $this->data;
// Traverse the registry to find the correct node for the result.
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];
}
// Get the old value if exists so we can return it
$result = $node->$nodes[$i];
unset($node->$nodes[$i]);
}
return $result;
}
JKeychain::getPassphraseFromFile (   $passphraseFile,
  $publicKeyFile 
)
protected

Get the passphrase for this keychain

Paramètres:
string$passphraseFileThe file containing the passphrase to encrypt and decrypt.
string$publicKeyFileThe file containing the public key to decrypt the passphrase file.
Renvoie:
string The passphrase in from passphraseFile
Depuis:
12.3
Exceptions:
RuntimeException

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$keychainFilePath to the keychain file.
string$passphraseFileThe path to the passphrase file to decript the keychain.
string$publicKeyFileThe file containing the public key to decrypt the passphrase file.
Renvoie:
boolean Result of loading the object.
Depuis:
12.3
Exceptions:
RuntimeException

Définition à la ligne 116 du fichier keychain.php.

{
if (!file_exists($keychainFile))
{
throw new RuntimeException('Attempting to load non-existent keychain file');
}
$passphrase = $this->getPassphraseFromFile($passphraseFile, $publicKeyFile);
$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$keychainFileThe path to the keychain file.
string$passphraseFileThe path to the passphrase file to encrypt the keychain.
string$publicKeyFileThe file containing the public key to decrypt the passphrase file.
Renvoie:
boolean Result of storing the file.
Depuis:
12.3
Exceptions:
RuntimeException

Définition à la ligne 146 du fichier keychain.php.

{
$passphrase = $this->getPassphraseFromFile($passphraseFile, $publicKeyFile);
$data = $this->toString('JSON');
$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"

Définition à la ligne 31 du fichier keychain.php.

JKeychain::$method = 'aes-128-cbc'

Définition à la ligne 25 du fichier keychain.php.


La documentation de cette classe a été générée à partir du fichier suivant :