aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/crypto.php24
-rw-r--r--mod/photos.php5
2 files changed, 29 insertions, 0 deletions
diff --git a/include/crypto.php b/include/crypto.php
index 33cdc10c0..d8d79eaea 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -127,3 +127,27 @@ function new_keypair($bits) {
}
+function pkcs1to8($oldkey) {
+
+ if(strstr($oldkey,'BEGIN PUBLIC'))
+ return $oldkey;
+
+ $oldkey = str_replace('-----BEGIN RSA PUBLIC KEY-----', '', $oldkey);
+ $oldkey = trim(str_replace('-----END RSA PUBLIC KEY-----', '', $oldkey));
+ $key = 'MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A' . str_replace("\n", '', $oldkey);
+ $key = "-----BEGIN PUBLIC KEY-----\n" . wordwrap($key, 64, "\n", true) . "\n-----END PUBLIC KEY-----";
+ return $key;
+}
+
+function pkcs8to1($oldkey) {
+
+ if(strstr($oldkey,'BEGIN RSA'))
+ return $oldkey;
+
+ $oldkey = str_replace('-----BEGIN PUBLIC KEY-----', '', $oldkey);
+ $oldkey = trim(str_replace('-----END PUBLIC KEY-----', '', $oldkey));
+ $key = str_replace("\n",'',$oldkey);
+ $key = substr($key,32);
+ $key = "-----BEGIN RSA PUBLIC KEY-----\n" . wordwrap($key, 64, "\n", true) . "\n-----END RSA PUBLIC KEY-----";
+ return $key;
+} \ No newline at end of file
diff --git a/mod/photos.php b/mod/photos.php
index c43beb8d4..86e027bab 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -618,6 +618,11 @@ function photos_content(&$a) {
if($datatype === 'album') {
+ if((strlen($datum) & 1) || (! ctype_xdigit($datum))) {
+ notice( t('Album name could not be decoded') . EOL);
+ $datum = '';
+ }
+
$album = hex2bin($datum);
$r = q("SELECT `resource_id`, max(`scale`) AS `scale` FROM `photo` WHERE `uid` = %d AND `album` = '%s'