Sec
class Sec
Class Sec
Constants
| JWT_ALG_HS256 |
|
| JWT_ALG_RS256 |
|
| JWT_ALG_UNSUPPORTED |
|
Methods
AES Counter Decryption (PHP Based)
AES Counter Encryption (PHP Based)
Calculate TOTP based on https://github.com/Dolondro/google-authenticator/blob/master/src/GoogleAuthenticator.php
Executes a given callback in CMD mode, thus circumventing any rights DO NOT USE LIGHTLY!!! This primarily aims at allowing reference and link resolval!
Make sure a filename does not contain any directory characters to prevent unallowed traversals
Generates a JWT Token.
Wrapper for pronouncable password
Generate pronouncable password
Returns a generated password string
Generates a Secret for TOTP Authentication
Determine JWT Algorithm
Check how good a password is (Score > 4 is acceptable, Score > 7 is good)
No description
Filter INPUT based on certain rules:
- XSS: Encode ALL Special Chars ('"<>& and chars with ASCII value less 32)
Takes an array and casts values / escapes values according to type
Will check the standard security criteria of the supplied JWT Token If no security (expiration, signature) is provided, this method will only decode the token
Check if this looks like a valid uuid (32 chars, hex only)
No description
No description
Sanitize/Convert HTML to Markdown
This function will automatically send common security headers which are applicable based on configuration and currently known environmnet
Send CSP Header
Send CSP Headers for files that are user uploads to prevent persistent XSS attacks when users upload files Function will send headers based on filetype and system configuration
Strict Transport Security Header tell the browser to always access this site via https
Details
at line 190
aes_decrypt($string, $key = false)
deprecated
deprecated
No description
at line 241
string
aes_decrypt_ctr(string $string, string $key = null)
AES Counter Decryption (PHP Based)
at line 178
string
aes_encrypt($string, $key = false)
deprecated
deprecated
encrypts a string and returns a binary string
at line 206
string
aes_encrypt_ctr(string $string, string $key = null)
AES Counter Encryption (PHP Based)
at line 414
string
calculate_totp_code($secret, null $timeSlice = null)
Calculate TOTP based on https://github.com/Dolondro/google-authenticator/blob/master/src/GoogleAuthenticator.php
at line 382
mixed
execute_circumventing_rights(Closure|callable $callback, array $params = [])
Executes a given callback in CMD mode, thus circumventing any rights DO NOT USE LIGHTLY!!! This primarily aims at allowing reference and link resolval!
at line 630
string|string[]
filename($filename)
Make sure a filename does not contain any directory characters to prevent unallowed traversals
at line 477
string
generateJWTToken(string $secret, User $user = null, array $customPayload = [])
Generates a JWT Token.
at line 263
string
generate_password(int $length = 8, int $strength = 7)
Wrapper for pronouncable password
at line 299
string
generate_pronouncable_password(int $length = 8, int $strength = 7)
Generate pronouncable password
at line 273
generate_random_password(int $length = 8, int $strength = 7)
Returns a generated password string
at line 445
string
generate_totp_secret()
Generates a Secret for TOTP Authentication
at line 517
static string|null
getJWTAlgorithm(string $JWT)
Determine JWT Algorithm
at line 343
int
get_password_score(mixed $password)
Check how good a password is (Score > 4 is acceptable, Score > 7 is good)
at line 16
init()
No description
at line 31
string|null
input(string $string, array $options = array('xss', 'sql'))
Filter INPUT based on certain rules:
- XSS: Encode ALL Special Chars ('"<>& and chars with ASCII value less 32)
at line 99
array
input_array(array $array, string $filterType = 'intcast')
Takes an array and casts values / escapes values according to type
at line 538
bool
isValidJWTToken(string $token, string|resource $secretOrPublicKeyInfo = null, string|null $alg = self::JWT_ALG_HS256, array $header = [], array $payload = [])
Will check the standard security criteria of the supplied JWT Token If no security (expiration, signature) is provided, this method will only decode the token
at line 754
bool
isValidUUID(string $uuid)
Check if this looks like a valid uuid (32 chars, hex only)
at line 462
iv_decrypt()
No description
at line 458
iv_encrypt($string)
No description
at line 143
string
sanitizeHtmlToMarkdown(string $htmlString, bool $allowImages = true, bool $allowHTML = false, bool $allowMentions = true)
Sanitize/Convert HTML to Markdown
at line 671
void
sendCommonSecurityHeaders()
This function will automatically send common security headers which are applicable based on configuration and currently known environmnet
at line 694
sendContentSecurityPolicyHeader()
Send CSP Header
at line 642
bool
sendContentSecurityPolicyHeaderForUserUpload(string $fileExtension = null)
Send CSP Headers for files that are user uploads to prevent persistent XSS attacks when users upload files Function will send headers based on filetype and system configuration
at line 740
void
sendStrictTransportSecurityHeader()
Strict Transport Security Header tell the browser to always access this site via https