PHP Class ParagonIE\Halite\Asymmetric\Crypto

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

Méthodes publiques

Méthode 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

Méthode Description
__construct ( ) Don't allow this to be instantiated.

Method Details

decrypt() public static méthode

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?
Résultat HiddenString The decrypted message

encrypt() public static méthode

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?
Résultat string Ciphertext

getSharedSecret() public static méthode

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?
Résultat HiddenString | Key

seal() public static méthode

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?
Résultat string Ciphertext

sign() public static méthode

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?
Résultat string Signature (detached)

unseal() public static méthode

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?
Résultat HiddenString

verify() public static méthode

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?
Résultat boolean