File: src/ProtocolInterface.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  PHP PASeTo  >  src/ProtocolInterface.php  >  Download  
File: src/ProtocolInterface.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP PASeTo
Encrypt and decrypt data with PaSeTO protocol
Author: By
Last change:
Date: 8 months ago
Size: 2,221 bytes
 

Contents

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

use
ParagonIE\Paseto\Keys\{
   
AsymmetricPublicKey,
   
AsymmetricSecretKey,
   
SymmetricKey
};

/**
 * Interface ProtocolInterface
 * @package ParagonIE\Paseto
 */
interface ProtocolInterface
{
   
/**
     * Must be constructable with no arguments so an instance may be passed
     * around in a type safe way.
     */
   
public function __construct();

   
/**
     * A unique header string with which the protocol can be identified.
     *
     * @return string
     */
   
public static function header(): string;

   
/**
     * @return AsymmetricSecretKey
     */
   
public static function generateAsymmetricSecretKey(): AsymmetricSecretKey;

   
/**
     * @return SymmetricKey
     */
   
public static function generateSymmetricKey(): SymmetricKey;

   
/**
     * @return int
     */
   
public static function getSymmetricKeyByteLength(): int;

   
/**
     * Encrypt a message using a shared key.
     *
     * @param string $data
     * @param SymmetricKey $key
     * @param string $footer
     * @return string
     */
   
public static function encrypt(
       
string $data,
       
SymmetricKey $key,
       
string $footer = ''
   
): string;

   
/**
     * Decrypt a message using a shared key.
     *
     * @param string $data
     * @param SymmetricKey $key
     * @param string|null $footer
     * @return string
     */
   
public static function decrypt(
       
string $data,
       
SymmetricKey $key,
       
string $footer = null
   
): string;

   
/**
     * Sign a message. Public-key digital signatures.
     *
     * @param string $data
     * @param AsymmetricSecretKey $key
     * @param string $footer
     * @return string
     */
   
public static function sign(
       
string $data,
       
AsymmetricSecretKey $key,
       
string $footer = ''
   
): string;

   
/**
     * Verify a signed message. Public-key digital signatures.
     *
     * @param string $signMsg
     * @param AsymmetricPublicKey $key
     * @param string|null $footer
     * @return string
     */
   
public static function verify(
       
string $signMsg,
       
AsymmetricPublicKey $key,
       
string $footer = null
   
): string;
}


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