{"id":22278455,"url":"https://github.com/devjack/encrypted-content-encoding","last_synced_at":"2025-07-28T18:30:41.561Z","repository":{"id":56966757,"uuid":"155041235","full_name":"devjack/encrypted-content-encoding","owner":"devjack","description":"An implementation of RFC8188 for PHP - Encrypted Content-Encoding","archived":false,"fork":false,"pushed_at":"2019-01-16T06:00:52.000Z","size":47,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-25T22:04:44.441Z","etag":null,"topics":["encoding","encryption","http","middleware","php","rfc8188"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devjack.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-28T06:15:18.000Z","updated_at":"2021-04-08T17:38:25.000Z","dependencies_parsed_at":"2022-08-21T11:20:21.538Z","dependency_job_id":null,"html_url":"https://github.com/devjack/encrypted-content-encoding","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/devjack/encrypted-content-encoding","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjack%2Fencrypted-content-encoding","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjack%2Fencrypted-content-encoding/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjack%2Fencrypted-content-encoding/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjack%2Fencrypted-content-encoding/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devjack","download_url":"https://codeload.github.com/devjack/encrypted-content-encoding/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devjack%2Fencrypted-content-encoding/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267563490,"owners_count":24108097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encoding","encryption","http","middleware","php","rfc8188"],"created_at":"2024-12-03T15:14:34.914Z","updated_at":"2025-07-28T18:30:41.280Z","avatar_url":"https://github.com/devjack.png","language":"PHP","readme":"# Encrypted Content-Encoding\n\n## Introduction\n\n\u003e PHP implementation of RFC8188 to encrypt HTTP messages.\n\n[![Build Status](https://travis-ci.org/devjack/encrypted-content-encoding.svg?branch=master)](https://travis-ci.org/devjack/encrypted-content-encoding)\n[![Latest Stable Version](https://poser.pugx.org/devjack/encrypted-content-encoding/v/stable)](https://packagist.org/packages/devjack/encrypted-content-encoding)\n[![Total Downloads](https://poser.pugx.org/devjack/encrypted-content-encoding/downloads)](https://packagist.org/packages/devjack/encrypted-content-encoding)\n[![Latest Unstable Version](https://poser.pugx.org/devjack/encrypted-content-encoding/v/unstable)](https://packagist.org/packages/devjack/encrypted-content-encoding)\n[![License](https://poser.pugx.org/devjack/encrypted-content-encoding/license)](https://packagist.org/packages/devjack/encrypted-content-encoding)\n\n## Code Samples\n\n\u003e Note: RFC8188 relies heavily on base64 URL encoding. \n\n### Simple callback function for encryption key lookup\n\n```php\nrequire_once \"vendor/autoload.php\";\n\nuse Base64Url\\Base64Url as b64;\n\n$message = \"I am the walrus\";\n\n$encoded = RFC8188::rfc8188_encode(\n    $message, // plaintext\n    b64::decode(\"yqdlZ-tYemfogSmv7Ws5PQ\"), // encryption key\n    null,   // key ID\n    123    // record size.\n);\n$decoded = RFC8188::rfc8188_decode(\n    $encoded, // data to decode \n    function($keyid) { return b64::decode('yqdlZ-tYemfogSmv7Ws5PQ'); }\n);\n\n$this-\u003eassertEquals($message, $decoded);\n```\n\n### Invocable class for key lookup\nIn this example we use a simple incovable class to provide key lookup. This may be more useful in complex framework integrations such as providing middleware that looks up keys from a database. This sample does not cover service injection to the key lookup class.\n\n```php\nuse DevJack\\EncryptedContentEncoding\\RFC8188;\nuse DevJack\\EncryptedContentEncoding\\Exception\\EncryptionKeyNotFound;\nuse Base64Url\\Base64Url as b64;\n\nclass MockKeyLookupProvider {\n\n    protected $keys = [];\n\n    public function addKey($key, $keyid='') {\n        $this-\u003ekeys[$keyid] = $key;\n    }\n    public function __invoke($keyid) {\n        if (in_array($keyid, array_keys($this-\u003ekeys))) {\n            return $this-\u003ekeys[$keyid];\n        }\n        throw new EncryptionKeyNotFound(\"Encryption key not found.\");\n    }\n}\n\n\n$encoded = b64::decode(\"uNCkWiNYzKTnBN9ji3-qWAAAABkCYTHOG8chz_gnvgOqdGYovxyjuqRyJFjEDyoF1Fvkj6hQPdPHI51OEUKEpgz3SsLWIqS_uA\");\n\n$keyProvider = new MockKeyLookupProvider();\n$keyProvider-\u003eaddKey(b64::decode(\"BO3ZVPxUlnLORbVGMpbT1Q\"), 'a1');\n\n$decoded = RFC8188::rfc8188_decode(\n    $encoded, // data to decode\n    $keyProvider\n);\n```\n\n## Installation\n\nAvailable via composer.\n\n```\ncomposer require devjack/encrypted-content-encoding\n```\n\n### PHP 5.6 compatibility\nAdditionally, install a polyfill for random_bytes such as:\n\n```\ncomposer require paragonie/random_compat\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevjack%2Fencrypted-content-encoding","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevjack%2Fencrypted-content-encoding","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevjack%2Fencrypted-content-encoding/lists"}