Exemplo n.º 1
0
 public static function getResizedImageURL($imageServiceScheme, $imageServiceHost, $imageServicePort, $imageServicePath, $identifier, $keyName, $keyData, $width, $height, $separator = '|')
 {
     // Create the plaintext containing the current time and the Unumber requested
     $plaintext = time() . $separator . $identifier;
     //Encrypt the token
     $encryptedToken = UsfEncryption::encrypt($plaintext, $keyData);
     return $imageServiceScheme . '://' . $imageServiceHost . ':' . $imageServicePort . $imageServicePath . '/view/' . $keyName . '/' . $width . '/' . $height . '/' . urlencode($encryptedToken) . '.jpg';
 }
Exemplo n.º 2
0
 public function testDecrypt()
 {
     $key = '1234567891234567';
     $text = '1348339338|GEMS|127.0.0.1|EPIERCE';
     $encrypt = 'ruuamTBmln1hMdmVGazmk/Vw4x5raFpZGYOO5Yw+Ac6dpDtVWB6AmCfyJtWQVDbbhIIeae6OmDifMNR5AaD1S]Q==';
     $result = UsfEncryption::decrypt($key, $encrypt);
     $this->assertEquals($text, $result);
 }