fof/src/7f753585-6e3b-4b81-bd29-3b7...
Robot 3e0a3c65cc
update 2024-04-07 13:20:18
2024-04-07 13:20:18 +02:00
..
README.md update 2023-10-24 10:36:32 2023-10-24 10:36:32 +02:00
code.php update 2023-10-24 10:36:32 2023-10-24 10:36:32 +02:00
code.power update 2023-10-24 10:36:32 2023-10-24 10:36:32 +02:00
settings.json update 2024-04-07 13:20:18 2024-04-07 13:20:18 +02:00

README.md

██████╗  ██████╗ ██╗    ██╗███████╗██████╗
██╔══██╗██╔═══██╗██║    ██║██╔════╝██╔══██╗
██████╔╝██║   ██║██║ █╗ ██║█████╗  ██████╔╝
██╔═══╝ ██║   ██║██║███╗██║██╔══╝  ██╔══██╗
██║     ╚██████╔╝╚███╔███╔╝███████╗██║  ██║
╚═╝      ╚═════╝  ╚══╝╚══╝ ╚══════╝╚═╝  ╚═╝

interface AesInterface (Details)

namespace: VDM\Joomla\FOF\Encrypt\AES

@startuml
interface AesInterface  #Lavender {
  + setEncryptionMode(string $mode = 'cbc', int $strength = 128) : mixed
  + encrypt(string $plainText, string $key, ...) : string
  + decrypt(string $cipherText, string $key) : string
  + getBlockSize() : int
  + isSupported(Phpfunc $phpfunc = null) : bool
}

note right of AesInterface::setEncryptionMode
  Sets the AES encryption mode.
WARNING: The strength is deprecated as it has a different effect in MCrypt and OpenSSL. MCrypt was abandoned in
2003 before the Rijndael-128 algorithm was officially the Advanced Encryption Standard (AES). MCrypt also offered
Rijndael-192 and Rijndael-256 algorithms with different block sizes. These are NOT used in AES. OpenSSL, however,
implements AES correctly. It always uses a 128-bit (16 byte) block. The 192 and 256 bit strengths refer to the
key size, not the block size. Therefore using different strengths in MCrypt and OpenSSL will result in different
and incompatible ciphertexts.
TL;DR: Always use $strength = 128!

  return: mixed
end note

note right of AesInterface::encrypt
  Encrypts a string. Returns the raw binary ciphertext.
WARNING: The plaintext is zero-padded to the algorithm's block size. You are advised to store the size of the
plaintext and trim the string to that length upon decryption.

  return: string
  
  arguments:
    string $plainText
    string $key
    null|string $iv = null
end note

note right of AesInterface::decrypt
  Decrypts a string. Returns the raw binary plaintext.
$ciphertext MUST start with the IV followed by the ciphertext, even for EBC data (the first block of data is
dropped in EBC mode since there is no concept of IV in EBC).
WARNING: The returned plaintext is zero-padded to the algorithm's block size during encryption. You are advised
to trim the string to the original plaintext's length upon decryption. While rtrim($decrypted, "\0") sounds
appealing it's NOT the correct approach for binary data (zero bytes may actually be part of your plaintext, not
just padding!).

  return: string
end note

note right of AesInterface::getBlockSize
  Returns the encryption block size in bytes

  return: int
end note

note right of AesInterface::isSupported
  Is this adapter supported?

  return: bool
end note
 
@enduml

     ██╗ ██████╗██████╗
     ██║██╔════╝██╔══██╗
     ██║██║     ██████╔╝
██   ██║██║     ██╔══██╗
╚█████╔╝╚██████╗██████╔╝
 ╚════╝  ╚═════╝╚═════╝

Build with Joomla Component Builder