GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Muzosh/liboqs-php: PHP wrapper for libOQS

BranchesTags
Open more actions menu

Latest commit

 

History

20 Commits
20 Commits

Folders and files

NameName
Last commit message
Last commit date
examples
examples
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.sh
build.sh
 
 
oqsphp.i
oqsphp.i
 
 
oqsphp.php
oqsphp.php
 
 

Repository files navigation

liboqs-php

This repository documents the process of building the PHP extension of libOQS library from OpenQuantumSafe organization. Very similar one for Python is here.

Installation

  1. Clone this repository
  2. If you already have libOQS repository on the system, specify its location by export LIBOQS_ROOT=/path/to/liboqs
  3. Run build.sh
  4. Add this line to your php.ini file: extension=/path/to/this/repository/build/oqsphp.so (or copy ./build/oqsphp.so wherever you like)
  5. (Optional) Copy oqsphp.php to your project directory in order to expose classes and functions to your PHP code
    • this step is purely for developer's convenience, you can still use the extension without it (but your IDE will throw undefined class/function warnings)

Exposed classes and functions

See oqsphp.php

Example

for ($i = 0; $i < OQS_SIG_algs_length; $i++) {
    $alg = OQS_SIG_alg_identifier($i);
    $enabled = OQS_SIG_alg_is_enabled($alg);
    echo $alg . " - " . $enabled . "\n";
}
$bytes = OQS_randombytes(32);

$sig = new OQS_SIGNATURE("Dilithium2");
$message = "Hello World";

// All operations should return $status = 0 = OQS_SUCCESS
$status = $sig->keypair($public_key, $private_key);
assert($status == OQS_SUCCESS);
$status = $sig->sign($signature, $message, $private_key);
assert($status == OQS_SUCCESS);
$status = $sig->verify($message, $signature, $public_key);
assert($status == OQS_SUCCESS);

for ($i = 0; $i < OQS_KEM_algs_length; $i++) {
    $alg = OQS_KEM_alg_identifier($i);
    $enabled = OQS_KEM_alg_is_enabled($alg);
    echo $alg . " - " . $enabled . "\n";
}

$kem = new OQS_KEYENCAPSULATION("Kyber1024");

// All operations should return $status = 0 = OQS_SUCCESS
$status = $kem->keypair($public_key, $private_key);
assert($status == OQS_SUCCESS);
$status = $kem->encapsulate($ciphertext, $shared_secret, $public_key);
assert($status == OQS_SUCCESS);
$status = $kem->decapsulate($shared_secret2, $ciphertext, $private_key);
assert($status == OQS_SUCCESS);


echo "Done";

About

PHP wrapper for libOQS

Topics

bundle-muzosh-post-quantum-auth-on-the-web

Resources

Readme
MIT license
Activity

Stars

4 stars

Watchers

1 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.