File: src/PrivateKey.php

Recommend this page to a friend!
  Classes of Scott Arciszewski  >  Easy PHP RSA Library  >  src/PrivateKey.php  >  Download  
File: src/PrivateKey.php
Role: Class source
Content type: text/plain
Description: Class source
Class: Easy PHP RSA Library
RSA data encryption and decryption using phpseclib
Author: By
Last change:
Date: 2 months ago
Size: 821 bytes
 

Contents

Class file image Download
<?php
namespace ParagonIE\EasyRSA;


class
PrivateKey
{
    protected
$keyMaterial = '';

   
/**
     * PrivateKey constructor.
     * @param $string
     */
   
public function __construct($string)
    {
       
$this->keyMaterial = $string;
    }

   
/**
     * @return array
     */
   
public function __debugInfo()
    {
        return [];
    }

   
/**
     * return PublicKey
     */
   
public function getPublicKey()
    {
       
$res = \openssl_pkey_get_private($this->keyMaterial);
       
$pubkey = \openssl_pkey_get_details($res);
       
$public = \rtrim(
            \
str_replace("\n", "\r\n", $pubkey['key']),
           
"\r\n"
       
);
        return new
PublicKey($public);
    }

   
/**
     * @return string
     */
   
public function getKey()
    {
        return
$this->keyMaterial;
    }
}


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