PHP Class ParagonIE\Halite\KeyFactory

Afficher le fichier Open project: paragonie/halite Class Usage Examples

Méthodes publiques

Méthode Description
deriveAuthenticationKey ( HiddenString $password, string $salt, string $level = self::INTERACTIVE ) : AuthenticationKey Derive an authentication key (symmetric) from a password and salt
deriveEncryptionKey ( HiddenString $password, string $salt, string $level = self::INTERACTIVE ) : EncryptionKey Derive an encryption key (symmetric-key cryptography) from a password and salt
deriveEncryptionKeyPair ( HiddenString $password, string $salt, string $level = self::INTERACTIVE ) : EncryptionKeyPair Derive a key pair for public key encryption from a password and salt
deriveSignatureKeyPair ( HiddenString $password, string $salt, string $level = self::INTERACTIVE ) : SignatureKeyPair Derive a key pair for public key signatures from a password and salt
export ( $key ) : HiddenString Export a cryptography key to a string (with a checksum)
generateAuthenticationKey ( string &$secretKey = '' ) : AuthenticationKey Generate an an authentication key (symmetric-key cryptography)
generateEncryptionKey ( string &$secretKey = '' ) : EncryptionKey Generate an an encryption key (symmetric-key cryptography)
generateEncryptionKeyPair ( string &$secretKey = '' ) : EncryptionKeyPair Generate a key pair for public key encryption
generateSignatureKeyPair ( string &$secretKey = '' ) : SignatureKeyPair Generate a key pair for public key digital signatures
getKeyDataFromString ( string $data ) : string Take a stored key string, get the derived key (after verifying the checksum)
getSecurityLevels ( string $level = self::INTERACTIVE ) : array Returns a 2D array [OPSLIMIT, MEMLIMIT] for the appropriate security level.
importAuthenticationKey ( HiddenString $keyData ) : AuthenticationKey Load a symmetric authentication key from a string
importEncryptionKey ( HiddenString $keyData ) : EncryptionKey Load a symmetric encryption key from a string
importEncryptionKeyPair ( HiddenString $keyData ) : EncryptionKeyPair Load an asymmetric encryption key pair from a string
importEncryptionPublicKey ( HiddenString $keyData ) : EncryptionPublicKey Load, specifically, an encryption public key from a string
importEncryptionSecretKey ( HiddenString $keyData ) : EncryptionSecretKey Load, specifically, an encryption secret key from a string
importSignatureKeyPair ( HiddenString $keyData ) : SignatureKeyPair Load an asymmetric signature key pair from a string
importSignaturePublicKey ( HiddenString $keyData ) : SignaturePublicKey Load, specifically, a signature public key from a string
importSignatureSecretKey ( HiddenString $keyData ) : SignatureSecretKey Load, specifically, a signature secret key from a string
loadAuthenticationKey ( string $filePath ) : AuthenticationKey Load a symmetric authentication key from a file
loadEncryptionKey ( string $filePath ) : EncryptionKey Load a symmetric encryption key from a file
loadEncryptionKeyPair ( string $filePath ) : EncryptionKeyPair Load an asymmetric encryption key pair from a file
loadEncryptionPublicKey ( string $filePath ) : EncryptionPublicKey Load, specifically, an encryption public key from a file
loadEncryptionSecretKey ( string $filePath ) : EncryptionSecretKey Load, specifically, an encryption public key from a file
loadSignatureKeyPair ( string $filePath ) : SignatureKeyPair Load an asymmetric signature key pair from a file
loadSignaturePublicKey ( string $filePath ) : SignaturePublicKey Load, specifically, a signature public key from a file
loadSignatureSecretKey ( string $filePath ) : SignatureSecretKey Load, specifically, a signature secret key from a file
save ( Key | KeyPair $key, string $filename = '' ) : boolean Save a key to a file

Méthodes protégées

Méthode Description
loadKeyFile ( string $filePath ) : HiddenString Read a key from a file, verify its checksum
saveKeyFile ( string $filePath, string $keyData ) : boolean Save a key to a file

Method Details

deriveAuthenticationKey() public static méthode

Derive an authentication key (symmetric) from a password and salt
public static deriveAuthenticationKey ( HiddenString $password, string $salt, string $level = self::INTERACTIVE ) : AuthenticationKey
$password HiddenString
$salt string
$level string Security level for KDF
Résultat AuthenticationKey

deriveEncryptionKey() public static méthode

Derive an encryption key (symmetric-key cryptography) from a password and salt
public static deriveEncryptionKey ( HiddenString $password, string $salt, string $level = self::INTERACTIVE ) : EncryptionKey
$password HiddenString
$salt string
$level string Security level for KDF
Résultat EncryptionKey

deriveEncryptionKeyPair() public static méthode

Derive a key pair for public key encryption from a password and salt
public static deriveEncryptionKeyPair ( HiddenString $password, string $salt, string $level = self::INTERACTIVE ) : EncryptionKeyPair
$password HiddenString
$salt string
$level string Security level for KDF
Résultat EncryptionKeyPair

deriveSignatureKeyPair() public static méthode

Derive a key pair for public key signatures from a password and salt
public static deriveSignatureKeyPair ( HiddenString $password, string $salt, string $level = self::INTERACTIVE ) : SignatureKeyPair
$password HiddenString
$salt string
$level string Security level for KDF
Résultat SignatureKeyPair

export() public static méthode

Export a cryptography key to a string (with a checksum)
public static export ( $key ) : HiddenString
$key
Résultat HiddenString

generateAuthenticationKey() public static méthode

Generate an an authentication key (symmetric-key cryptography)
public static generateAuthenticationKey ( string &$secretKey = '' ) : AuthenticationKey
$secretKey string
Résultat AuthenticationKey

generateEncryptionKey() public static méthode

Generate an an encryption key (symmetric-key cryptography)
public static generateEncryptionKey ( string &$secretKey = '' ) : EncryptionKey
$secretKey string
Résultat EncryptionKey

generateEncryptionKeyPair() public static méthode

Generate a key pair for public key encryption
public static generateEncryptionKeyPair ( string &$secretKey = '' ) : EncryptionKeyPair
$secretKey string
Résultat EncryptionKeyPair

generateSignatureKeyPair() public static méthode

Generate a key pair for public key digital signatures
public static generateSignatureKeyPair ( string &$secretKey = '' ) : SignatureKeyPair
$secretKey string
Résultat SignatureKeyPair

getKeyDataFromString() public static méthode

Take a stored key string, get the derived key (after verifying the checksum)
public static getKeyDataFromString ( string $data ) : string
$data string
Résultat string

getSecurityLevels() public static méthode

Returns a 2D array [OPSLIMIT, MEMLIMIT] for the appropriate security level.
public static getSecurityLevels ( string $level = self::INTERACTIVE ) : array
$level string
Résultat array

importAuthenticationKey() public static méthode

Load a symmetric authentication key from a string
public static importAuthenticationKey ( HiddenString $keyData ) : AuthenticationKey
$keyData HiddenString
Résultat AuthenticationKey

importEncryptionKey() public static méthode

Load a symmetric encryption key from a string
public static importEncryptionKey ( HiddenString $keyData ) : EncryptionKey
$keyData HiddenString
Résultat EncryptionKey

importEncryptionKeyPair() public static méthode

Load an asymmetric encryption key pair from a string
public static importEncryptionKeyPair ( HiddenString $keyData ) : EncryptionKeyPair
$keyData HiddenString
Résultat EncryptionKeyPair

importEncryptionPublicKey() public static méthode

Load, specifically, an encryption public key from a string
public static importEncryptionPublicKey ( HiddenString $keyData ) : EncryptionPublicKey
$keyData HiddenString
Résultat EncryptionPublicKey

importEncryptionSecretKey() public static méthode

Load, specifically, an encryption secret key from a string
public static importEncryptionSecretKey ( HiddenString $keyData ) : EncryptionSecretKey
$keyData HiddenString
Résultat EncryptionSecretKey

importSignatureKeyPair() public static méthode

Load an asymmetric signature key pair from a string
public static importSignatureKeyPair ( HiddenString $keyData ) : SignatureKeyPair
$keyData HiddenString
Résultat SignatureKeyPair

importSignaturePublicKey() public static méthode

Load, specifically, a signature public key from a string
public static importSignaturePublicKey ( HiddenString $keyData ) : SignaturePublicKey
$keyData HiddenString
Résultat SignaturePublicKey

importSignatureSecretKey() public static méthode

Load, specifically, a signature secret key from a string
public static importSignatureSecretKey ( HiddenString $keyData ) : SignatureSecretKey
$keyData HiddenString
Résultat SignatureSecretKey

loadAuthenticationKey() public static méthode

Load a symmetric authentication key from a file
public static loadAuthenticationKey ( string $filePath ) : AuthenticationKey
$filePath string
Résultat AuthenticationKey

loadEncryptionKey() public static méthode

Load a symmetric encryption key from a file
public static loadEncryptionKey ( string $filePath ) : EncryptionKey
$filePath string
Résultat EncryptionKey

loadEncryptionKeyPair() public static méthode

Load an asymmetric encryption key pair from a file
public static loadEncryptionKeyPair ( string $filePath ) : EncryptionKeyPair
$filePath string
Résultat EncryptionKeyPair

loadEncryptionPublicKey() public static méthode

Load, specifically, an encryption public key from a file
public static loadEncryptionPublicKey ( string $filePath ) : EncryptionPublicKey
$filePath string
Résultat EncryptionPublicKey

loadEncryptionSecretKey() public static méthode

Load, specifically, an encryption public key from a file
public static loadEncryptionSecretKey ( string $filePath ) : EncryptionSecretKey
$filePath string
Résultat EncryptionSecretKey

loadKeyFile() protected static méthode

Read a key from a file, verify its checksum
protected static loadKeyFile ( string $filePath ) : HiddenString
$filePath string
Résultat HiddenString

loadSignatureKeyPair() public static méthode

Load an asymmetric signature key pair from a file
public static loadSignatureKeyPair ( string $filePath ) : SignatureKeyPair
$filePath string
Résultat SignatureKeyPair

loadSignaturePublicKey() public static méthode

Load, specifically, a signature public key from a file
public static loadSignaturePublicKey ( string $filePath ) : SignaturePublicKey
$filePath string
Résultat SignaturePublicKey

loadSignatureSecretKey() public static méthode

Load, specifically, a signature secret key from a file
public static loadSignatureSecretKey ( string $filePath ) : SignatureSecretKey
$filePath string
Résultat SignatureSecretKey

save() public static méthode

Save a key to a file
public static save ( Key | KeyPair $key, string $filename = '' ) : boolean
$key Key | KeyPair
$filename string
Résultat boolean

saveKeyFile() protected static méthode

Save a key to a file
protected static saveKeyFile ( string $filePath, string $keyData ) : boolean
$filePath string
$keyData string
Résultat boolean