-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: azjezz <azjezz@protonmail.com>
- Loading branch information
Showing
18 changed files
with
1,111 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!-- | ||
This markdown file was generated using `docs/documenter.php`. | ||
Any edits to it will likely be lost. | ||
--> | ||
|
||
[*index](./../README.md) | ||
|
||
--- | ||
|
||
### `Psl\TCP\TLS` Component | ||
|
||
#### `Classes` | ||
|
||
- [Certificate](./../../src/Psl/TCP/TLS/Certificate.php#L16) | ||
- [ConnectOptions](./../../src/Psl/TCP/TLS/ConnectOptions.php#L34) | ||
- [HashingAlgorithm](./../../src/Psl/TCP/TLS/HashingAlgorithm.php#L15) | ||
- [SecurityLevel](./../../src/Psl/TCP/TLS/SecurityLevel.php#L18) | ||
- [Version](./../../src/Psl/TCP/TLS/Version.php#L10) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Psl\File; | ||
use Psl\Async; | ||
use Psl\IO; | ||
|
||
require 'vendor/autoload.php'; | ||
|
||
Async\main(function (): void { | ||
$file = File\open_read_only(__FILE__); | ||
$bytes = 0; | ||
while (!($x = $file->reachedEndOfDataSource())) { | ||
var_dump($x); | ||
$byte = $file->readFixedSize(1); | ||
$bytes += strlen($byte); | ||
|
||
IO\write_line('read %d bytes.', $bytes); | ||
var_dump($file->reachedEndOfDataSource()); | ||
} | ||
|
||
$file->close(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Psl\TCP\TLS; | ||
|
||
/** | ||
* Represents a TLS certificate for secure TCP connections. | ||
* | ||
* This class encapsulates the necessary information for a TLS certificate, including | ||
* the certificate file itself, an optional private key file, and an optional passphrase | ||
* for the key. | ||
* | ||
* @immutable | ||
*/ | ||
final class Certificate | ||
{ | ||
/** | ||
* Constructor for the Certificate class. | ||
* | ||
* @param non-empty-string $certificateFile The path to the certificate file. | ||
* @param non-empty-string|null $keyFile The path to the private key file associated with the certificate, if any. | ||
* @param non-empty-string|null $passphrase The passphrase for the private key file, if the file is encrypted. | ||
* | ||
* @pure | ||
*/ | ||
public function __construct( | ||
public readonly string $certificateFile, | ||
public readonly ?string $keyFile = null, | ||
public readonly ?string $passphrase = null, | ||
) { | ||
} | ||
|
||
/** | ||
* Creates a new Certificate instance. | ||
* | ||
* @param non-empty-string $certificate_file The path to the certificate file. | ||
* @param non-empty-string|null $key_file The path to the private key file associated with the certificate. | ||
* @param non-empty-string|null $passphrase The passphrase for the private key file, if the file is encrypted. | ||
* | ||
* @pure | ||
*/ | ||
public static function create(string $certificate_file, ?string $key_file = null, ?string $passphrase = null): Certificate | ||
{ | ||
return new self($certificate_file, $key_file, $passphrase); | ||
} | ||
} |
Oops, something went wrong.