diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-13 03:54:09 +0000 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2008-08-13 03:54:09 +0000 |
commit | 8e9910e7456cb1bb128fefc776e1387619c9f47e (patch) | |
tree | 16f877ac1feb3a713fb3fdb482ef057761e5079d | |
parent | 9c7e9acc5c17acf42193efacb8e8183e28c2e402 (diff) | |
download | instadisc-8e9910e7456cb1bb128fefc776e1387619c9f47e.tar.gz instadisc-8e9910e7456cb1bb128fefc776e1387619c9f47e.tar.bz2 instadisc-8e9910e7456cb1bb128fefc776e1387619c9f47e.zip |
Update: Fixed encryption sequence
Previously, even after the key generation bug ([127]) was fixed, the Client was still failing to decrypt properly. However, the first field, Title, decrypted perfectly, so it was discovered that while the Client reset the Cipher object after every decryption, the Update Server did not reset MCrypt after every enryption. This has been fixed. Refs #10
-rw-r--r-- | update/library/trunk/instadisc.php | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/update/library/trunk/instadisc.php b/update/library/trunk/instadisc.php index 6cf5e09..bfc1101 100644 --- a/update/library/trunk/instadisc.php +++ b/update/library/trunk/instadisc.php | |||
@@ -35,7 +35,7 @@ function instaDisc_sendItem($id, $title, $author, $url, $semantics) | |||
35 | 35 | ||
36 | function instaDisc_sendEncrypted($id, $title, $author, $url, $semantics) | 36 | function instaDisc_sendEncrypted($id, $title, $author, $url, $semantics) |
37 | { | 37 | { |
38 | global $idusEncryptionKey; | 38 | global $idusUsername, $idusPassword, $idusCentralServer, $idusSubscriptionURI, $idusEncryptionKey; |
39 | 39 | ||
40 | $encID = 0; | 40 | $encID = 0; |
41 | while ($encID == 0) | 41 | while ($encID == 0) |
@@ -48,17 +48,26 @@ function instaDisc_sendEncrypted($id, $title, $author, $url, $semantics) | |||
48 | $key = substr(md5(substr(str_pad($idusEncryptionKey[$id],16,$encID),0,16)),0,16); | 48 | $key = substr(md5(substr(str_pad($idusEncryptionKey[$id],16,$encID),0,16)),0,16); |
49 | 49 | ||
50 | $td = mcrypt_module_open($cipher, "", $mode, ""); | 50 | $td = mcrypt_module_open($cipher, "", $mode, ""); |
51 | |||
51 | mcrypt_generic_init($td, $key, strrev($key)); | 52 | mcrypt_generic_init($td, $key, strrev($key)); |
52 | $title = bin2hex(mcrypt_generic($td, $title)); | 53 | $title = bin2hex(mcrypt_generic($td, $title)); |
54 | mcrypt_generic_deinit($td); | ||
55 | |||
56 | mcrypt_generic_init($td, $key, strrev($key)); | ||
53 | $author = bin2hex(mcrypt_generic($td, $author)); | 57 | $author = bin2hex(mcrypt_generic($td, $author)); |
58 | mcrypt_generic_deinit($td); | ||
59 | |||
60 | mcrypt_generic_init($td, $key, strrev($key)); | ||
54 | $url = bin2hex(mcrypt_generic($td, $url)); | 61 | $url = bin2hex(mcrypt_generic($td, $url)); |
62 | mcrypt_generic_deinit($td); | ||
55 | 63 | ||
56 | foreach ($semantics as $name => $value) | 64 | foreach ($semantics as $name => $value) |
57 | { | 65 | { |
66 | mcrypt_generic_init($td, $key, strrev($key)); | ||
58 | $semantics[$name] = bin2hex(mcrypt_generic($td, $value)); | 67 | $semantics[$name] = bin2hex(mcrypt_generic($td, $value)); |
68 | mcrypt_generic_deinit($td); | ||
59 | } | 69 | } |
60 | 70 | ||
61 | mcrypt_generic_deinit($td); | ||
62 | mcrypt_module_close($td); | 71 | mcrypt_module_close($td); |
63 | 72 | ||
64 | $verID = rand(1,65536); | 73 | $verID = rand(1,65536); |