File: src/Asymmetric/SignaturePublicKey.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  Halite  >  src/Asymmetric/SignaturePublicKey.php  >  Download  
File: src/Asymmetric/SignaturePublicKey.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Halite
Perform cryptography operations with libsodium
Author: By
Last change: For version 2, let's use strict types!
Merge branch 'v2.0' of https://github.com/paragonie/halite into v2.0

Conflicts:
src/Symmetric/Crypto.php
Date: 5 years ago
Size: 697 bytes
 

 

Contents

Class file image Download
<?php
declare(strict_types=1);
namespace
ParagonIE\Halite\Asymmetric;

use \
ParagonIE\Halite\Alerts\InvalidKey;
use \
ParagonIE\Halite\Util as CryptoUtil;

final class
SignaturePublicKey extends PublicKey
{
   
/**
     * @param string $keyMaterial - The actual key data
     * @param bool $signing - Is this a signing key?
     */
   
public function __construct(string $keyMaterial = '', ...$args)
    {
        if (
CryptoUtil::safeStrlen($keyMaterial) !== \Sodium\CRYPTO_SIGN_PUBLICKEYBYTES) {
            throw new
InvalidKey(
               
'Signature public key must be CRYPTO_SIGN_PUBLICKEYBYTES bytes long'
           
);
        }
       
parent::__construct($keyMaterial, true);
    }
}


For more information send a message to info at phpclasses dot org.