ParagonIE\Halite\Asymmetric\SecretKey::__construct PHP Method

__construct() public method

public __construct ( HiddenString $keyMaterial )
$keyMaterial ParagonIE\Halite\HiddenString - The actual key data
    public function __construct(HiddenString $keyMaterial)
    {
        parent::__construct($keyMaterial);
        $this->isAsymmetricKey = true;
    }

Usage Example

Example #1
0
 /**
  * @param HiddenString $keyMaterial - The actual key data
  * @throws InvalidKey
  */
 public function __construct(HiddenString $keyMaterial)
 {
     if (CryptoUtil::safeStrlen($keyMaterial->getString()) !== \Sodium\CRYPTO_BOX_SECRETKEYBYTES) {
         throw new InvalidKey('Encryption secret key must be CRYPTO_BOX_SECRETKEYBYTES bytes long');
     }
     parent::__construct($keyMaterial);
 }
All Usage Examples Of ParagonIE\Halite\Asymmetric\SecretKey::__construct