\CryptoManana\Core\Traits\MessageEncryptionCipherDataFormatsTrait

Trait CipherDataFormatsTrait - Reusable implementation of `CipherDataFormatsInterface`.

Summary

Methods
Properties
Constants
setCipherFormat()
getCipherFormat()
$$cipherFormat
No constants found
encryptionFormat()
decryptionFormatHex()
decryptionFormatBase64()
decryptionFormat()
changeOutputFormat()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$$cipherFormat

$$cipherFormat : integer

The output cipher format property storage.

Type

integer

Methods

setCipherFormat()

setCipherFormat(integer  $cipherFormat) : $this

Setter for the output cipher format code property.

Parameters

integer $cipherFormat

The output cipher format code.

Throws

\Exception

Validation errors.

Returns

$this —

The encryption algorithm object.

getCipherFormat()

getCipherFormat() : integer

Getter for the output cipher format code property.

Returns

integer —

The output cipher format code.

encryptionFormat()

encryptionFormat(string  $bytes) 

Internal method for converting format after encryption operations.

Parameters

string $bytes

The bytes for conversion.

decryptionFormatHex()

decryptionFormatHex(string  $bytes) 

Internal method for converting from HEX formatted string after decryption operations.

Parameters

string $bytes

The bytes for conversion.

decryptionFormatBase64()

decryptionFormatBase64(string  $bytes) 

Internal method for converting from Base64 formatted string after decryption operations.

Parameters

string $bytes

The bytes for conversion.

decryptionFormat()

decryptionFormat(string  $bytes) 

Internal method for converting format after decryption operations.

Parameters

string $bytes

The bytes for conversion.

changeOutputFormat()

changeOutputFormat(string  $bytes, boolean|integer|null  $direction = true) : string

Internal method for converting the output format representation via the chosen format.

Parameters

string $bytes

The bytes for conversion.

boolean|integer|null $direction

Flag for encryption direction (encrypt => true or decrypt => false).

Returns

string —

The formatted bytes.