{"id":19198443,"url":"https://github.com/virgilsecurity/virgil-crypto-php","last_synced_at":"2025-04-06T08:12:02.338Z","repository":{"id":32254307,"uuid":"35828673","full_name":"VirgilSecurity/virgil-crypto-php","owner":"VirgilSecurity","description":"Virgil PHP Crypto Library is a high-level cryptographic library that allows you to perform all necessary operations for secure storing and transferring data and everything required to become HIPAA and GDPR compliant.","archived":false,"fork":false,"pushed_at":"2024-10-01T09:50:17.000Z","size":6028,"stargazers_count":34,"open_issues_count":1,"forks_count":4,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-03-30T07:11:28.967Z","etag":null,"topics":["crypto","cryptography","e2ee","encryption","end-to-end-encryption","gdpr","hipaa"],"latest_commit_sha":null,"homepage":"https://developer.virgilsecurity.com/docs/how-to#cryptography","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VirgilSecurity.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-05-18T16:17:36.000Z","updated_at":"2025-03-19T20:30:42.000Z","dependencies_parsed_at":"2024-11-09T12:25:22.831Z","dependency_job_id":"badc15b8-aba7-4c69-a3d7-5ed5206bd4c7","html_url":"https://github.com/VirgilSecurity/virgil-crypto-php","commit_stats":{"total_commits":159,"total_committers":11,"mean_commits":"14.454545454545455","dds":0.5534591194968553,"last_synced_commit":"c12d505b038ba0c4e60cb71a645be770e58c8da6"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-crypto-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-crypto-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-crypto-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VirgilSecurity%2Fvirgil-crypto-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VirgilSecurity","download_url":"https://codeload.github.com/VirgilSecurity/virgil-crypto-php/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247451655,"owners_count":20940939,"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","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":["crypto","cryptography","e2ee","encryption","end-to-end-encryption","gdpr","hipaa"],"created_at":"2024-11-09T12:22:02.468Z","updated_at":"2025-04-06T08:12:02.316Z","avatar_url":"https://github.com/VirgilSecurity.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Virgil Crypto Library PHP\n\n[![Build Status](https://github.com/VirgilSecurity/virgil-crypto-php/actions/workflows/build.yml/badge.svg?branch=master)](https://travis-ci.com/VirgilSecurity/virgil-crypto-php)\n[![GitHub license](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg)](https://github.com/VirgilSecurity/virgil/blob/master/LICENSE)\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/virgil/crypto.svg?style=flat-square)](https://packagist.org/packages/virgil/crypto)\n[![Total Downloads](https://img.shields.io/packagist/dt/virgil/crypto.svg?style=flat-square)](https://packagist.org/packages/virgil/crypto)\n\n[Introduction](#introduction) | [Library purposes](#library-purposes) | [Installation](#installation) | [Usage examples](#usage-examples) | [Docs](#docs) | [License](#license) | [Support](#support)\n\n## Introduction\n\nVirgil Crypto Library PHP is a stack of security libraries (ECIES with Crypto Agility wrapped in Virgil Cryptogram) and an open-source high-level [cryptographic library](https://github.com/VirgilSecurity/virgil-crypto) that allows you to perform all necessary operations for securely storing and transferring data in your digital solutions. Crypto Library is written in C++ and is suitable for mobile and server platforms.\n\n## Library purposes\n\n- Asymmetric Key Generation\n- Encryption/Decryption of data and streams\n- Generation/Verification of digital signatures\n- Double Ratchet algorithm support\n- **Post-quantum algorithms support**: [Round5](https://round5.org/) (encryption) and [Falcon](https://falcon-sign.info/) (signature)\n- Crypto for using [Virgil Core SDK](https://github.com/VirgilSecurity/virgil-sdk-php)\n\n## Installation\n\n**Requirements**:\n\n- PHP 8.2, 8.3\n\n#### Installation via composer\n\n```bash\ncomposer require virgil/crypto\n```\n\n## Usage examples\n\n### Generate a key pair\n\nGenerate a key pair using the default algorithm (EC_X25519):\n\n```php\n$crypto = new VirgilCrypto();\n$keyPair = $crypto-\u003egenerateKeyPair();\n```\n\n### Generate and verify a signature\n\nGenerate signature and sign data with a private key:\n\n```php\n$crypto = new VirgilCrypto();\n$senderKeyPair = $crypto-\u003egenerateKeyPair();\n\n// prepare a message\n$messageToSign = \"Hello, Bob!\";\n\n// generate a signature\n$signature = $crypto-\u003egenerateSignature($messageToSign, $senderKeyPair-\u003egetPrivateKey());\n```\n\nVerify a signature with a public key:\n\n```php\n$crypto = new VirgilCrypto();\n\n$senderKeyPair = $crypto-\u003egenerateKeyPair();\n\n// prepare a message\n$messageToSign = \"Hello, Bob!\";\n\n// generate a signature\n$signature = $crypto-\u003egenerateSignature($messageToSign, $senderKeyPair-\u003egetPrivateKey());\n\n// verify a signature\n$verified = $crypto-\u003everifySignature($signature, $messageToSign, $senderKeyPair-\u003egetPublicKey());\n```\n\n### Encrypt and decrypt data\n\nEncrypt data with a public key:\n\n```php\n$crypto = new VirgilCrypto();\n$receiverKeyPair = $crypto-\u003egenerateKeyPair();\n\n// prepare a message\n$messageToEncrypt = \"Hello, Bob!\";\n\n// encrypt the message\n$encryptedData = $crypto-\u003eencrypt($messageToEncrypt, new VirgilPublicKeyCollection($receiverKeyPair-\u003egetPublicKey()));\n```\n\nDecrypt the encrypted data with a private key:\n\n```php\n$crypto = new VirgilCrypto();\n$receiverKeyPair = $crypto-\u003egenerateKeyPair();\n\n// prepare a message\n$messageToEncrypt = \"Hello, Bob!\";\n\n// encrypt the message\n$encryptedData = $crypto-\u003eencrypt($messageToEncrypt, new VirgilPublicKeyCollection($receiverKeyPair-\u003egetPublicKey()));\n\n// prepare data to be decrypted and decrypt the encrypted data using a private key\n$decryptedData = $crypto-\u003edecrypt($encryptedData, $receiverKeyPair-\u003egetPrivateKey());\n```\n\n### Import and export keys\n\nExport keys:\n\n```\nuse Virgil\\CryptoImpl\\VirgilCrypto;\n\n$crypto = new VirgilCrypto();\n$keyPair = $crypto-\u003egenerateKeys();\n\n// export private key\n$privateKeyData = $crypto-\u003eexportPrivateKey($keyPair-\u003egetPrivateKey(), \"YOUR_PASSWORD\");\n$privateKeyStr = base64_encode($privateKeyData);\n\n// export public key\n$publicKeyData = $crypto-\u003eexportPublicKey($keyPair-\u003egetPrivateKey());\n$publicKeyStr = base64_encode($publicKeyData);\n```\n\nImport keys:\n\n```\nuse Virgil\\CryptoImpl\\VirgilCrypto;\n\n$crypto = new VirgilCrypto();\n$privateKeyStr = \"MIGhMF0GCSqGSIb3DQEFDTBQMC8GCSqGSIb3DQEFDDAiBBBtfBoM7VfmWPlvyHuGWvMSAgIZ6zAKBggqhkiG9w0CCjAdBglghkgBZQMEASoEECwaKJKWFNn3OMVoUXEcmqcEQMZ+WWkmPqzwzJXGFrgS/+bEbr2DvreVgEUiLKrggmXL9ZKugPKG0VhNY0omnCNXDzkXi5dCFp25RLqbbSYsCyw=\";\n\n$privateKeyData = base64_decode($privateKeyStr);\n\n// import a Private key\n$privateKey = $crypto-\u003eimportPrivateKey($privateKeyData, \"YOUR_PASSWORD\");\n\n//-----------------------------------------------------\n\n$publicKeyStr = \"MCowBQYDK2VwAyEA9IVUzsQENtRVzhzraTiEZZy7YLq5LDQOXGQG/q0t0kE=\";\n\n$publicKeyData = base64_decode($publicKeyStr);\n\n// import a Public key\n$publicKey = $crypto-\u003eimportPublicKey($publicKeyData);\n```\n\n## Additional information\n\n- [Manually adding the crypto extension to your server](https://github.com/VirgilSecurity/virgil-cryptowrapper-php#additional-information)\n\n## Docs\n\n- [Crypto Core Library](https://github.com/VirgilSecurity/virgil-crypto)\n- [Developer Documentation](https://developer.virgilsecurity.com/)\n\n## License\n\nThis library is released under the [3-clause BSD License](LICENSE).\n\n## Support\n\nOur developer support team is here to help you. Find out more information on our [Help Center](https://help.virgilsecurity.com/).\n\nYou can find us on [Twitter](https://twitter.com/VirgilSecurity) or send us email support@VirgilSecurity.com.\n\nAlso, get extra help from our support team on [Slack](https://virgilsecurity.com/join-community).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgilsecurity%2Fvirgil-crypto-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvirgilsecurity%2Fvirgil-crypto-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvirgilsecurity%2Fvirgil-crypto-php/lists"}