Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
encrypted_final_element Class Reference

Implementation of backup_final_element that provides symmetric-key AES-256 encryption of contents. More...

Inheritance diagram for encrypted_final_element:
backup_final_element base_final_element processable annotable base_atom

Public Member Functions

 __construct ($name, $attributes=null)
 Constructor - instantiates a encrypted_final_element, specifying its basic info.
 
 add_attributes ($attributes)
 
 annotate ($backupid)
 This function implements the annotation of the current value associating it with $itemname.
 
 clean_value ()
 
 clean_values ()
 
 destroy ()
 Destroy all circular references.
 
 get_attribute ($name)
 
 get_attributes ()
 Public API starts here.
 
 get_level ()
 
 get_name ()
 Public API starts here.
 
 get_parent ()
 
 get_value ()
 
 is_set ()
 
 process ($processor)
 This function will call to the corresponding processor method in other to make them perform the desired tasks.
 
 set_annotation_item ($itemname)
 This function sets the $itemname to be used when annotating.
 
 set_value ($value)
 Set the value of the field.
 
 to_string ($showvalue=false)
 

Protected Member Functions

 find_element_by_path ($path)
 
 find_first_parent_by_name ($name)
 
 get_grandoptigroupelement_or_grandparent ()
 
 get_grandparent ()
 
 get_new_attribute ($name)
 Returns one instace of the @base_attribute class to work with when attributes are added simply by name.
 
 set_key ($key)
 Set the encryption key manually, overriding default backup_encryptkey config.
 
 set_parent ($element)
 
 validate_name ($name)
 

Static Protected Member Functions

static generate_encryption_random_key ($bytes)
 Generate an appropiate random key to be used for encrypting backup information.
 

Protected Attributes

 $annotationitem
 
string $key = null
 cypher appropiate raw key for backups in the site.
 

Detailed Description

Implementation of backup_final_element that provides symmetric-key AES-256 encryption of contents.

This final element transparently encrypts, for secure storage and transport, any content that shouldn't be shown normally in plain text. Usually, passwords or keys that cannot use hashing algorithms, although potentially can encrypt any content. All information is encoded using base64.

Features:

  • requires openssl extension to work. Without it contents are completely omitted.
  • automatically creates an appropriate default key for the site and stores it into backup_encryptkey config (bas64 encoded).
  • uses a different appropriate init vector for every operation, which is transmited with the encrypted contents.
  • all generated data is base64 encoded for safe transmission.
  • automatically adds "encrypted" attribute for easier detection.
  • implements HMAC for providing integrity.
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Member Function Documentation

◆ add_attributes()

base_final_element::add_attributes ( $attributes)
inherited

Reimplemented in backup_optigroup_element, and base_optigroup.

◆ annotate()

backup_final_element::annotate ( $backupid)
inherited

This function implements the annotation of the current value associating it with $itemname.

Implements annotable.

◆ destroy()

base_final_element::destroy ( )
inherited

Destroy all circular references.

It helps PHP 5.2 a lot!

Reimplemented in base_nested_element.

◆ get_level()

base_final_element::get_level ( )
inherited

Reimplemented in backup_optigroup_element, and base_optigroup.

◆ get_new_attribute()

backup_final_element::get_new_attribute ( $name)
protectedinherited

Returns one instace of the @base_attribute class to work with when attributes are added simply by name.

Reimplemented from base_final_element.

◆ process()

backup_final_element::process ( $processor)
inherited

This function will call to the corresponding processor method in other to make them perform the desired tasks.

Implements processable.

◆ set_annotation_item()

backup_final_element::set_annotation_item ( $itemname)
inherited

This function sets the $itemname to be used when annotating.

Implements annotable.

◆ set_parent()

base_final_element::set_parent ( $element)
protectedinherited

Reimplemented in backup_optigroup_element, and base_optigroup.

◆ to_string()

base_final_element::to_string ( $showvalue = false)
inherited

Reimplemented from base_atom.


The documentation for this class was generated from the following file: