TlsInfo
in package
FinalYes
Exposes a connection's negotiated TLS parameters.
Table of Contents
Properties
- $alpnProtocol : string|null
- $certificates : array<string|int, mixed>|null
- $cipherBits : int
- $cipherName : string
- $cipherVersion : string
- $parsedCertificates : array<string|int, Certificate>|null
- $version : string
Methods
- fromMetaData() : self
- Constructs a new instance from PHP's internal info.
- fromStreamResource() : self|null
- Constructs a new instance from a stream socket resource.
- getApplicationLayerProtocol() : string|null
- getCipherBits() : int
- getCipherName() : string
- getCipherVersion() : string
- getPeerCertificates() : array<string|int, Certificate>
- getVersion() : string
- __construct() : mixed
Properties
$alpnProtocol read-only
private
string|null
$alpnProtocol
$certificates read-only
private
array<string|int, mixed>|null
$certificates
$cipherBits read-only
private
int
$cipherBits
$cipherName read-only
private
string
$cipherName
$cipherVersion read-only
private
string
$cipherVersion
$parsedCertificates
private
array<string|int, Certificate>|null
$parsedCertificates
= null
$version read-only
private
string
$version
Methods
fromMetaData()
Constructs a new instance from PHP's internal info.
public
static fromMetaData(array<string|int, mixed> $cryptoInfo, array<string|int, mixed> $tlsContext) : self
Always pass the info as obtained from PHP as this method might extract additional fields in the future.
Parameters
- $cryptoInfo : array<string|int, mixed>
-
Crypto info obtained via
stream_get_meta_data($socket->getResource())["crypto"]. - $tlsContext : array<string|int, mixed>
-
Context obtained via
stream_context_get_options($socket->getResource())["ssl"]).
Return values
selffromStreamResource()
Constructs a new instance from a stream socket resource.
public
static fromStreamResource(resource $resource) : self|null
Parameters
- $resource : resource
-
Stream socket resource.
Return values
self|null —Returns null if TLS is not enabled on the stream socket.
getApplicationLayerProtocol()
public
getApplicationLayerProtocol() : string|null
Return values
string|nullgetCipherBits()
public
getCipherBits() : int
Return values
intgetCipherName()
public
getCipherName() : string
Return values
stringgetCipherVersion()
public
getCipherVersion() : string
Return values
stringgetPeerCertificates()
public
getPeerCertificates() : array<string|int, Certificate>
Tags
Return values
array<string|int, Certificate>getVersion()
public
getVersion() : string
Return values
string__construct()
private
__construct(string $version, string $cipherName, int $cipherBits, string $cipherVersion, string|null $alpnProtocol, array<string|int, resource>|null $certificates) : mixed
Parameters
- $version : string
- $cipherName : string
- $cipherBits : int
- $cipherVersion : string
- $alpnProtocol : string|null
- $certificates : array<string|int, resource>|null