Exemplo n.º 1
0
 /**
  * Decodes a given Base64 encoded string using the techniques and keys from the DynamicBaseObj.
  * @param string The encoded value
  * @return string The decoded value
  */
 public static final function decodeBase64($value)
 {
     return \System\Security\Base64Encoding::Base64Decode($value, self::ENCRYPTION_KEY);
 }
Exemplo n.º 2
0
 /**
  * Creates a fingerprint of the entire system and returns it as an encoded json string. This fingerprint only gives information about the system version.
  * By using this fingerprint, we can identify the versions used in the currently deployed build
  * Note that the used encryption is not a secure one.
  * @param string The key used to encode the resultset and generate the hashes. This key is required for decryption.
  * @return string The encoded fingerprint
  */
 public static final function getSystemFingerprint($encodeKey = \System\Version::FINGERPRINT_KEY)
 {
     $baseDir = PATH_SYSTEM;
     $files = \System\IO\Directory::walkDir($baseDir, new \System\Collection\Vector('php'));
     $map = new \System\Collection\Map();
     foreach ($files as $file) {
         $hash = new \System\Security\Hash(\System\Security\Hash::HASH_SHA512);
         $hash->addFile($file);
         $map[\System\Security\Base64Encoding::Base64Encode($file->stripBase(PATH_SYSTEM), $encodeKey)] = $hash->getHash();
     }
     $jsonObject = json_encode($map->getArrayCopy());
     $encoded = \System\Security\XOREncoding::XOREncrypt($jsonObject, $encodeKey);
     return $encoded;
 }