Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | /** |
| 5 | * SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors |
| 6 | * SPDX-License-Identifier: AGPL-3.0-or-later |
| 7 | */ |
| 8 | |
| 9 | namespace OCA\Libresign\Handler\CertificateEngine; |
| 10 | |
| 11 | /** |
| 12 | * @method IEngineHandler setPassword(string $password) |
| 13 | * @method string getPassword() |
| 14 | * @method IEngineHandler setCommonName(string $commonName) |
| 15 | * @method string getCommonName() |
| 16 | * @method IEngineHandler setHosts(array $hosts) |
| 17 | * @method array getHosts() |
| 18 | * @method IEngineHandler setFriendlyName(string $friendlyName) |
| 19 | * @method string getFriendlyName() |
| 20 | * @method IEngineHandler setCountry(string $country) |
| 21 | * @method string getCountry() |
| 22 | * @method IEngineHandler setState(string $state) |
| 23 | * @method string getState() |
| 24 | * @method IEngineHandler setLocality(string $locality) |
| 25 | * @method string getLocality() |
| 26 | * @method IEngineHandler setOrganization(string $organization) |
| 27 | * @method string getOrganization() |
| 28 | * @method IEngineHandler setOrganizationalUnit(array $organizationalUnit) |
| 29 | * @method array getOrganizationalUnit() |
| 30 | * @method IEngineHandler setUID(string $UID) |
| 31 | * @method string getUID() |
| 32 | * @method string getName() |
| 33 | */ |
| 34 | interface IEngineHandler { |
| 35 | public function generateRootCert( |
| 36 | string $commonName, |
| 37 | array $names = [], |
| 38 | ): void; |
| 39 | |
| 40 | public function populateInstance(array $rootCert): IEngineHandler; |
| 41 | |
| 42 | public function generateCertificate(): string; |
| 43 | |
| 44 | public function readCertificate(string $certificate, string $privateKey): array; |
| 45 | |
| 46 | public function updatePassword(string $certificate, string $currentPrivateKey, string $newPrivateKey): string; |
| 47 | |
| 48 | public function setEngine(string $engine): void; |
| 49 | |
| 50 | public function getEngine(): string; |
| 51 | |
| 52 | public function isSetupOk(): bool; |
| 53 | |
| 54 | public function getCurrentConfigPath(): string; |
| 55 | |
| 56 | public function getConfigPathByParams(string $instanceId, int $generation): string; |
| 57 | |
| 58 | public function setConfigPath(string $configPath): IEngineHandler; |
| 59 | |
| 60 | public function getLeafExpiryInDays(): int; |
| 61 | |
| 62 | public function setLeafExpiryOverrideInDays(?int $days): self; |
| 63 | |
| 64 | public function getCaExpiryInDays(): int; |
| 65 | |
| 66 | public function configureCheck(): array; |
| 67 | |
| 68 | public function toArray(): array; |
| 69 | |
| 70 | /** |
| 71 | * Generate Certificate Revocation List in DER format |
| 72 | * @param array $revokedCertificates Array of revoked certificate entities |
| 73 | * @param string $instanceId Instance identifier |
| 74 | * @param int $generation Generation identifier |
| 75 | * @param int $crlNumber Sequential CRL number for X.509 CRL versioning |
| 76 | * @return string DER-encoded CRL data |
| 77 | * @throws \RuntimeException If CRL generation is not supported or fails |
| 78 | */ |
| 79 | public function generateCrlDer(array $revokedCertificates, string $instanceId, int $generation, int $crlNumber): string; |
| 80 | |
| 81 | /** |
| 82 | * Scope certificate validation policy resolution to a specific user. |
| 83 | * |
| 84 | * @param string|null $userId User identifier used to resolve validation policies |
| 85 | * @return self |
| 86 | */ |
| 87 | public function setPolicyUserIdForValidation(?string $userId): self; |
| 88 | |
| 89 | /** |
| 90 | * Parse an X.509 certificate and return its details with CRL validation |
| 91 | * @param string $certificate PEM-encoded certificate |
| 92 | * @return array Parsed certificate data including CRL validation information |
| 93 | */ |
| 94 | public function parseCertificate(string $certificate): array; |
| 95 | |
| 96 | /** |
| 97 | * Validates the root certificate checking for expiration and revocation |
| 98 | * Also checks if renewal is needed to maintain CRL signing capability |
| 99 | * @throws \OCA\Libresign\Exception\LibresignException If certificate is expired or revoked |
| 100 | */ |
| 101 | public function validateRootCertificate(): void; |
| 102 | } |