SproutCMS

This is the code documentation for the SproutCMS project

class Security

Functions for implementing security, including secure random numbers

Extending this class

<?php
/**
* New class description goes here
* 
* @author Your Name, 2024-05-03
**/
class NewClassName extends Security {
    
    /**
    * Check the given password meets complexity requirements
    **/
    public function passwordComplexity (string $str, int $length, int $classes, bool $bad_list) {
        // Method code goes here
    }
    
    /**
    * Verify a signature which was generated by {@see Security::serverKeySign}
    **/
    public function serverKeyVerify (array $fields, string $signature) {
        // Method code goes here
    }
    
    /**
    * Return the server key
    **/
    protected function getServerKey () {
        // Method code goes here
    }
    
    /**
    * Generate a signature from a given set of fields, using the server key
    * 
    * For a given set of fields, the signature will always be the same value.
    * Returned signatures are always URL and HTML safe
    **/
    public function serverKeySign (array $fields) {
        // Method code goes here
    }
    
    /**
    * Returns a binary string of random bytes
    **/
    public function randBytes (int $length) {
        // Method code goes here
    }
    
    /**
    * Return a single random byte
    **/
    public function randByte () {
        // Method code goes here
    }
    
    /**
    * Returns a string of random characters
    **/
    public function randStr (int $length, $chars) {
        // Method code goes here
    }
    
    /**
    * Constant-time string comparison
    **/
    public function compareStrings (string $known_string, string $user_string) {
        // Method code goes here
    }
    
}
?>