PHP Class ParagonIE\Halite\Asymmetric\Crypto

Mostrar archivo Open project: paragonie/halite Class Usage Examples

Public Methods

Method Description
decrypt ( string $ciphertext, EncryptionSecretKey $ourPrivateKey, EncryptionPublicKey $theirPublicKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : HiddenString Decrypt a string using asymmetric cryptography Wraps SymmetricCrypto::decrypt()
encrypt ( HiddenString $plaintext, EncryptionSecretKey $ourPrivateKey, EncryptionPublicKey $theirPublicKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : string Encrypt a string using asymmetric cryptography Wraps SymmetricCrypto::encrypt()
getSharedSecret ( EncryptionSecretKey $privateKey, EncryptionPublicKey $publicKey, boolean $get_as_object = false ) : HiddenString | Key Diffie-Hellman, ECDHE, etc.
seal ( HiddenString $plaintext, EncryptionPublicKey $publicKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : string Encrypt a message with a target users' public key
sign ( string $message, SignatureSecretKey $privateKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : string Sign a message with our private key
unseal ( string $ciphertext, EncryptionSecretKey $privateKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : HiddenString Decrypt a sealed message with our private key
verify ( string $message, SignaturePublicKey $publicKey, string $signature, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : boolean Verify a signed message with the correct public key

Private Methods

Method Description
__construct ( ) Don't allow this to be instantiated.

Method Details

decrypt() public static method

Decrypt a string using asymmetric cryptography Wraps SymmetricCrypto::decrypt()
public static decrypt ( string $ciphertext, EncryptionSecretKey $ourPrivateKey, EncryptionPublicKey $theirPublicKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : HiddenString
$ciphertext string The message to decrypt
$ourPrivateKey EncryptionSecretKey Our private key
$theirPublicKey EncryptionPublicKey Their public key
$encoding mixed Which encoding scheme to use?
return HiddenString The decrypted message

encrypt() public static method

Encrypt a string using asymmetric cryptography Wraps SymmetricCrypto::encrypt()
public static encrypt ( HiddenString $plaintext, EncryptionSecretKey $ourPrivateKey, EncryptionPublicKey $theirPublicKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : string
$plaintext HiddenString The message to encrypt
$ourPrivateKey EncryptionSecretKey Our private key
$theirPublicKey EncryptionPublicKey Their public key
$encoding mixed Which encoding scheme to use?
return string Ciphertext

getSharedSecret() public static method

Get a shared secret from a private key you possess and a public key for the intended message recipient
public static getSharedSecret ( EncryptionSecretKey $privateKey, EncryptionPublicKey $publicKey, boolean $get_as_object = false ) : HiddenString | Key
$privateKey EncryptionSecretKey
$publicKey EncryptionPublicKey
$get_as_object boolean Get as a Key object?
return HiddenString | Key

seal() public static method

Encrypt a message with a target users' public key
public static seal ( HiddenString $plaintext, EncryptionPublicKey $publicKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : string
$plaintext HiddenString Message to encrypt
$publicKey EncryptionPublicKey Public encryption key
$encoding mixed Which encoding scheme to use?
return string Ciphertext

sign() public static method

Sign a message with our private key
public static sign ( string $message, SignatureSecretKey $privateKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : string
$message string Message to sign
$privateKey SignatureSecretKey
$encoding mixed Which encoding scheme to use?
return string Signature (detached)

unseal() public static method

Decrypt a sealed message with our private key
public static unseal ( string $ciphertext, EncryptionSecretKey $privateKey, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : HiddenString
$ciphertext string Encrypted message
$privateKey EncryptionSecretKey
$encoding mixed Which encoding scheme to use?
return HiddenString

verify() public static method

Verify a signed message with the correct public key
public static verify ( string $message, SignaturePublicKey $publicKey, string $signature, mixed $encoding = Halite::ENCODE_BASE64URLSAFE ) : boolean
$message string Message to verify
$publicKey SignaturePublicKey
$signature string
$encoding mixed Which encoding scheme to use?
return boolean