FederateDiaspora.php

Summary
FederateDiaspora.php
Federate DiasporaEXPERIMENTAL DO NOT USE YET
DiasporaFederation module to federate with the v2 Diaspora protocol.
repair_signatureRepairs a signature that was double encoded The function is unused at the moment.
verify_magic_envelopeVerifies the envelope and return the verified data
aes_encryptEncrypts data via AES
aes_decryptDecrypts data via AES
decodeDecodes incoming Diaspora message in the new format

Federate Diaspora

EXPERIMENTAL DO NOT USE YET

postActiv

the micro-blogging software

Copyright

Copyright © 2016-2017, Maiyannah Bishop

Derived from code copyright various sources

  • GNU Social © 2013-2016, Free Software Foundation, Inc
  • StatusNet © 2008-2012, StatusNet, Inc

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program.  If not, see http://www.gnu.org/licenses/.

https://www.gnu.org/licenses/agpl.html

About

EXPERIMENTAL Diaspora federation module.

Largely and shamelessly cribbed from Friendica’s module.

PHP version

Tested with PHP 7

File Authors

Web

Diaspora

Federation module to federate with the v2 Diaspora protocol.

100% experimental at this point and mostly shamelessly lifted from the Friendica code.

Summary
repair_signatureRepairs a signature that was double encoded The function is unused at the moment.
verify_magic_envelopeVerifies the envelope and return the verified data
aes_encryptEncrypts data via AES
aes_decryptDecrypts data via AES
decodeDecodes incoming Diaspora message in the new format

repair_signature

private static function repair_signature($signature,  
$handle =  "",
$level =  1)

Repairs a signature that was double encoded The function is unused at the moment.  It was copied from the old implementation.

Parameters

  • string $signature The signature
  • string $handle The handle of the signature owner
  • integer $level This value is only set inside this function to avoid endless loops

Returns

  • string the repaired signature

verify_magic_envelope

private static function verify_magic_envelope($envelope)

Verifies the envelope and return the verified data

Parameters

  • string $envelope The magic envelope

Returns

  • string verified data

aes_encrypt

private static function aes_encrypt($key,
$iv,
$data)

Encrypts data via AES

  • string $key The AES key
  • string $iv The IV (is used for CBC encoding)
  • string $data The data that is to be encrypted

Returns

  • string encrypted data

aes_decrypt

private static function aes_decrypt($key,
$iv,
$encrypted)

Decrypts data via AES

  • param string $key The AES key
  • param string $iv The IV (is used for CBC encoding)
  • string $encrypted The encrypted data

Returns

  • string decrypted data

decode

Decodes incoming Diaspora message in the new format

Parameters

  • array $importer Array of the importer user
  • string $raw raw post message
private static function repair_signature($signature,  
$handle =  "",
$level =  1)
Repairs a signature that was double encoded The function is unused at the moment.
private static function verify_magic_envelope($envelope)
Verifies the envelope and return the verified data
private static function aes_encrypt($key,
$iv,
$data)
Encrypts data via AES
private static function aes_decrypt($key,
$iv,
$encrypted)
Decrypts data via AES