PHP Classes

File: src/ECDSA/PublicKeyDerParser.php

Recommend this page to a friend!
  Classes of Scott Arciszewski   Easy PHP ECC   src/ECDSA/PublicKeyDerParser.php   Download  
File: src/ECDSA/PublicKeyDerParser.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Easy PHP ECC
Encrypt, decrypt and sign messages with PHPECC
Author: By
Last change:
Date: 2 years ago
Size: 796 bytes
 

Contents

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

use
Mdanter\Ecc\Crypto\Key\PublicKey;
use
Mdanter\Ecc\Crypto\Key\PublicKeyInterface;
use
Mdanter\Ecc\Primitives\GeneratorPoint;
use
Mdanter\Ecc\Serializer\PublicKey\Der\Parser;

/**
 * Class DerParser
 * @package ParagonIE\EasyECC\ECDSA
 */
class PublicKeyDerParser extends Parser
{
   
/**
     * @param GeneratorPoint $generator
     * @param string $data
     * @return PublicKeyInterface
     */
   
public function parseKey(GeneratorPoint $generator, string $data): PublicKeyInterface
   
{
       
/** @var PublicKey $pk */
       
$pk = parent::parseKey($generator, $data);
        return new
PublicKey(
           
$generator->getAdapter(),
           
$pk->getGenerator(),
           
$pk->getPoint()
        );
    }
}