You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
615 B
PHP
30 lines
615 B
PHP
<?php
|
|
|
|
|
|
namespace Cijber\OpenSSL\Stack;
|
|
|
|
use Cijber\OpenSSL\Stack;
|
|
use Cijber\OpenSSL\X509;
|
|
use FFI;
|
|
use FFI\CData;
|
|
|
|
class X509Stack extends Stack
|
|
{
|
|
const CLASSNAME = X509::class;
|
|
|
|
public static function from(FFI $ffi, CData $cObj, $owner = null): X509Stack
|
|
{
|
|
return new X509Stack($ffi, $cObj, $owner = null);
|
|
}
|
|
|
|
public function spawn(CData $cData): X509
|
|
{
|
|
$obj = $this->ffi->cast(X509::TYPE, $cData);
|
|
$clone = $this->ffi->X509_dup($obj);
|
|
if ($clone === null) {
|
|
return X509::new();
|
|
}
|
|
return X509::cast($this->ffi, $clone);
|
|
}
|
|
}
|