\Defuse\CryptoKeyProtectedByPassword

Summary

Methods
Properties
Constants
createRandomPasswordProtectedKey()
loadFromAsciiSafeString()
saveToAsciiSafeString()
unlockKey()
No public properties found
PASSWORD_KEY_CURRENT_VERSION
No protected methods found
No protected properties found
N/A
__construct()
$encrypted_key
N/A

Constants

PASSWORD_KEY_CURRENT_VERSION

PASSWORD_KEY_CURRENT_VERSION

Properties

$encrypted_key

$encrypted_key : string

Type

string

Methods

createRandomPasswordProtectedKey()

createRandomPasswordProtectedKey(string  $password) : \Defuse\Crypto\KeyProtectedByPassword

Creates a random key protected by the provided password.

Parameters

string $password

Throws

\Defuse\Crypto\Exception\EnvironmentIsBrokenException

Returns

\Defuse\Crypto\KeyProtectedByPassword

loadFromAsciiSafeString()

loadFromAsciiSafeString(string  $saved_key_string) : \Defuse\Crypto\KeyProtectedByPassword

Loads a KeyProtectedByPassword from its encoded form.

Parameters

string $saved_key_string

Throws

\Defuse\Crypto\Exception\BadFormatException

Returns

\Defuse\Crypto\KeyProtectedByPassword

saveToAsciiSafeString()

saveToAsciiSafeString() : string

Encodes the KeyProtectedByPassword into a string of printable ASCII characters.

Throws

\Defuse\Crypto\Exception\EnvironmentIsBrokenException

Returns

string

unlockKey()

unlockKey(string  $password) : \Defuse\Crypto\Key

Decrypts the protected key, returning an unprotected Key object that can be used for encryption and decryption.

Parameters

string $password

Throws

\Defuse\Crypto\Exception\EnvironmentIsBrokenException
\Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException

Returns

\Defuse\Crypto\Key

__construct()

__construct(string  $encrypted_key) 

Constructor for KeyProtectedByPassword.

Parameters

string $encrypted_key