From adfe0d98928de9f4a1acf119c2d76062209b199d Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Thu, 7 Aug 2008 01:50:18 +0000 Subject: Update: Added password-protection support to the library Using the new instaDisc_sendEncrypted() function and the $idusEncryptionPassword variable, you can now feed password-protected subscriptions. However, a Subscription File will have to be automatically generated to support the password-protection. Refs #10 --- update/library/trunk/instadisc.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/update/library/trunk/instadisc.php b/update/library/trunk/instadisc.php index 3bef5e4..f256fb2 100644 --- a/update/library/trunk/instadisc.php +++ b/update/library/trunk/instadisc.php @@ -8,6 +8,7 @@ $idusUsername = ''; // Set this to the username you've registered $idusPassword = ''; // Set this to the password you've registered $idusCentralServer = ''; // Set this to the Central Server you've signed up with $idusSubscriptionURI = ''; // Set this to your unique URI +$idusEncryptionPassword = ''; // If creating a password-protected subscription, enter your password here function instaDisc_sendItem($title, $author, $url, $semantics) { @@ -26,4 +27,26 @@ function instaDisc_sendItem($title, $author, $url, $semantics) $client->send($msg); } +function instaDisc_sendEncrypted($title, $author, $url, $semantics) +{ + $cipher = "rijndael-128"; + $mode = "cbc"; + $iv = "fedcba9876543210"; + + $td = mcrypt_module_open($cipher, "", $mode, $iv); + mcrypt_generic_init($td, $idusEncryptionPassword, $iv); + $title = bin2hex(mcrypt_generic($td, $title)); + $author = bin2hex(mcrypt_generic($td, $author)); + $url = bin2hex(mcrypt_generic($td, $url)); + foreach ($semantics as $name => $value) + { + $semantics[$name] = bin2hex(mcrypt_generic($td, $value)); + } + + mcrypt_generic_deinit($td); + mcrypt_module_close($td); + + instaDisc_sendItem($title, $author, $url, $semantics); +} + ?> -- cgit 1.4.1