PluginProbe
Defender Security – Malware Scanner, Login Security & Firewall / 5.7.2
Defender Security – Malware Scanner, Login Security & Firewall v5.7.2
6.3.0 6.2.3 6.2.4 6.2.0 6.2.1 6.2.2 6.1.0 5.3.1 5.4.0 5.4.1 5.5.0 5.5.1 5.6.0 5.6.1 5.6.2 5.7.0 5.7.1 5.7.2 5.8.0 5.8.1 5.9.0 6.0.0 6.0.1 3.0.1 3.1.0 All 141 releases
defender-security / vendor / web-auth / metadata-service / src / EcdaaTrustAnchor.php

EcdaaTrustAnchor.php in Defender Security – Malware Scanner, Login Security & Firewall 5.7.2, at vendor/web-auth/metadata-service/src/EcdaaTrustAnchor.php

124 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 /*
6 * The MIT License (MIT)
7 *
8 * Copyright (c) 2014-2021 Spomky-Labs
9 *
10 * This software may be modified and distributed under the terms
11 * of the MIT license. See the LICENSE file for details.
12 */
13
14 namespace Webauthn\MetadataService;
15
16 use Assert\Assertion;
17 use Base64Url\Base64Url;
18 use JsonSerializable;
19 use function Safe\sprintf;
20
21 class EcdaaTrustAnchor implements JsonSerializable
22 {
23 /**
24 * @var string
25 */
26 private $X;
27
28 /**
29 * @var string
30 */
31 private $Y;
32
33 /**
34 * @var string
35 */
36 private $c;
37
38 /**
39 * @var string
40 */
41 private $sx;
42
43 /**
44 * @var string
45 */
46 private $sy;
47
48 /**
49 * @var string
50 */
51 private $G1Curve;
52
53 public function __construct(string $X, string $Y, string $c, string $sx, string $sy, string $G1Curve)
54 {
55 $this->X = $X;
56 $this->Y = $Y;
57 $this->c = $c;
58 $this->sx = $sx;
59 $this->sy = $sy;
60 $this->G1Curve = $G1Curve;
61 }
62
63 public function getX(): string
64 {
65 return $this->X;
66 }
67
68 public function getY(): string
69 {
70 return $this->Y;
71 }
72
73 public function getC(): string
74 {
75 return $this->c;
76 }
77
78 public function getSx(): string
79 {
80 return $this->sx;
81 }
82
83 public function getSy(): string
84 {
85 return $this->sy;
86 }
87
88 public function getG1Curve(): string
89 {
90 return $this->G1Curve;
91 }
92
93 public static function createFromArray(array $data): self
94 {
95 $data = Utils::filterNullValues($data);
96 foreach (['X', 'Y', 'c', 'sx', 'sy', 'G1Curve'] as $key) {
97 Assertion::keyExists($data, $key, sprintf('Invalid data. The key "%s" is missing', $key));
98 }
99
100 return new self(
101 Base64Url::decode($data['X']),
102 Base64Url::decode($data['Y']),
103 Base64Url::decode($data['c']),
104 Base64Url::decode($data['sx']),
105 Base64Url::decode($data['sy']),
106 $data['G1Curve']
107 );
108 }
109
110 public function jsonSerialize(): array
111 {
112 $data = [
113 'X' => Base64Url::encode($this->X),
114 'Y' => Base64Url::encode($this->Y),
115 'c' => Base64Url::encode($this->c),
116 'sx' => Base64Url::encode($this->sx),
117 'sy' => Base64Url::encode($this->sy),
118 'G1Curve' => $this->G1Curve,
119 ];
120
121 return Utils::filterNullValues($data);
122 }
123 }
124