class Illuminate / Encryption / Encrypter
You are viewing an older version of the documentation. For the latest, please visit master documentation.

Encrypter

Implements

Properties

protected

$key string

The encryption key.

Default: null
protected

$cipher string

The algorithm used for encryption.

Default: null
private static

$supportedCiphers array

The supported cipher algorithms and their properties.

Default: array

Methods

public

__construct ( $key , $cipher ) : void

Create a new encrypter instance.

Parameters

  • $key string
  • $cipher string
public static

supported ( $key , $cipher ) : bool

Determine if the given key and cipher combination is valid.

Parameters

  • $key string
  • $cipher string
public static

generateKey ( $cipher ) : string

Create a new encryption key for the given cipher.

Parameters

  • $cipher string
public

encrypt ( $value , $serialize ) : string

Encrypt the given value.

Parameters

  • $value mixed
  • $serialize bool
public

encryptString ( $value ) : string

Encrypt a string without serialization.

Parameters

  • $value string
public

decrypt ( $payload , $unserialize ) : mixed

Decrypt the given value.

Parameters

  • $payload string
  • $unserialize bool
public

decryptString ( $payload ) : string

Decrypt the given string without unserialization.

Parameters

  • $payload string
protected

hash ( $iv , $value ) : string

Create a MAC for the given value.

Parameters

  • $iv string
  • $value mixed
protected

getJsonPayload ( $payload ) : array

Get the JSON array from the given payload.

Parameters

  • $payload string
protected

validPayload ( $payload ) : bool

Verify that the encryption payload is valid.

Parameters

  • $payload mixed
protected

validMac ( array $payload ) : bool

Determine if the MAC for the given payload is valid.

Parameters

  • $payload array
protected

ensureTagIsValid ( $tag ) : void

Ensure the given tag is a valid tag given the selected cipher.

Parameters

  • $tag string
public

getKey ( ) : string

Get the encryption key.