diff options
Diffstat (limited to 'lib/unstable/Security/Signature/Enum')
4 files changed, 109 insertions, 0 deletions
diff --git a/lib/unstable/Security/Signature/Enum/DigestAlgorithm.php b/lib/unstable/Security/Signature/Enum/DigestAlgorithm.php new file mode 100644 index 00000000000..465f33fd2c3 --- /dev/null +++ b/lib/unstable/Security/Signature/Enum/DigestAlgorithm.php @@ -0,0 +1,34 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace NCU\Security\Signature\Enum; + +/** + * list of available algorithm when generating digest from body + * + * @experimental 31.0.0 + */ +enum DigestAlgorithm: string { + /** @experimental 31.0.0 */ + case SHA256 = 'SHA-256'; + /** @experimental 31.0.0 */ + case SHA512 = 'SHA-512'; + + /** + * returns hashing algorithm to be used when generating digest + * + * @return string + * @experimental 31.0.0 + */ + public function getHashingAlgorithm(): string { + return match($this) { + self::SHA256 => 'sha256', + self::SHA512 => 'sha512', + }; + } +} diff --git a/lib/unstable/Security/Signature/Enum/SignatoryStatus.php b/lib/unstable/Security/Signature/Enum/SignatoryStatus.php new file mode 100644 index 00000000000..1e460aed449 --- /dev/null +++ b/lib/unstable/Security/Signature/Enum/SignatoryStatus.php @@ -0,0 +1,24 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace NCU\Security\Signature\Enum; + +/** + * current status of signatory. is it trustable or not ? + * + * - SYNCED = the remote instance is trustable. + * - BROKEN = the remote instance does not use the same key pairs than previously + * + * @experimental 31.0.0 + */ +enum SignatoryStatus: int { + /** @experimental 31.0.0 */ + case SYNCED = 1; + /** @experimental 31.0.0 */ + case BROKEN = 9; +} diff --git a/lib/unstable/Security/Signature/Enum/SignatoryType.php b/lib/unstable/Security/Signature/Enum/SignatoryType.php new file mode 100644 index 00000000000..de3e5568479 --- /dev/null +++ b/lib/unstable/Security/Signature/Enum/SignatoryType.php @@ -0,0 +1,30 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace NCU\Security\Signature\Enum; + +/** + * type of link between local and remote instance + * + * - FORGIVABLE = the keypair can be deleted and refreshed anytime; silently + * - REFRESHABLE = the keypair can be refreshed but a notice will be generated + * - TRUSTED = any changes of keypair will require human interaction, warning will be issued + * - STATIC = error will be issued on conflict, assume keypair cannot be reset. + * + * @experimental 31.0.0 + */ +enum SignatoryType: int { + /** @experimental 31.0.0 */ + case FORGIVABLE = 1; // no notice on refresh + /** @experimental 31.0.0 */ + case REFRESHABLE = 4; // notice on refresh + /** @experimental 31.0.0 */ + case TRUSTED = 8; // warning on refresh + /** @experimental 31.0.0 */ + case STATIC = 9; // error on refresh +} diff --git a/lib/unstable/Security/Signature/Enum/SignatureAlgorithm.php b/lib/unstable/Security/Signature/Enum/SignatureAlgorithm.php new file mode 100644 index 00000000000..5afa8a3f810 --- /dev/null +++ b/lib/unstable/Security/Signature/Enum/SignatureAlgorithm.php @@ -0,0 +1,21 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace NCU\Security\Signature\Enum; + +/** + * list of available algorithm when signing payload + * + * @experimental 31.0.0 + */ +enum SignatureAlgorithm: string { + /** @experimental 31.0.0 */ + case RSA_SHA256 = 'rsa-sha256'; + /** @experimental 31.0.0 */ + case RSA_SHA512 = 'rsa-sha512'; +} |