PHP Classes

File: local/signer.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   Certainty   local/signer.php   Download  
File: local/signer.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Certainty
Manage SSL certificate authority file used by PHP
Author: By
Last change:
Date: 6 years ago
Size: 598 bytes
 

Contents

Class file image Download
<?php
require '../vendor/autoload.php';

if (!\
file_exists('keys.json')) {
    echo
'Keys don\'t exist!', PHP_EOL;
    exit(
127);
}
$file = \file_get_contents('keys.json');
$json = \json_decode($file, true);

$secretKey = \ParagonIE\ConstantTime\Hex::decode($json['secret-key']);
$publicKey = \ParagonIE\ConstantTime\Hex::decode($json['public-key']);

$signature = ParagonIE_Sodium_File::sign($argv[1], $secretKey);

if (!\
ParagonIE_Sodium_File::verify($signature, $argv[1], $publicKey)) {
    echo
'FAIL!', PHP_EOL;
    exit(
127);
}

echo \
ParagonIE\ConstantTime\Hex::encode($signature), PHP_EOL;