X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FOStatus%2Fclasses%2FMagicsig.php;fp=plugins%2FOStatus%2Fclasses%2FMagicsig.php;h=f5a5733dcb2f8288f08709770676c242c9c4f5a4;hb=f4ed1713974be40d644cdb4378c41c38440b001c;hp=890f525862ead99c7aa997a7f9b3fcbc70d1b27e;hpb=2970333adb7b9cc96dfdbd0097bdf3dbe6b43f42;p=quix0rs-gnu-social.git diff --git a/plugins/OStatus/classes/Magicsig.php b/plugins/OStatus/classes/Magicsig.php index 890f525862..f5a5733dcb 100644 --- a/plugins/OStatus/classes/Magicsig.php +++ b/plugins/OStatus/classes/Magicsig.php @@ -243,8 +243,8 @@ class Magicsig extends Managed_DataObject * Fill out $this->privateKey or $this->publicKey with a Crypt_RSA object * representing the give key (as mod/exponent pair). * - * @param string $mod base64-encoded - * @param string $exp base64-encoded exponent + * @param string $mod base64url-encoded + * @param string $exp base64url-encoded exponent * @param string $type one of 'public' or 'private' */ public function loadKey($mod, $exp, $type = 'public') @@ -263,6 +263,15 @@ class Magicsig extends Managed_DataObject } } + public function loadPublicKeyPKCS1($key) + { + $rsa = new Crypt_RSA(); + if (!$rsa->setPublicKey($key, CRYPT_RSA_PUBLIC_FORMAT_PKCS1)) { + throw new ServerException('Could not load PKCS1 public key. We probably got this from a remote Diaspora node as the profile public key.'); + } + $this->publicKey = $rsa; + } + /** * Returns the name of the crypto algorithm used for this key. *