Browse code

FIX: osetrenie zleho key/iv pri decryptovani cookies

Cinan Rakosnik authored on 15/04/2013 at 11:15:08
Showing 1 changed files
... ...
@@ -22,8 +22,14 @@ module Security
22 22
         cipher.key = @@cipher_key = key
23 23
         cipher.iv  = @@cipher_iv = iv
24 24
 
25
-        decrypted = cipher.update(encrypted_message)
26
-        decrypted << cipher.final
25
+        begin
26
+            decrypted = cipher.update(encrypted_message)
27
+            decrypted << cipher.final
28
+        rescue
29
+            decrypted = ''
30
+        end
31
+
32
+        decrypted
27 33
     end
28 34
 
29 35
     def self.generate_token()