# The Red Matrix: include/crypto.php File Reference

All Classes Namespaces Files Functions Variables Pages
crypto.php File Reference

## Functions

| rsa_sign ($data, $key, $alg= 'sha256')
| rsa_verify ($data, $sig, $key, $alg= 'sha256')
| pkcs5_pad ($text, $blocksize)
| pkcs5_unpad ($text)
| AES256CBC_encrypt ($data, $key, $iv)
| AES256CBC_decrypt ($data, $key, $iv)
| crypto_encapsulate ($data, $pubkey, $alg='aes256cbc')
| aes_encapsulate ($data, $pubkey)
| crypto_unencapsulate ($data, $prvkey)
| aes_unencapsulate ($data, $prvkey)
| new_keypair ($bits)
| pkcs1to8 ($oldkey, $len)
| pkcs8to1 ($oldkey, $len)
| DerToPem ($Der, $Private=false)
| DerToRsa ($Der)
| pkcs8_encode ($Modulus, $PublicExponent)
| pkcs1_encode ($Modulus, $PublicExponent)
| metopem ($m, $e)
| pubrsatome ($key, &$m, &$e)
| rsatopem ($key)
| pemtorsa ($key)
| pemtome ($key, &$m, &$e)
| metorsa ($m, $e)
| salmon_key ($pubkey)

## Function Documentation

AES256CBC_decrypt | ( |  | $data,
|  |  | $key,
|  |  | $iv
| ) |  |

Referenced by aes_unencapsulate().

AES256CBC_encrypt | ( |  | $data,
|  |  | $key,
|  |  | $iv
| ) |  |

Referenced by aes_encapsulate().

aes_encapsulate | ( |  | $data,
|  |  | $pubkey
| ) |  |

Referenced by crypto_encapsulate().

aes_unencapsulate | ( |  | $data,
|  |  | $prvkey
| ) |  |

Referenced by crypto_unencapsulate().

crypto_encapsulate | ( |  | $data,
|  |  | $pubkey,
|  |  | $alg = `'aes256cbc'`
| ) |  |

Referenced by diaspora_comment(), diaspora_conversation(), diaspora_like(), diaspora_message(), get_item_elements(), get_mail_elements(), item_post(), item_store(), item_store_update(), localize_item(), post_activity_item(), post_post(), send_message(), start_delivery_chain(), store_diaspora_comment_sig(), zfinger_init(), zot_build_packet(), and zot_fetch().

crypto_unencapsulate | ( |  | $data,
|  |  | $prvkey
| ) |  |

Referenced by bb2diaspora_itembody(), diaspora_process_outbound(), diaspora_send_followup(), diaspora_send_mail(), diaspora_send_relay(), editpost_content(), editwebpage_content(), encode_item(), encode_mail(), mail_post(), new_contact(), post_post(), private_messages_fetch_conversation(), private_messages_fetch_message(), private_messages_list(), probe_content(), start_delivery_chain(), tag_deliver(), unobscure(), viewsrc_content(), zot_import(), and zot_refresh().

DerToPem | ( |  | $Der,
|  |  | $Private = `false`
| ) |  |

Referenced by metopem().

DerToRsa | ( |  | $Der | ) |

Referenced by metorsa().

metopem | ( |  | $m,
|  |  | $e
| ) |  |

Referenced by rsatopem().

metorsa | ( |  | $m,
|  |  | $e
| ) |  |

Referenced by pemtorsa().

new_keypair | ( |  | $bits | ) |

Referenced by create_account(), create_identity(), and create_sys_channel().

pemtome | ( |  | $key,
|  | & | $m,
|  | & | $e
| ) |  |

Referenced by pemtorsa(), and salmon_key().

pemtorsa | ( |  | $key | ) |

Referenced by xrd_init().

pkcs1_encode | ( |  | $Modulus,
|  |  | $PublicExponent
| ) |  |

Referenced by metorsa().

pkcs1to8 | ( |  | $oldkey,
|  |  | $len
| ) |  |

pkcs5_pad | ( |  | $text,
|  |  | $blocksize
| ) |  |

Referenced by AES256CBC_encrypt(), and diaspora_msg_build().

pkcs5_unpad | ( |  | $text | ) |

Referenced by AES256CBC_decrypt(), and diaspora_decode().

pkcs8_encode | ( |  | $Modulus,
|  |  | $PublicExponent
| ) |  |

Referenced by metopem().

pkcs8to1 | ( |  | $oldkey,
|  |  | $len
| ) |  |

pubrsatome | ( |  | $key,
|  | & | $m,
|  | & | $e
| ) |  |

Referenced by rsatopem().

rsa_sign | ( |  | $data,
|  |  | $key,
|  |  | $alg = `'sha256'`
| ) |  |

Referenced by create_identity(), diaspora_msg_build(), diaspora_pubmsg_build(), diaspora_send_followup(), diaspora_send_mail(), diaspora_send_relay(), diaspora_send_retraction(), fix_system_urls(), import_post(), item_post(), item_store(), item_store_update(), magic_init(), post_activity_item(), post_post(), store_diaspora_comment_sig(), zfinger_init(), zot_build_packet(), and zot_fetch().

rsa_verify | ( |  | $data,
|  |  | $sig,
|  |  | $key,
|  |  | $alg = `'sha256'`
| ) |  |

Referenced by diaspora_comment(), diaspora_conversation(), diaspora_decode(), diaspora_like(), diaspora_message(), diaspora_signed_retraction(), get_item_elements(), import_site(), import_xchan(), post_init(), post_post(), sync_locations(), zfinger_init(), and zot_register_hub().

rsatopem | ( |  | $key | ) |

Referenced by discover_by_webbie().

salmon_key | ( |  | $pubkey | ) |

Referenced by xrd_init().