try { $this->
loadKeys();
} catch (\RuntimeException
) { // ignore failures to load keys
} if ('' !==
$this->decryptionKey && !
is_file($this->pathPrefix.'encrypt.public.php'
)) { $this->
export('encrypt.public',
$this->encryptionKey
);
} if (!
$override && null !==
$this->encryptionKey
) { $this->lastMessage =
sprintf('Sodium keys already exist at "%s*.{public,private}" and won\'t be overridden.',
$this->
getPrettyPath($this->pathPrefix
));
return false;
} $this->decryptionKey =
sodium_crypto_box_keypair();
$this->encryptionKey =
sodium_crypto_box_publickey($this->decryptionKey
);
$this->
export('encrypt.public',
$this->encryptionKey
);
$this->
export('decrypt.private',
$this->decryptionKey
);
$this->lastMessage =
sprintf('Sodium keys have been generated at "%s*.public/private.php".',
$this->
getPrettyPath($this->pathPrefix
));