PHP 클래스 ParagonIE\Halite\Symmetric\Crypto

파일 보기 프로젝트 열기: paragonie/halite 1 사용 예제들

공개 메소드들

메소드 설명
authenticate ( string $message, AuthenticationKey $secretKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : string Authenticate a string
decrypt ( string $ciphertext, EncryptionKey $secretKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : HiddenString Decrypt a message using the Halite encryption protocol
encrypt ( HiddenString $plaintext, EncryptionKey $secretKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : string Encrypt a message using the Halite encryption protocol
splitKeys ( EncryptionKey $master, string $salt = '', BaseConfig $config = null ) : array Split a key (using HKDF-BLAKE2b instead of HKDF-HMAC-*)
unpackMessageForDecryption ( string $ciphertext ) : array Unpack a message string into an array (assigned to variables via list()).
verify ( string $message, AuthenticationKey $secretKey, string $mac, mixed $encoding = Halite::ENCODE_BASE64URLSAFE, SymmetricConfig $config = null ) : boolean Verify the authenticity of a message, given a shared MAC key

보호된 메소드들

메소드 설명
calculateMAC ( string $message, string $authKey, SymmetricConfig $config ) : string Calculate a MAC. This is used internally.
verifyMAC ( string $mac, string $message, string $authKey, SymmetricConfig $config ) : boolean Verify a Message Authentication Code (MAC) of a message, with a shared key.

비공개 메소드들

메소드 설명
__construct ( ) Don't allow this to be instantiated.

메소드 상세

authenticate() 공개 정적인 메소드

Authenticate a string
public static authenticate ( string $message, AuthenticationKey $secretKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : string
$message string
$secretKey AuthenticationKey
$encoding mixed
리턴 string

calculateMAC() 보호된 정적인 메소드

Calculate a MAC. This is used internally.
protected static calculateMAC ( string $message, string $authKey, SymmetricConfig $config ) : string
$message string
$authKey string
$config SymmetricConfig
리턴 string

decrypt() 공개 정적인 메소드

Decrypt a message using the Halite encryption protocol
public static decrypt ( string $ciphertext, EncryptionKey $secretKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : HiddenString
$ciphertext string
$secretKey EncryptionKey
$encoding mixed
리턴 HiddenString

encrypt() 공개 정적인 메소드

(Encrypt then MAC -- xsalsa20 then keyed-Blake2b) You don't need to worry about chosen-ciphertext attacks.
public static encrypt ( HiddenString $plaintext, EncryptionKey $secretKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : string
$plaintext HiddenString
$secretKey EncryptionKey
$encoding mixed
리턴 string

splitKeys() 공개 정적인 메소드

Split a key (using HKDF-BLAKE2b instead of HKDF-HMAC-*)
public static splitKeys ( EncryptionKey $master, string $salt = '', BaseConfig $config = null ) : array
$master EncryptionKey
$salt string
$config BaseConfig
리턴 array

unpackMessageForDecryption() 공개 정적인 메소드

Should return exactly 6 elements.
public static unpackMessageForDecryption ( string $ciphertext ) : array
$ciphertext string
리턴 array

verify() 공개 정적인 메소드

Verify the authenticity of a message, given a shared MAC key
public static verify ( string $message, AuthenticationKey $secretKey, string $mac, mixed $encoding = Halite::ENCODE_BASE64URLSAFE, SymmetricConfig $config = null ) : boolean
$message string
$secretKey AuthenticationKey
$mac string
$encoding mixed
$config SymmetricConfig
리턴 boolean

verifyMAC() 보호된 정적인 메소드

Verify a Message Authentication Code (MAC) of a message, with a shared key.
protected static verifyMAC ( string $mac, string $message, string $authKey, SymmetricConfig $config ) : boolean
$mac string Message Authentication Code
$message string The message to verify
$authKey string Authentication key (symmetric)
$config SymmetricConfig Configuration object
리턴 boolean