GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Failed
Pull Request — master (#1)
by thomas
05:34
created
lib/X509/Certificate/Extension/Extension.php 1 patch
Indentation   +199 added lines, -199 removed lines patch added patch discarded remove patch
@@ -19,214 +19,214 @@
 block discarded – undo
19 19
  */
20 20
 abstract class Extension
21 21
 {
22
-    // OID's from standard certificate extensions
23
-    const OID_OBSOLETE_AUTHORITY_KEY_IDENTIFIER = "2.5.29.1";
24
-    const OID_OBSOLETE_KEY_ATTRIBUTES = "2.5.29.2";
25
-    const OID_OBSOLETE_CERTIFICATE_POLICIES = "2.5.29.3";
26
-    const OID_OBSOLETE_KEY_USAGE_RESTRICTION = "2.5.29.4";
27
-    const OID_OBSOLETE_POLICY_MAPPING = "2.5.29.5";
28
-    const OID_OBSOLETE_SUBTREES_CONSTRAINT = "2.5.29.6";
29
-    const OID_OBSOLETE_SUBJECT_ALT_NAME = "2.5.29.7";
30
-    const OID_OBSOLETE_ISSUER_ALT_NAME = "2.5.29.8";
31
-    const OID_SUBJECT_DIRECTORY_ATTRIBUTES = "2.5.29.9";
32
-    const OID_OBSOLETE_BASIC_CONSTRAINTS = "2.5.29.10";
33
-    const OID_SUBJECT_KEY_IDENTIFIER = "2.5.29.14";
34
-    const OID_KEY_USAGE = "2.5.29.15";
35
-    const OID_PRIVATE_KEY_USAGE_PERIOD = "2.5.29.16";
36
-    const OID_SUBJECT_ALT_NAME = "2.5.29.17";
37
-    const OID_ISSUER_ALT_NAME = "2.5.29.18";
38
-    const OID_BASIC_CONSTRAINTS = "2.5.29.19";
39
-    const OID_CRL_NUMBER = "2.5.29.20";
40
-    const OID_REASON_CODE = "2.5.29.21";
41
-    const OID_OBSOLETE_EXPIRATION_DATE = "2.5.29.22";
42
-    const OID_INSTRUCTION_CODE = "2.5.29.23";
43
-    const OID_INVALIDITY_DATE = "2.5.29.24";
44
-    const OID_OBSOLETE_CRL_DISTRIBUTION_POINTS = "2.5.29.25";
45
-    const OID_OBSOLETE_ISSUING_DISTRIBUTION_POINT = "2.5.29.26";
46
-    const OID_DELTA_CRL_INDICATOR = "2.5.29.27";
47
-    const OID_ISSUING_DISTRIBUTION_POINT = "2.5.29.28";
48
-    const OID_CERTIFICATE_ISSUER = "2.5.29.29";
49
-    const OID_NAME_CONSTRAINTS = "2.5.29.30";
50
-    const OID_CRL_DISTRIBUTION_POINTS = "2.5.29.31";
51
-    const OID_CERTIFICATE_POLICIES = "2.5.29.32";
52
-    const OID_POLICY_MAPPINGS = "2.5.29.33";
53
-    const OID_OBSOLETE_POLICY_CONSTRAINTS = "2.5.29.34";
54
-    const OID_AUTHORITY_KEY_IDENTIFIER = "2.5.29.35";
55
-    const OID_POLICY_CONSTRAINTS = "2.5.29.36";
56
-    const OID_EXT_KEY_USAGE = "2.5.29.37";
57
-    const OID_AUTHORITY_ATTRIBUTE_IDENTIFIER = "2.5.29.38";
58
-    const OID_ROLE_SPEC_CERT_IDENTIFIER = "2.5.29.39";
59
-    const OID_CRL_STREAM_IDENTIFIER = "2.5.29.40";
60
-    const OID_BASIC_ATT_CONSTRAINTS = "2.5.29.41";
61
-    const OID_DELEGATED_NAME_CONSTRAINTS = "2.5.29.42";
62
-    const OID_TIME_SPECIFICATION = "2.5.29.43";
63
-    const OID_CRL_SCOPE = "2.5.29.44";
64
-    const OID_STATUS_REFERRALS = "2.5.29.45";
65
-    const OID_FRESHEST_CRL = "2.5.29.46";
66
-    const OID_ORDERED_LIST = "2.5.29.47";
67
-    const OID_ATTRIBUTE_DESCRIPTOR = "2.5.29.48";
68
-    const OID_USER_NOTICE = "2.5.29.49";
69
-    const OID_SOA_IDENTIFIER = "2.5.29.50";
70
-    const OID_BASE_UPDATE_TIME = "2.5.29.51";
71
-    const OID_ACCEPTABLE_CERT_POLICIES = "2.5.29.52";
72
-    const OID_DELTA_INFO = "2.5.29.53";
73
-    const OID_INHIBIT_ANY_POLICY = "2.5.29.54";
74
-    const OID_TARGET_INFORMATION = "2.5.29.55";
75
-    const OID_NO_REV_AVAIL = "2.5.29.56";
76
-    const OID_ACCEPTABLE_PRIVILEGE_POLICIES = "2.5.29.57";
77
-    const OID_TO_BE_REVOKED = "2.5.29.58";
78
-    const OID_REVOKED_GROUPS = "2.5.29.59";
79
-    const OID_EXPIRED_CERTS_ON_CRL = "2.5.29.60";
80
-    const OID_INDIRECT_ISSUER = "2.5.29.61";
81
-    const OID_NO_ASSERTION = "2.5.29.62";
82
-    const OID_AA_ISSUING_DISTRIBUTION_POINT = "2.5.29.63";
83
-    const OID_ISSUED_ON_BEHALF_OF = "2.5.29.64";
84
-    const OID_SINGLE_USE = "2.5.29.65";
85
-    const OID_GROUP_AC = "2.5.29.66";
86
-    const OID_ALLOWED_ATT_ASS = "2.5.29.67";
87
-    const OID_ATTRIBUTE_MAPPINGS = "2.5.29.68";
88
-    const OID_HOLDER_NAME_CONSTRAINTS = "2.5.29.69";
22
+	// OID's from standard certificate extensions
23
+	const OID_OBSOLETE_AUTHORITY_KEY_IDENTIFIER = "2.5.29.1";
24
+	const OID_OBSOLETE_KEY_ATTRIBUTES = "2.5.29.2";
25
+	const OID_OBSOLETE_CERTIFICATE_POLICIES = "2.5.29.3";
26
+	const OID_OBSOLETE_KEY_USAGE_RESTRICTION = "2.5.29.4";
27
+	const OID_OBSOLETE_POLICY_MAPPING = "2.5.29.5";
28
+	const OID_OBSOLETE_SUBTREES_CONSTRAINT = "2.5.29.6";
29
+	const OID_OBSOLETE_SUBJECT_ALT_NAME = "2.5.29.7";
30
+	const OID_OBSOLETE_ISSUER_ALT_NAME = "2.5.29.8";
31
+	const OID_SUBJECT_DIRECTORY_ATTRIBUTES = "2.5.29.9";
32
+	const OID_OBSOLETE_BASIC_CONSTRAINTS = "2.5.29.10";
33
+	const OID_SUBJECT_KEY_IDENTIFIER = "2.5.29.14";
34
+	const OID_KEY_USAGE = "2.5.29.15";
35
+	const OID_PRIVATE_KEY_USAGE_PERIOD = "2.5.29.16";
36
+	const OID_SUBJECT_ALT_NAME = "2.5.29.17";
37
+	const OID_ISSUER_ALT_NAME = "2.5.29.18";
38
+	const OID_BASIC_CONSTRAINTS = "2.5.29.19";
39
+	const OID_CRL_NUMBER = "2.5.29.20";
40
+	const OID_REASON_CODE = "2.5.29.21";
41
+	const OID_OBSOLETE_EXPIRATION_DATE = "2.5.29.22";
42
+	const OID_INSTRUCTION_CODE = "2.5.29.23";
43
+	const OID_INVALIDITY_DATE = "2.5.29.24";
44
+	const OID_OBSOLETE_CRL_DISTRIBUTION_POINTS = "2.5.29.25";
45
+	const OID_OBSOLETE_ISSUING_DISTRIBUTION_POINT = "2.5.29.26";
46
+	const OID_DELTA_CRL_INDICATOR = "2.5.29.27";
47
+	const OID_ISSUING_DISTRIBUTION_POINT = "2.5.29.28";
48
+	const OID_CERTIFICATE_ISSUER = "2.5.29.29";
49
+	const OID_NAME_CONSTRAINTS = "2.5.29.30";
50
+	const OID_CRL_DISTRIBUTION_POINTS = "2.5.29.31";
51
+	const OID_CERTIFICATE_POLICIES = "2.5.29.32";
52
+	const OID_POLICY_MAPPINGS = "2.5.29.33";
53
+	const OID_OBSOLETE_POLICY_CONSTRAINTS = "2.5.29.34";
54
+	const OID_AUTHORITY_KEY_IDENTIFIER = "2.5.29.35";
55
+	const OID_POLICY_CONSTRAINTS = "2.5.29.36";
56
+	const OID_EXT_KEY_USAGE = "2.5.29.37";
57
+	const OID_AUTHORITY_ATTRIBUTE_IDENTIFIER = "2.5.29.38";
58
+	const OID_ROLE_SPEC_CERT_IDENTIFIER = "2.5.29.39";
59
+	const OID_CRL_STREAM_IDENTIFIER = "2.5.29.40";
60
+	const OID_BASIC_ATT_CONSTRAINTS = "2.5.29.41";
61
+	const OID_DELEGATED_NAME_CONSTRAINTS = "2.5.29.42";
62
+	const OID_TIME_SPECIFICATION = "2.5.29.43";
63
+	const OID_CRL_SCOPE = "2.5.29.44";
64
+	const OID_STATUS_REFERRALS = "2.5.29.45";
65
+	const OID_FRESHEST_CRL = "2.5.29.46";
66
+	const OID_ORDERED_LIST = "2.5.29.47";
67
+	const OID_ATTRIBUTE_DESCRIPTOR = "2.5.29.48";
68
+	const OID_USER_NOTICE = "2.5.29.49";
69
+	const OID_SOA_IDENTIFIER = "2.5.29.50";
70
+	const OID_BASE_UPDATE_TIME = "2.5.29.51";
71
+	const OID_ACCEPTABLE_CERT_POLICIES = "2.5.29.52";
72
+	const OID_DELTA_INFO = "2.5.29.53";
73
+	const OID_INHIBIT_ANY_POLICY = "2.5.29.54";
74
+	const OID_TARGET_INFORMATION = "2.5.29.55";
75
+	const OID_NO_REV_AVAIL = "2.5.29.56";
76
+	const OID_ACCEPTABLE_PRIVILEGE_POLICIES = "2.5.29.57";
77
+	const OID_TO_BE_REVOKED = "2.5.29.58";
78
+	const OID_REVOKED_GROUPS = "2.5.29.59";
79
+	const OID_EXPIRED_CERTS_ON_CRL = "2.5.29.60";
80
+	const OID_INDIRECT_ISSUER = "2.5.29.61";
81
+	const OID_NO_ASSERTION = "2.5.29.62";
82
+	const OID_AA_ISSUING_DISTRIBUTION_POINT = "2.5.29.63";
83
+	const OID_ISSUED_ON_BEHALF_OF = "2.5.29.64";
84
+	const OID_SINGLE_USE = "2.5.29.65";
85
+	const OID_GROUP_AC = "2.5.29.66";
86
+	const OID_ALLOWED_ATT_ASS = "2.5.29.67";
87
+	const OID_ATTRIBUTE_MAPPINGS = "2.5.29.68";
88
+	const OID_HOLDER_NAME_CONSTRAINTS = "2.5.29.69";
89 89
     
90
-    // OID's from private certificate extensions arc
91
-    const OID_AA_CONTROLS = "1.3.6.1.5.5.7.1.6";
90
+	// OID's from private certificate extensions arc
91
+	const OID_AA_CONTROLS = "1.3.6.1.5.5.7.1.6";
92 92
     
93
-    /**
94
-     * Mapping from extension ID to implementation class name.
95
-     *
96
-     * @internal
97
-     *
98
-     * @var array
99
-     */
100
-    const MAP_OID_TO_CLASS = array(
101
-        /* @formatter:off */
102
-        self::OID_AUTHORITY_KEY_IDENTIFIER => AuthorityKeyIdentifierExtension::class,
103
-        self::OID_SUBJECT_KEY_IDENTIFIER => SubjectKeyIdentifierExtension::class,
104
-        self::OID_KEY_USAGE => KeyUsageExtension::class,
105
-        self::OID_CERTIFICATE_POLICIES => CertificatePoliciesExtension::class,
106
-        self::OID_POLICY_MAPPINGS => PolicyMappingsExtension::class,
107
-        self::OID_SUBJECT_ALT_NAME => SubjectAlternativeNameExtension::class,
108
-        self::OID_ISSUER_ALT_NAME => IssuerAlternativeNameExtension::class,
109
-        self::OID_SUBJECT_DIRECTORY_ATTRIBUTES => SubjectDirectoryAttributesExtension::class,
110
-        self::OID_BASIC_CONSTRAINTS => BasicConstraintsExtension::class,
111
-        self::OID_NAME_CONSTRAINTS => NameConstraintsExtension::class,
112
-        self::OID_POLICY_CONSTRAINTS => PolicyConstraintsExtension::class,
113
-        self::OID_EXT_KEY_USAGE => ExtendedKeyUsageExtension::class,
114
-        self::OID_CRL_DISTRIBUTION_POINTS => CRLDistributionPointsExtension::class,
115
-        self::OID_INHIBIT_ANY_POLICY => InhibitAnyPolicyExtension::class,
116
-        self::OID_FRESHEST_CRL => FreshestCRLExtension::class,
117
-        self::OID_NO_REV_AVAIL => NoRevocationAvailableExtension::class,
118
-        self::OID_TARGET_INFORMATION => TargetInformationExtension::class,
119
-        self::OID_AA_CONTROLS => AAControlsExtension::class
120
-        /* @formatter:on */
121
-    );
93
+	/**
94
+	 * Mapping from extension ID to implementation class name.
95
+	 *
96
+	 * @internal
97
+	 *
98
+	 * @var array
99
+	 */
100
+	const MAP_OID_TO_CLASS = array(
101
+		/* @formatter:off */
102
+		self::OID_AUTHORITY_KEY_IDENTIFIER => AuthorityKeyIdentifierExtension::class,
103
+		self::OID_SUBJECT_KEY_IDENTIFIER => SubjectKeyIdentifierExtension::class,
104
+		self::OID_KEY_USAGE => KeyUsageExtension::class,
105
+		self::OID_CERTIFICATE_POLICIES => CertificatePoliciesExtension::class,
106
+		self::OID_POLICY_MAPPINGS => PolicyMappingsExtension::class,
107
+		self::OID_SUBJECT_ALT_NAME => SubjectAlternativeNameExtension::class,
108
+		self::OID_ISSUER_ALT_NAME => IssuerAlternativeNameExtension::class,
109
+		self::OID_SUBJECT_DIRECTORY_ATTRIBUTES => SubjectDirectoryAttributesExtension::class,
110
+		self::OID_BASIC_CONSTRAINTS => BasicConstraintsExtension::class,
111
+		self::OID_NAME_CONSTRAINTS => NameConstraintsExtension::class,
112
+		self::OID_POLICY_CONSTRAINTS => PolicyConstraintsExtension::class,
113
+		self::OID_EXT_KEY_USAGE => ExtendedKeyUsageExtension::class,
114
+		self::OID_CRL_DISTRIBUTION_POINTS => CRLDistributionPointsExtension::class,
115
+		self::OID_INHIBIT_ANY_POLICY => InhibitAnyPolicyExtension::class,
116
+		self::OID_FRESHEST_CRL => FreshestCRLExtension::class,
117
+		self::OID_NO_REV_AVAIL => NoRevocationAvailableExtension::class,
118
+		self::OID_TARGET_INFORMATION => TargetInformationExtension::class,
119
+		self::OID_AA_CONTROLS => AAControlsExtension::class
120
+		/* @formatter:on */
121
+	);
122 122
     
123
-    /**
124
-     * Extension's OID.
125
-     *
126
-     * @var string $_oid
127
-     */
128
-    protected $_oid;
123
+	/**
124
+	 * Extension's OID.
125
+	 *
126
+	 * @var string $_oid
127
+	 */
128
+	protected $_oid;
129 129
     
130
-    /**
131
-     * Whether extension is critical.
132
-     *
133
-     * @var bool $_critical
134
-     */
135
-    protected $_critical;
130
+	/**
131
+	 * Whether extension is critical.
132
+	 *
133
+	 * @var bool $_critical
134
+	 */
135
+	protected $_critical;
136 136
     
137
-    /**
138
-     * Get ASN.1 structure of the extension value.
139
-     *
140
-     * @return Element
141
-     */
142
-    abstract protected function _valueASN1();
137
+	/**
138
+	 * Get ASN.1 structure of the extension value.
139
+	 *
140
+	 * @return Element
141
+	 */
142
+	abstract protected function _valueASN1();
143 143
     
144
-    /**
145
-     * Parse extension value from DER.
146
-     *
147
-     * @param string $data DER data
148
-     * @param bool $critical Whether extension is critical
149
-     * @throws \BadMethodCallException
150
-     * @return self
151
-     */
152
-    protected static function _fromDER($data, $critical)
153
-    {
154
-        throw new \BadMethodCallException(
155
-            __FUNCTION__ . " must be implemented in derived class.");
156
-    }
144
+	/**
145
+	 * Parse extension value from DER.
146
+	 *
147
+	 * @param string $data DER data
148
+	 * @param bool $critical Whether extension is critical
149
+	 * @throws \BadMethodCallException
150
+	 * @return self
151
+	 */
152
+	protected static function _fromDER($data, $critical)
153
+	{
154
+		throw new \BadMethodCallException(
155
+			__FUNCTION__ . " must be implemented in derived class.");
156
+	}
157 157
     
158
-    /**
159
-     * Constructor.
160
-     *
161
-     * @param string $oid Extension OID
162
-     * @param bool $critical Whether extension is critical
163
-     */
164
-    public function __construct(string $oid, bool $critical)
165
-    {
166
-        $this->_oid = $oid;
167
-        $this->_critical = $critical;
168
-    }
158
+	/**
159
+	 * Constructor.
160
+	 *
161
+	 * @param string $oid Extension OID
162
+	 * @param bool $critical Whether extension is critical
163
+	 */
164
+	public function __construct(string $oid, bool $critical)
165
+	{
166
+		$this->_oid = $oid;
167
+		$this->_critical = $critical;
168
+	}
169 169
     
170
-    /**
171
-     * Initialize from ASN.1.
172
-     *
173
-     * @param Sequence $seq
174
-     * @return self
175
-     */
176
-    public static function fromASN1(Sequence $seq)
177
-    {
178
-        $extnID = $seq->at(0)
179
-            ->asObjectIdentifier()
180
-            ->oid();
181
-        $critical = false;
182
-        $idx = 1;
183
-        if ($seq->has($idx, Element::TYPE_BOOLEAN)) {
184
-            $critical = $seq->at($idx++)
185
-                ->asBoolean()
186
-                ->value();
187
-        }
188
-        $data = $seq->at($idx)
189
-            ->asOctetString()
190
-            ->string();
191
-        if (array_key_exists($extnID, self::MAP_OID_TO_CLASS)) {
192
-            $cls = self::MAP_OID_TO_CLASS[$extnID];
193
-            return $cls::_fromDER($data, $critical);
194
-        }
195
-        return new UnknownExtension($extnID, $critical, new DERData($data));
196
-    }
170
+	/**
171
+	 * Initialize from ASN.1.
172
+	 *
173
+	 * @param Sequence $seq
174
+	 * @return self
175
+	 */
176
+	public static function fromASN1(Sequence $seq)
177
+	{
178
+		$extnID = $seq->at(0)
179
+			->asObjectIdentifier()
180
+			->oid();
181
+		$critical = false;
182
+		$idx = 1;
183
+		if ($seq->has($idx, Element::TYPE_BOOLEAN)) {
184
+			$critical = $seq->at($idx++)
185
+				->asBoolean()
186
+				->value();
187
+		}
188
+		$data = $seq->at($idx)
189
+			->asOctetString()
190
+			->string();
191
+		if (array_key_exists($extnID, self::MAP_OID_TO_CLASS)) {
192
+			$cls = self::MAP_OID_TO_CLASS[$extnID];
193
+			return $cls::_fromDER($data, $critical);
194
+		}
195
+		return new UnknownExtension($extnID, $critical, new DERData($data));
196
+	}
197 197
     
198
-    /**
199
-     * Get extension OID.
200
-     *
201
-     * @return string
202
-     */
203
-    public function oid(): string
204
-    {
205
-        return $this->_oid;
206
-    }
198
+	/**
199
+	 * Get extension OID.
200
+	 *
201
+	 * @return string
202
+	 */
203
+	public function oid(): string
204
+	{
205
+		return $this->_oid;
206
+	}
207 207
     
208
-    /**
209
-     * Check whether extension is critical.
210
-     *
211
-     * @return bool
212
-     */
213
-    public function isCritical(): bool
214
-    {
215
-        return $this->_critical;
216
-    }
208
+	/**
209
+	 * Check whether extension is critical.
210
+	 *
211
+	 * @return bool
212
+	 */
213
+	public function isCritical(): bool
214
+	{
215
+		return $this->_critical;
216
+	}
217 217
     
218
-    /**
219
-     * Generate ASN.1 structure.
220
-     *
221
-     * @return Sequence
222
-     */
223
-    public function toASN1(): Sequence
224
-    {
225
-        $elements = array(new ObjectIdentifier($this->_oid));
226
-        if ($this->_critical) {
227
-            $elements[] = new Boolean(true);
228
-        }
229
-        $elements[] = new OctetString($this->_valueASN1()->toDER());
230
-        return new Sequence(...$elements);
231
-    }
218
+	/**
219
+	 * Generate ASN.1 structure.
220
+	 *
221
+	 * @return Sequence
222
+	 */
223
+	public function toASN1(): Sequence
224
+	{
225
+		$elements = array(new ObjectIdentifier($this->_oid));
226
+		if ($this->_critical) {
227
+			$elements[] = new Boolean(true);
228
+		}
229
+		$elements[] = new OctetString($this->_valueASN1()->toDER());
230
+		return new Sequence(...$elements);
231
+	}
232 232
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/SubjectAlternativeNameExtension.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -14,53 +14,53 @@
 block discarded – undo
14 14
  */
15 15
 class SubjectAlternativeNameExtension extends Extension
16 16
 {
17
-    /**
18
-     * Names.
19
-     *
20
-     * @var GeneralNames $_names
21
-     */
22
-    protected $_names;
17
+	/**
18
+	 * Names.
19
+	 *
20
+	 * @var GeneralNames $_names
21
+	 */
22
+	protected $_names;
23 23
     
24
-    /**
25
-     * Constructor.
26
-     *
27
-     * @param bool $critical
28
-     * @param GeneralNames $names
29
-     */
30
-    public function __construct(bool $critical, GeneralNames $names)
31
-    {
32
-        parent::__construct(self::OID_SUBJECT_ALT_NAME, $critical);
33
-        $this->_names = $names;
34
-    }
24
+	/**
25
+	 * Constructor.
26
+	 *
27
+	 * @param bool $critical
28
+	 * @param GeneralNames $names
29
+	 */
30
+	public function __construct(bool $critical, GeneralNames $names)
31
+	{
32
+		parent::__construct(self::OID_SUBJECT_ALT_NAME, $critical);
33
+		$this->_names = $names;
34
+	}
35 35
     
36
-    /**
37
-     *
38
-     * {@inheritdoc}
39
-     * @return self
40
-     */
41
-    protected static function _fromDER($data, $critical)
42
-    {
43
-        return new self($critical,
44
-            GeneralNames::fromASN1(Sequence::fromDER($data)));
45
-    }
36
+	/**
37
+	 *
38
+	 * {@inheritdoc}
39
+	 * @return self
40
+	 */
41
+	protected static function _fromDER($data, $critical)
42
+	{
43
+		return new self($critical,
44
+			GeneralNames::fromASN1(Sequence::fromDER($data)));
45
+	}
46 46
     
47
-    /**
48
-     * Get names.
49
-     *
50
-     * @return GeneralNames
51
-     */
52
-    public function names(): GeneralNames
53
-    {
54
-        return $this->_names;
55
-    }
47
+	/**
48
+	 * Get names.
49
+	 *
50
+	 * @return GeneralNames
51
+	 */
52
+	public function names(): GeneralNames
53
+	{
54
+		return $this->_names;
55
+	}
56 56
     
57
-    /**
58
-     *
59
-     * {@inheritdoc}
60
-     * @return Sequence
61
-     */
62
-    protected function _valueASN1(): Sequence
63
-    {
64
-        return $this->_names->toASN1();
65
-    }
57
+	/**
58
+	 *
59
+	 * {@inheritdoc}
60
+	 * @return Sequence
61
+	 */
62
+	protected function _valueASN1(): Sequence
63
+	{
64
+		return $this->_names->toASN1();
65
+	}
66 66
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/PolicyMappings/PolicyMapping.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -15,77 +15,77 @@
 block discarded – undo
15 15
  */
16 16
 class PolicyMapping
17 17
 {
18
-    /**
19
-     * OID of the issuer policy.
20
-     *
21
-     * @var string $_issuerDomainPolicy
22
-     */
23
-    protected $_issuerDomainPolicy;
18
+	/**
19
+	 * OID of the issuer policy.
20
+	 *
21
+	 * @var string $_issuerDomainPolicy
22
+	 */
23
+	protected $_issuerDomainPolicy;
24 24
     
25
-    /**
26
-     * OID of the subject policy.
27
-     *
28
-     * @var string $_subjectDomainPolicy
29
-     */
30
-    protected $_subjectDomainPolicy;
25
+	/**
26
+	 * OID of the subject policy.
27
+	 *
28
+	 * @var string $_subjectDomainPolicy
29
+	 */
30
+	protected $_subjectDomainPolicy;
31 31
     
32
-    /**
33
-     * Constructor.
34
-     *
35
-     * @param string $issuer_policy OID of the issuer policy
36
-     * @param string $subject_policy OID of the subject policy
37
-     */
38
-    public function __construct($issuer_policy, $subject_policy)
39
-    {
40
-        $this->_issuerDomainPolicy = $issuer_policy;
41
-        $this->_subjectDomainPolicy = $subject_policy;
42
-    }
32
+	/**
33
+	 * Constructor.
34
+	 *
35
+	 * @param string $issuer_policy OID of the issuer policy
36
+	 * @param string $subject_policy OID of the subject policy
37
+	 */
38
+	public function __construct($issuer_policy, $subject_policy)
39
+	{
40
+		$this->_issuerDomainPolicy = $issuer_policy;
41
+		$this->_subjectDomainPolicy = $subject_policy;
42
+	}
43 43
     
44
-    /**
45
-     * Initialize from ASN.1.
46
-     *
47
-     * @param Sequence $seq
48
-     * @return self
49
-     */
50
-    public static function fromASN1(Sequence $seq)
51
-    {
52
-        $issuer_policy = $seq->at(0)
53
-            ->asObjectIdentifier()
54
-            ->oid();
55
-        $subject_policy = $seq->at(1)
56
-            ->asObjectIdentifier()
57
-            ->oid();
58
-        return new self($issuer_policy, $subject_policy);
59
-    }
44
+	/**
45
+	 * Initialize from ASN.1.
46
+	 *
47
+	 * @param Sequence $seq
48
+	 * @return self
49
+	 */
50
+	public static function fromASN1(Sequence $seq)
51
+	{
52
+		$issuer_policy = $seq->at(0)
53
+			->asObjectIdentifier()
54
+			->oid();
55
+		$subject_policy = $seq->at(1)
56
+			->asObjectIdentifier()
57
+			->oid();
58
+		return new self($issuer_policy, $subject_policy);
59
+	}
60 60
     
61
-    /**
62
-     * Get issuer domain policy.
63
-     *
64
-     * @return string OID in dotted format
65
-     */
66
-    public function issuerDomainPolicy(): string
67
-    {
68
-        return $this->_issuerDomainPolicy;
69
-    }
61
+	/**
62
+	 * Get issuer domain policy.
63
+	 *
64
+	 * @return string OID in dotted format
65
+	 */
66
+	public function issuerDomainPolicy(): string
67
+	{
68
+		return $this->_issuerDomainPolicy;
69
+	}
70 70
     
71
-    /**
72
-     * Get subject domain policy.
73
-     *
74
-     * @return string OID in dotted format
75
-     */
76
-    public function subjectDomainPolicy(): string
77
-    {
78
-        return $this->_subjectDomainPolicy;
79
-    }
71
+	/**
72
+	 * Get subject domain policy.
73
+	 *
74
+	 * @return string OID in dotted format
75
+	 */
76
+	public function subjectDomainPolicy(): string
77
+	{
78
+		return $this->_subjectDomainPolicy;
79
+	}
80 80
     
81
-    /**
82
-     * Generate ASN.1 structure.
83
-     *
84
-     * @return Sequence
85
-     */
86
-    public function toASN1(): Sequence
87
-    {
88
-        return new Sequence(new ObjectIdentifier($this->_issuerDomainPolicy),
89
-            new ObjectIdentifier($this->_subjectDomainPolicy));
90
-    }
81
+	/**
82
+	 * Generate ASN.1 structure.
83
+	 *
84
+	 * @return Sequence
85
+	 */
86
+	public function toASN1(): Sequence
87
+	{
88
+		return new Sequence(new ObjectIdentifier($this->_issuerDomainPolicy),
89
+			new ObjectIdentifier($this->_subjectDomainPolicy));
90
+	}
91 91
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/PolicyConstraintsExtension.php 1 patch
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -16,123 +16,123 @@
 block discarded – undo
16 16
  */
17 17
 class PolicyConstraintsExtension extends Extension
18 18
 {
19
-    /**
20
-     *
21
-     * @var int $_requireExplicitPolicy
22
-     */
23
-    protected $_requireExplicitPolicy;
19
+	/**
20
+	 *
21
+	 * @var int $_requireExplicitPolicy
22
+	 */
23
+	protected $_requireExplicitPolicy;
24 24
     
25
-    /**
26
-     *
27
-     * @var int $_inhibitPolicyMapping
28
-     */
29
-    protected $_inhibitPolicyMapping;
25
+	/**
26
+	 *
27
+	 * @var int $_inhibitPolicyMapping
28
+	 */
29
+	protected $_inhibitPolicyMapping;
30 30
     
31
-    /**
32
-     * Constructor.
33
-     *
34
-     * @param bool $critical
35
-     * @param int|null $require_explicit_policy
36
-     * @param int|null $inhibit_policy_mapping
37
-     */
38
-    public function __construct(bool $critical, $require_explicit_policy = null,
39
-        $inhibit_policy_mapping = null)
40
-    {
41
-        parent::__construct(self::OID_POLICY_CONSTRAINTS, $critical);
42
-        $this->_requireExplicitPolicy = $require_explicit_policy;
43
-        $this->_inhibitPolicyMapping = $inhibit_policy_mapping;
44
-    }
31
+	/**
32
+	 * Constructor.
33
+	 *
34
+	 * @param bool $critical
35
+	 * @param int|null $require_explicit_policy
36
+	 * @param int|null $inhibit_policy_mapping
37
+	 */
38
+	public function __construct(bool $critical, $require_explicit_policy = null,
39
+		$inhibit_policy_mapping = null)
40
+	{
41
+		parent::__construct(self::OID_POLICY_CONSTRAINTS, $critical);
42
+		$this->_requireExplicitPolicy = $require_explicit_policy;
43
+		$this->_inhibitPolicyMapping = $inhibit_policy_mapping;
44
+	}
45 45
     
46
-    /**
47
-     *
48
-     * {@inheritdoc}
49
-     * @return self
50
-     */
51
-    protected static function _fromDER($data, $critical)
52
-    {
53
-        $seq = Sequence::fromDER($data);
54
-        $require_explicit_policy = null;
55
-        $inhibit_policy_mapping = null;
56
-        if ($seq->hasTagged(0)) {
57
-            $require_explicit_policy = $seq->getTagged(0)
58
-                ->asImplicit(Element::TYPE_INTEGER)
59
-                ->asInteger()
60
-                ->number();
61
-        }
62
-        if ($seq->hasTagged(1)) {
63
-            $inhibit_policy_mapping = $seq->getTagged(1)
64
-                ->asImplicit(Element::TYPE_INTEGER)
65
-                ->asInteger()
66
-                ->number();
67
-        }
68
-        return new self($critical, $require_explicit_policy,
69
-            $inhibit_policy_mapping);
70
-    }
46
+	/**
47
+	 *
48
+	 * {@inheritdoc}
49
+	 * @return self
50
+	 */
51
+	protected static function _fromDER($data, $critical)
52
+	{
53
+		$seq = Sequence::fromDER($data);
54
+		$require_explicit_policy = null;
55
+		$inhibit_policy_mapping = null;
56
+		if ($seq->hasTagged(0)) {
57
+			$require_explicit_policy = $seq->getTagged(0)
58
+				->asImplicit(Element::TYPE_INTEGER)
59
+				->asInteger()
60
+				->number();
61
+		}
62
+		if ($seq->hasTagged(1)) {
63
+			$inhibit_policy_mapping = $seq->getTagged(1)
64
+				->asImplicit(Element::TYPE_INTEGER)
65
+				->asInteger()
66
+				->number();
67
+		}
68
+		return new self($critical, $require_explicit_policy,
69
+			$inhibit_policy_mapping);
70
+	}
71 71
     
72
-    /**
73
-     * Whether requireExplicitPolicy is present.
74
-     *
75
-     * @return bool
76
-     */
77
-    public function hasRequireExplicitPolicy(): bool
78
-    {
79
-        return isset($this->_requireExplicitPolicy);
80
-    }
72
+	/**
73
+	 * Whether requireExplicitPolicy is present.
74
+	 *
75
+	 * @return bool
76
+	 */
77
+	public function hasRequireExplicitPolicy(): bool
78
+	{
79
+		return isset($this->_requireExplicitPolicy);
80
+	}
81 81
     
82
-    /**
83
-     * Get requireExplicitPolicy.
84
-     *
85
-     * @throws \LogicException
86
-     * @return int
87
-     */
88
-    public function requireExplicitPolicy()
89
-    {
90
-        if (!$this->hasRequireExplicitPolicy()) {
91
-            throw new \LogicException("requireExplicitPolicy not set.");
92
-        }
93
-        return $this->_requireExplicitPolicy;
94
-    }
82
+	/**
83
+	 * Get requireExplicitPolicy.
84
+	 *
85
+	 * @throws \LogicException
86
+	 * @return int
87
+	 */
88
+	public function requireExplicitPolicy()
89
+	{
90
+		if (!$this->hasRequireExplicitPolicy()) {
91
+			throw new \LogicException("requireExplicitPolicy not set.");
92
+		}
93
+		return $this->_requireExplicitPolicy;
94
+	}
95 95
     
96
-    /**
97
-     * Whether inhibitPolicyMapping is present.
98
-     *
99
-     * @return bool
100
-     */
101
-    public function hasInhibitPolicyMapping(): bool
102
-    {
103
-        return isset($this->_inhibitPolicyMapping);
104
-    }
96
+	/**
97
+	 * Whether inhibitPolicyMapping is present.
98
+	 *
99
+	 * @return bool
100
+	 */
101
+	public function hasInhibitPolicyMapping(): bool
102
+	{
103
+		return isset($this->_inhibitPolicyMapping);
104
+	}
105 105
     
106
-    /**
107
-     * Get inhibitPolicyMapping.
108
-     *
109
-     * @throws \LogicException
110
-     * @return int
111
-     */
112
-    public function inhibitPolicyMapping()
113
-    {
114
-        if (!$this->hasInhibitPolicyMapping()) {
115
-            throw new \LogicException("inhibitPolicyMapping not set.");
116
-        }
117
-        return $this->_inhibitPolicyMapping;
118
-    }
106
+	/**
107
+	 * Get inhibitPolicyMapping.
108
+	 *
109
+	 * @throws \LogicException
110
+	 * @return int
111
+	 */
112
+	public function inhibitPolicyMapping()
113
+	{
114
+		if (!$this->hasInhibitPolicyMapping()) {
115
+			throw new \LogicException("inhibitPolicyMapping not set.");
116
+		}
117
+		return $this->_inhibitPolicyMapping;
118
+	}
119 119
     
120
-    /**
121
-     *
122
-     * {@inheritdoc}
123
-     * @return Sequence
124
-     */
125
-    protected function _valueASN1()
126
-    {
127
-        $elements = array();
128
-        if (isset($this->_requireExplicitPolicy)) {
129
-            $elements[] = new ImplicitlyTaggedType(0,
130
-                new Integer($this->_requireExplicitPolicy));
131
-        }
132
-        if (isset($this->_inhibitPolicyMapping)) {
133
-            $elements[] = new ImplicitlyTaggedType(1,
134
-                new Integer($this->_inhibitPolicyMapping));
135
-        }
136
-        return new Sequence(...$elements);
137
-    }
120
+	/**
121
+	 *
122
+	 * {@inheritdoc}
123
+	 * @return Sequence
124
+	 */
125
+	protected function _valueASN1()
126
+	{
127
+		$elements = array();
128
+		if (isset($this->_requireExplicitPolicy)) {
129
+			$elements[] = new ImplicitlyTaggedType(0,
130
+				new Integer($this->_requireExplicitPolicy));
131
+		}
132
+		if (isset($this->_inhibitPolicyMapping)) {
133
+			$elements[] = new ImplicitlyTaggedType(1,
134
+				new Integer($this->_inhibitPolicyMapping));
135
+		}
136
+		return new Sequence(...$elements);
137
+	}
138 138
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/AuthorityKeyIdentifierExtension.php 1 patch
Indentation   +156 added lines, -156 removed lines patch added patch discarded remove patch
@@ -18,170 +18,170 @@
 block discarded – undo
18 18
  */
19 19
 class AuthorityKeyIdentifierExtension extends Extension
20 20
 {
21
-    /**
22
-     * Key identifier.
23
-     *
24
-     * @var string|null $_keyIdentifier
25
-     */
26
-    protected $_keyIdentifier;
21
+	/**
22
+	 * Key identifier.
23
+	 *
24
+	 * @var string|null $_keyIdentifier
25
+	 */
26
+	protected $_keyIdentifier;
27 27
 
28
-    /**
29
-     * Issuer name.
30
-     *
31
-     * @var GeneralNames|null $_authorityCertIssuer
32
-     */
33
-    protected $_authorityCertIssuer;
28
+	/**
29
+	 * Issuer name.
30
+	 *
31
+	 * @var GeneralNames|null $_authorityCertIssuer
32
+	 */
33
+	protected $_authorityCertIssuer;
34 34
 
35
-    /**
36
-     * Issuer serial number.
37
-     *
38
-     * @var int|string|null $_authorityCertSerialNumber
39
-     */
40
-    protected $_authorityCertSerialNumber;
35
+	/**
36
+	 * Issuer serial number.
37
+	 *
38
+	 * @var int|string|null $_authorityCertSerialNumber
39
+	 */
40
+	protected $_authorityCertSerialNumber;
41 41
 
42
-    /**
43
-     * Constructor.
44
-     *
45
-     * @param bool $critical Conforming CA's must mark as non-critical (false)
46
-     * @param string|null $keyIdentifier
47
-     * @param GeneralNames|null $issuer
48
-     * @param int|string|null $serial
49
-     */
50
-    public function __construct(bool $critical, $keyIdentifier,
51
-        GeneralNames $issuer = null, $serial = null)
52
-    {
53
-        parent::__construct(self::OID_AUTHORITY_KEY_IDENTIFIER, $critical);
54
-        $this->_keyIdentifier = $keyIdentifier;
55
-        $this->_authorityCertIssuer = $issuer;
56
-        $this->_authorityCertSerialNumber = $serial;
57
-    }
42
+	/**
43
+	 * Constructor.
44
+	 *
45
+	 * @param bool $critical Conforming CA's must mark as non-critical (false)
46
+	 * @param string|null $keyIdentifier
47
+	 * @param GeneralNames|null $issuer
48
+	 * @param int|string|null $serial
49
+	 */
50
+	public function __construct(bool $critical, $keyIdentifier,
51
+		GeneralNames $issuer = null, $serial = null)
52
+	{
53
+		parent::__construct(self::OID_AUTHORITY_KEY_IDENTIFIER, $critical);
54
+		$this->_keyIdentifier = $keyIdentifier;
55
+		$this->_authorityCertIssuer = $issuer;
56
+		$this->_authorityCertSerialNumber = $serial;
57
+	}
58 58
 
59
-    /**
60
-     *
61
-     * {@inheritdoc}
62
-     * @return self
63
-     */
64
-    protected static function _fromDER($data, $critical)
65
-    {
66
-        $seq = Sequence::fromDER($data);
67
-        $keyIdentifier = null;
68
-        $issuer = null;
69
-        $serial = null;
70
-        if ($seq->hasTagged(0)) {
71
-            $keyIdentifier = $seq->getTagged(0)
72
-                ->asImplicit(Element::TYPE_OCTET_STRING)
73
-                ->asOctetString()
74
-                ->string();
75
-        }
76
-        if ($seq->hasTagged(1) || $seq->hasTagged(2)) {
77
-            if (!$seq->hasTagged(1) || !$seq->hasTagged(2)) {
78
-                throw new \UnexpectedValueException(
79
-                    "AuthorityKeyIdentifier must have both" .
80
-                         " authorityCertIssuer and authorityCertSerialNumber" .
81
-                         " present or both absent.");
82
-            }
83
-            $issuer = GeneralNames::fromASN1(
84
-                $seq->getTagged(1)
85
-                    ->asImplicit(Element::TYPE_SEQUENCE)
86
-                    ->asSequence());
87
-            $serial = $seq->getTagged(2)
88
-                ->asImplicit(Element::TYPE_INTEGER)
89
-                ->asInteger()
90
-                ->number();
91
-        }
92
-        return new self($critical, $keyIdentifier, $issuer, $serial);
93
-    }
59
+	/**
60
+	 *
61
+	 * {@inheritdoc}
62
+	 * @return self
63
+	 */
64
+	protected static function _fromDER($data, $critical)
65
+	{
66
+		$seq = Sequence::fromDER($data);
67
+		$keyIdentifier = null;
68
+		$issuer = null;
69
+		$serial = null;
70
+		if ($seq->hasTagged(0)) {
71
+			$keyIdentifier = $seq->getTagged(0)
72
+				->asImplicit(Element::TYPE_OCTET_STRING)
73
+				->asOctetString()
74
+				->string();
75
+		}
76
+		if ($seq->hasTagged(1) || $seq->hasTagged(2)) {
77
+			if (!$seq->hasTagged(1) || !$seq->hasTagged(2)) {
78
+				throw new \UnexpectedValueException(
79
+					"AuthorityKeyIdentifier must have both" .
80
+						 " authorityCertIssuer and authorityCertSerialNumber" .
81
+						 " present or both absent.");
82
+			}
83
+			$issuer = GeneralNames::fromASN1(
84
+				$seq->getTagged(1)
85
+					->asImplicit(Element::TYPE_SEQUENCE)
86
+					->asSequence());
87
+			$serial = $seq->getTagged(2)
88
+				->asImplicit(Element::TYPE_INTEGER)
89
+				->asInteger()
90
+				->number();
91
+		}
92
+		return new self($critical, $keyIdentifier, $issuer, $serial);
93
+	}
94 94
 
95
-    /**
96
-     * Whether key identifier is present.
97
-     *
98
-     * @return bool
99
-     */
100
-    public function hasKeyIdentifier(): bool
101
-    {
102
-        return isset($this->_keyIdentifier);
103
-    }
95
+	/**
96
+	 * Whether key identifier is present.
97
+	 *
98
+	 * @return bool
99
+	 */
100
+	public function hasKeyIdentifier(): bool
101
+	{
102
+		return isset($this->_keyIdentifier);
103
+	}
104 104
     
105
-    /**
106
-     * Get key identifier.
107
-     *
108
-     * @throws \LogicException
109
-     * @return string
110
-     */
111
-    public function keyIdentifier(): string
112
-    {
113
-        if (!$this->hasKeyIdentifier()) {
114
-            throw new \LogicException("keyIdentifier not set.");
115
-        }
116
-        return $this->_keyIdentifier;
117
-    }
105
+	/**
106
+	 * Get key identifier.
107
+	 *
108
+	 * @throws \LogicException
109
+	 * @return string
110
+	 */
111
+	public function keyIdentifier(): string
112
+	{
113
+		if (!$this->hasKeyIdentifier()) {
114
+			throw new \LogicException("keyIdentifier not set.");
115
+		}
116
+		return $this->_keyIdentifier;
117
+	}
118 118
     
119
-    /**
120
-     * Whether issuer is present.
121
-     *
122
-     * @return bool
123
-     */
124
-    public function hasIssuer(): bool
125
-    {
126
-        return isset($this->_authorityCertIssuer);
127
-    }
119
+	/**
120
+	 * Whether issuer is present.
121
+	 *
122
+	 * @return bool
123
+	 */
124
+	public function hasIssuer(): bool
125
+	{
126
+		return isset($this->_authorityCertIssuer);
127
+	}
128 128
     
129
-    /**
130
-     * Get issuer.
131
-     *
132
-     * @throws \LogicException
133
-     * @return GeneralNames
134
-     */
135
-    public function issuer(): GeneralNames
136
-    {
137
-        if (!$this->hasIssuer()) {
138
-            throw new \LogicException("authorityCertIssuer not set.");
139
-        }
140
-        return $this->_authorityCertIssuer;
141
-    }
129
+	/**
130
+	 * Get issuer.
131
+	 *
132
+	 * @throws \LogicException
133
+	 * @return GeneralNames
134
+	 */
135
+	public function issuer(): GeneralNames
136
+	{
137
+		if (!$this->hasIssuer()) {
138
+			throw new \LogicException("authorityCertIssuer not set.");
139
+		}
140
+		return $this->_authorityCertIssuer;
141
+	}
142 142
     
143
-    /**
144
-     * Get serial number.
145
-     *
146
-     * @throws \LogicException
147
-     * @return int|string
148
-     */
149
-    public function serial()
150
-    {
151
-        // both issuer and serial must be present or both absent
152
-        if (!$this->hasIssuer()) {
153
-            throw new \LogicException("authorityCertSerialNumber not set.");
154
-        }
155
-        return $this->_authorityCertSerialNumber;
156
-    }
143
+	/**
144
+	 * Get serial number.
145
+	 *
146
+	 * @throws \LogicException
147
+	 * @return int|string
148
+	 */
149
+	public function serial()
150
+	{
151
+		// both issuer and serial must be present or both absent
152
+		if (!$this->hasIssuer()) {
153
+			throw new \LogicException("authorityCertSerialNumber not set.");
154
+		}
155
+		return $this->_authorityCertSerialNumber;
156
+	}
157 157
     
158
-    /**
159
-     *
160
-     * {@inheritdoc}
161
-     * @return Sequence
162
-     */
163
-    protected function _valueASN1()
164
-    {
165
-        $elements = array();
166
-        if (isset($this->_keyIdentifier)) {
167
-            $elements[] = new ImplicitlyTaggedType(0,
168
-                new OctetString($this->_keyIdentifier));
169
-        }
170
-        // if either issuer or serial is set, both must be set
171
-        if (isset($this->_authorityCertIssuer) ||
172
-             isset($this->_authorityCertSerialNumber)) {
173
-            if (!isset($this->_authorityCertIssuer,
174
-                $this->_authorityCertSerialNumber)) {
175
-                throw new \LogicException(
176
-                    "AuthorityKeyIdentifier must have both" .
177
-                     " authorityCertIssuer and authorityCertSerialNumber" .
178
-                     " present or both absent.");
179
-            }
180
-            $elements[] = new ImplicitlyTaggedType(1,
181
-                $this->_authorityCertIssuer->toASN1());
182
-            $elements[] = new ImplicitlyTaggedType(2,
183
-                new Integer($this->_authorityCertSerialNumber));
184
-        }
185
-        return new Sequence(...$elements);
186
-    }
158
+	/**
159
+	 *
160
+	 * {@inheritdoc}
161
+	 * @return Sequence
162
+	 */
163
+	protected function _valueASN1()
164
+	{
165
+		$elements = array();
166
+		if (isset($this->_keyIdentifier)) {
167
+			$elements[] = new ImplicitlyTaggedType(0,
168
+				new OctetString($this->_keyIdentifier));
169
+		}
170
+		// if either issuer or serial is set, both must be set
171
+		if (isset($this->_authorityCertIssuer) ||
172
+			 isset($this->_authorityCertSerialNumber)) {
173
+			if (!isset($this->_authorityCertIssuer,
174
+				$this->_authorityCertSerialNumber)) {
175
+				throw new \LogicException(
176
+					"AuthorityKeyIdentifier must have both" .
177
+					 " authorityCertIssuer and authorityCertSerialNumber" .
178
+					 " present or both absent.");
179
+			}
180
+			$elements[] = new ImplicitlyTaggedType(1,
181
+				$this->_authorityCertIssuer->toASN1());
182
+			$elements[] = new ImplicitlyTaggedType(2,
183
+				new Integer($this->_authorityCertSerialNumber));
184
+		}
185
+		return new Sequence(...$elements);
186
+	}
187 187
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/SubjectDirectoryAttributesExtension.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -15,55 +15,55 @@
 block discarded – undo
15 15
  * @link https://tools.ietf.org/html/rfc5280#section-4.2.1.8
16 16
  */
17 17
 class SubjectDirectoryAttributesExtension extends Extension implements 
18
-    \Countable,
19
-    \IteratorAggregate
18
+	\Countable,
19
+	\IteratorAggregate
20 20
 {
21
-    use AttributeContainer;
21
+	use AttributeContainer;
22 22
     
23
-    /**
24
-     * Constructor.
25
-     *
26
-     * @param bool $critical
27
-     * @param Attribute ...$attribs One or more Attribute objects
28
-     */
29
-    public function __construct(bool $critical, Attribute ...$attribs)
30
-    {
31
-        parent::__construct(self::OID_SUBJECT_DIRECTORY_ATTRIBUTES, $critical);
32
-        $this->_attributes = $attribs;
33
-    }
23
+	/**
24
+	 * Constructor.
25
+	 *
26
+	 * @param bool $critical
27
+	 * @param Attribute ...$attribs One or more Attribute objects
28
+	 */
29
+	public function __construct(bool $critical, Attribute ...$attribs)
30
+	{
31
+		parent::__construct(self::OID_SUBJECT_DIRECTORY_ATTRIBUTES, $critical);
32
+		$this->_attributes = $attribs;
33
+	}
34 34
     
35
-    /**
36
-     *
37
-     * {@inheritdoc}
38
-     * @return self
39
-     */
40
-    protected static function _fromDER($data, $critical)
41
-    {
42
-        $attribs = array_map(
43
-            function (UnspecifiedType $el) {
44
-                return Attribute::fromASN1($el->asSequence());
45
-            }, Sequence::fromDER($data)->elements());
46
-        if (!count($attribs)) {
47
-            throw new \UnexpectedValueException(
48
-                "SubjectDirectoryAttributes must have at least one Attribute.");
49
-        }
50
-        return new self($critical, ...$attribs);
51
-    }
35
+	/**
36
+	 *
37
+	 * {@inheritdoc}
38
+	 * @return self
39
+	 */
40
+	protected static function _fromDER($data, $critical)
41
+	{
42
+		$attribs = array_map(
43
+			function (UnspecifiedType $el) {
44
+				return Attribute::fromASN1($el->asSequence());
45
+			}, Sequence::fromDER($data)->elements());
46
+		if (!count($attribs)) {
47
+			throw new \UnexpectedValueException(
48
+				"SubjectDirectoryAttributes must have at least one Attribute.");
49
+		}
50
+		return new self($critical, ...$attribs);
51
+	}
52 52
     
53
-    /**
54
-     *
55
-     * {@inheritdoc}
56
-     * @return Sequence
57
-     */
58
-    protected function _valueASN1(): Sequence
59
-    {
60
-        if (!count($this->_attributes)) {
61
-            throw new \LogicException("No attributes");
62
-        }
63
-        $elements = array_map(
64
-            function (Attribute $attr) {
65
-                return $attr->toASN1();
66
-            }, array_values($this->_attributes));
67
-        return new Sequence(...$elements);
68
-    }
53
+	/**
54
+	 *
55
+	 * {@inheritdoc}
56
+	 * @return Sequence
57
+	 */
58
+	protected function _valueASN1(): Sequence
59
+	{
60
+		if (!count($this->_attributes)) {
61
+			throw new \LogicException("No attributes");
62
+		}
63
+		$elements = array_map(
64
+			function (Attribute $attr) {
65
+				return $attr->toASN1();
66
+			}, array_values($this->_attributes));
67
+		return new Sequence(...$elements);
68
+	}
69 69
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/DistributionPoint/FullName.php 1 patch
Indentation   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -15,52 +15,52 @@
 block discarded – undo
15 15
  */
16 16
 class FullName extends DistributionPointName
17 17
 {
18
-    /**
19
-     * Names.
20
-     *
21
-     * @var GeneralNames $_names
22
-     */
23
-    protected $_names;
18
+	/**
19
+	 * Names.
20
+	 *
21
+	 * @var GeneralNames $_names
22
+	 */
23
+	protected $_names;
24 24
     
25
-    /**
26
-     * Constructor.
27
-     *
28
-     * @param GeneralNames $names
29
-     */
30
-    public function __construct(GeneralNames $names)
31
-    {
32
-        $this->_tag = self::TAG_FULL_NAME;
33
-        $this->_names = $names;
34
-    }
25
+	/**
26
+	 * Constructor.
27
+	 *
28
+	 * @param GeneralNames $names
29
+	 */
30
+	public function __construct(GeneralNames $names)
31
+	{
32
+		$this->_tag = self::TAG_FULL_NAME;
33
+		$this->_names = $names;
34
+	}
35 35
     
36
-    /**
37
-     * Initialize with a single URI.
38
-     *
39
-     * @param string $uri
40
-     * @return self
41
-     */
42
-    public static function fromURI(string $uri)
43
-    {
44
-        return new self(new GeneralNames(new UniformResourceIdentifier($uri)));
45
-    }
36
+	/**
37
+	 * Initialize with a single URI.
38
+	 *
39
+	 * @param string $uri
40
+	 * @return self
41
+	 */
42
+	public static function fromURI(string $uri)
43
+	{
44
+		return new self(new GeneralNames(new UniformResourceIdentifier($uri)));
45
+	}
46 46
     
47
-    /**
48
-     * Get names.
49
-     *
50
-     * @return GeneralNames
51
-     */
52
-    public function names(): GeneralNames
53
-    {
54
-        return $this->_names;
55
-    }
47
+	/**
48
+	 * Get names.
49
+	 *
50
+	 * @return GeneralNames
51
+	 */
52
+	public function names(): GeneralNames
53
+	{
54
+		return $this->_names;
55
+	}
56 56
     
57
-    /**
58
-     *
59
-     * {@inheritdoc}
60
-     * @return \ASN1\Type\Constructed\Sequence
61
-     */
62
-    protected function _valueASN1(): \ASN1\Type\Constructed\Sequence
63
-    {
64
-        return $this->_names->toASN1();
65
-    }
57
+	/**
58
+	 *
59
+	 * {@inheritdoc}
60
+	 * @return \ASN1\Type\Constructed\Sequence
61
+	 */
62
+	protected function _valueASN1(): \ASN1\Type\Constructed\Sequence
63
+	{
64
+		return $this->_names->toASN1();
65
+	}
66 66
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/DistributionPoint/RelativeName.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -15,41 +15,41 @@
 block discarded – undo
15 15
  */
16 16
 class RelativeName extends DistributionPointName
17 17
 {
18
-    /**
19
-     * Relative distinguished name.
20
-     *
21
-     * @var RDN $_rdn
22
-     */
23
-    protected $_rdn;
18
+	/**
19
+	 * Relative distinguished name.
20
+	 *
21
+	 * @var RDN $_rdn
22
+	 */
23
+	protected $_rdn;
24 24
     
25
-    /**
26
-     * Constructor.
27
-     *
28
-     * @param RDN $rdn
29
-     */
30
-    public function __construct(RDN $rdn)
31
-    {
32
-        $this->_tag = self::TAG_RDN;
33
-        $this->_rdn = $rdn;
34
-    }
25
+	/**
26
+	 * Constructor.
27
+	 *
28
+	 * @param RDN $rdn
29
+	 */
30
+	public function __construct(RDN $rdn)
31
+	{
32
+		$this->_tag = self::TAG_RDN;
33
+		$this->_rdn = $rdn;
34
+	}
35 35
     
36
-    /**
37
-     * Get RDN.
38
-     *
39
-     * @return RDN
40
-     */
41
-    public function rdn(): RDN
42
-    {
43
-        return $this->_rdn;
44
-    }
36
+	/**
37
+	 * Get RDN.
38
+	 *
39
+	 * @return RDN
40
+	 */
41
+	public function rdn(): RDN
42
+	{
43
+		return $this->_rdn;
44
+	}
45 45
     
46
-    /**
47
-     *
48
-     * {@inheritdoc}
49
-     * @return \ASN1\Type\Constructed\Set
50
-     */
51
-    protected function _valueASN1(): \ASN1\Type\Constructed\Set
52
-    {
53
-        return $this->_rdn->toASN1();
54
-    }
46
+	/**
47
+	 *
48
+	 * {@inheritdoc}
49
+	 * @return \ASN1\Type\Constructed\Set
50
+	 */
51
+	protected function _valueASN1(): \ASN1\Type\Constructed\Set
52
+	{
53
+		return $this->_rdn->toASN1();
54
+	}
55 55
 }
Please login to merge, or discard this patch.
lib/X509/Certificate/Extension/DistributionPoint/DistributionPoint.php 1 patch
Indentation   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -18,215 +18,215 @@
 block discarded – undo
18 18
  */
19 19
 class DistributionPoint
20 20
 {
21
-    /**
22
-     * Distribution point name.
23
-     *
24
-     * @var DistributionPointName $_distributionPoint
25
-     */
26
-    protected $_distributionPoint;
21
+	/**
22
+	 * Distribution point name.
23
+	 *
24
+	 * @var DistributionPointName $_distributionPoint
25
+	 */
26
+	protected $_distributionPoint;
27 27
     
28
-    /**
29
-     * Revocation reason.
30
-     *
31
-     * @var ReasonFlags $_reasons
32
-     */
33
-    protected $_reasons;
28
+	/**
29
+	 * Revocation reason.
30
+	 *
31
+	 * @var ReasonFlags $_reasons
32
+	 */
33
+	protected $_reasons;
34 34
     
35
-    /**
36
-     * CRL issuer.
37
-     *
38
-     * @var GeneralNames $_issuer
39
-     */
40
-    protected $_issuer;
35
+	/**
36
+	 * CRL issuer.
37
+	 *
38
+	 * @var GeneralNames $_issuer
39
+	 */
40
+	protected $_issuer;
41 41
     
42
-    /**
43
-     * Constructor.
44
-     *
45
-     * @param DistributionPointName $name
46
-     * @param ReasonFlags $reasons
47
-     * @param GeneralNames $issuer
48
-     */
49
-    public function __construct(DistributionPointName $name = null,
50
-        ReasonFlags $reasons = null, GeneralNames $issuer = null)
51
-    {
52
-        $this->_distributionPoint = $name;
53
-        $this->_reasons = $reasons;
54
-        $this->_issuer = $issuer;
55
-    }
42
+	/**
43
+	 * Constructor.
44
+	 *
45
+	 * @param DistributionPointName $name
46
+	 * @param ReasonFlags $reasons
47
+	 * @param GeneralNames $issuer
48
+	 */
49
+	public function __construct(DistributionPointName $name = null,
50
+		ReasonFlags $reasons = null, GeneralNames $issuer = null)
51
+	{
52
+		$this->_distributionPoint = $name;
53
+		$this->_reasons = $reasons;
54
+		$this->_issuer = $issuer;
55
+	}
56 56
     
57
-    /**
58
-     * Initialize from ASN.1.
59
-     *
60
-     * @param Sequence $seq
61
-     * @return self
62
-     */
63
-    public static function fromASN1(Sequence $seq)
64
-    {
65
-        $name = null;
66
-        $reasons = null;
67
-        $issuer = null;
68
-        if ($seq->hasTagged(0)) {
69
-            // promoted to explicit tagging because underlying type is CHOICE
70
-            $name = DistributionPointName::fromTaggedType(
71
-                $seq->getTagged(0)
72
-                    ->asExplicit()
73
-                    ->asTagged());
74
-        }
75
-        if ($seq->hasTagged(1)) {
76
-            $reasons = ReasonFlags::fromASN1(
77
-                $seq->getTagged(1)
78
-                    ->asImplicit(Element::TYPE_BIT_STRING)
79
-                    ->asBitString());
80
-        }
81
-        if ($seq->hasTagged(2)) {
82
-            $issuer = GeneralNames::fromASN1(
83
-                $seq->getTagged(2)
84
-                    ->asImplicit(Element::TYPE_SEQUENCE)
85
-                    ->asSequence());
86
-        }
87
-        return new self($name, $reasons, $issuer);
88
-    }
57
+	/**
58
+	 * Initialize from ASN.1.
59
+	 *
60
+	 * @param Sequence $seq
61
+	 * @return self
62
+	 */
63
+	public static function fromASN1(Sequence $seq)
64
+	{
65
+		$name = null;
66
+		$reasons = null;
67
+		$issuer = null;
68
+		if ($seq->hasTagged(0)) {
69
+			// promoted to explicit tagging because underlying type is CHOICE
70
+			$name = DistributionPointName::fromTaggedType(
71
+				$seq->getTagged(0)
72
+					->asExplicit()
73
+					->asTagged());
74
+		}
75
+		if ($seq->hasTagged(1)) {
76
+			$reasons = ReasonFlags::fromASN1(
77
+				$seq->getTagged(1)
78
+					->asImplicit(Element::TYPE_BIT_STRING)
79
+					->asBitString());
80
+		}
81
+		if ($seq->hasTagged(2)) {
82
+			$issuer = GeneralNames::fromASN1(
83
+				$seq->getTagged(2)
84
+					->asImplicit(Element::TYPE_SEQUENCE)
85
+					->asSequence());
86
+		}
87
+		return new self($name, $reasons, $issuer);
88
+	}
89 89
     
90
-    /**
91
-     * Check whether distribution point name is set.
92
-     *
93
-     * @return bool
94
-     */
95
-    public function hasDistributionPointName(): bool
96
-    {
97
-        return isset($this->_distributionPoint);
98
-    }
90
+	/**
91
+	 * Check whether distribution point name is set.
92
+	 *
93
+	 * @return bool
94
+	 */
95
+	public function hasDistributionPointName(): bool
96
+	{
97
+		return isset($this->_distributionPoint);
98
+	}
99 99
     
100
-    /**
101
-     * Get distribution point name.
102
-     *
103
-     * @throws \LogicException
104
-     * @return DistributionPointName
105
-     */
106
-    public function distributionPointName(): DistributionPointName
107
-    {
108
-        if (!$this->hasDistributionPointName()) {
109
-            throw new \LogicException("distributionPoint not set.");
110
-        }
111
-        return $this->_distributionPoint;
112
-    }
100
+	/**
101
+	 * Get distribution point name.
102
+	 *
103
+	 * @throws \LogicException
104
+	 * @return DistributionPointName
105
+	 */
106
+	public function distributionPointName(): DistributionPointName
107
+	{
108
+		if (!$this->hasDistributionPointName()) {
109
+			throw new \LogicException("distributionPoint not set.");
110
+		}
111
+		return $this->_distributionPoint;
112
+	}
113 113
     
114
-    /**
115
-     * Check whether distribution point name is set and it's a full name.
116
-     *
117
-     * @return bool
118
-     */
119
-    public function hasFullName(): bool
120
-    {
121
-        return $this->distributionPointName()->tag() ==
122
-             DistributionPointName::TAG_FULL_NAME;
123
-    }
114
+	/**
115
+	 * Check whether distribution point name is set and it's a full name.
116
+	 *
117
+	 * @return bool
118
+	 */
119
+	public function hasFullName(): bool
120
+	{
121
+		return $this->distributionPointName()->tag() ==
122
+			 DistributionPointName::TAG_FULL_NAME;
123
+	}
124 124
     
125
-    /**
126
-     * Get full distribution point name.
127
-     *
128
-     * @throws \LogicException
129
-     * @return FullName
130
-     */
131
-    public function fullName(): FullName
132
-    {
133
-        if (!$this->hasFullName()) {
134
-            throw new \LogicException("fullName not set.");
135
-        }
136
-        return $this->_distributionPoint;
137
-    }
125
+	/**
126
+	 * Get full distribution point name.
127
+	 *
128
+	 * @throws \LogicException
129
+	 * @return FullName
130
+	 */
131
+	public function fullName(): FullName
132
+	{
133
+		if (!$this->hasFullName()) {
134
+			throw new \LogicException("fullName not set.");
135
+		}
136
+		return $this->_distributionPoint;
137
+	}
138 138
     
139
-    /**
140
-     * Check whether distribution point name is set and it's a relative name.
141
-     *
142
-     * @return bool
143
-     */
144
-    public function hasRelativeName(): bool
145
-    {
146
-        return $this->distributionPointName()->tag() ==
147
-             DistributionPointName::TAG_RDN;
148
-    }
139
+	/**
140
+	 * Check whether distribution point name is set and it's a relative name.
141
+	 *
142
+	 * @return bool
143
+	 */
144
+	public function hasRelativeName(): bool
145
+	{
146
+		return $this->distributionPointName()->tag() ==
147
+			 DistributionPointName::TAG_RDN;
148
+	}
149 149
     
150
-    /**
151
-     * Get relative distribution point name.
152
-     *
153
-     * @throws \LogicException
154
-     * @return RelativeName
155
-     */
156
-    public function relativeName(): RelativeName
157
-    {
158
-        if (!$this->hasRelativeName()) {
159
-            throw new \LogicException("nameRelativeToCRLIssuer not set.");
160
-        }
161
-        return $this->_distributionPoint;
162
-    }
150
+	/**
151
+	 * Get relative distribution point name.
152
+	 *
153
+	 * @throws \LogicException
154
+	 * @return RelativeName
155
+	 */
156
+	public function relativeName(): RelativeName
157
+	{
158
+		if (!$this->hasRelativeName()) {
159
+			throw new \LogicException("nameRelativeToCRLIssuer not set.");
160
+		}
161
+		return $this->_distributionPoint;
162
+	}
163 163
     
164
-    /**
165
-     * Check whether reasons flags is set.
166
-     *
167
-     * @return bool
168
-     */
169
-    public function hasReasons(): bool
170
-    {
171
-        return isset($this->_reasons);
172
-    }
164
+	/**
165
+	 * Check whether reasons flags is set.
166
+	 *
167
+	 * @return bool
168
+	 */
169
+	public function hasReasons(): bool
170
+	{
171
+		return isset($this->_reasons);
172
+	}
173 173
     
174
-    /**
175
-     * Get revocation reason flags.
176
-     *
177
-     * @throws \LogicException
178
-     * @return ReasonFlags
179
-     */
180
-    public function reasons(): ReasonFlags
181
-    {
182
-        if (!$this->hasReasons()) {
183
-            throw new \LogicException("reasons not set.");
184
-        }
185
-        return $this->_reasons;
186
-    }
174
+	/**
175
+	 * Get revocation reason flags.
176
+	 *
177
+	 * @throws \LogicException
178
+	 * @return ReasonFlags
179
+	 */
180
+	public function reasons(): ReasonFlags
181
+	{
182
+		if (!$this->hasReasons()) {
183
+			throw new \LogicException("reasons not set.");
184
+		}
185
+		return $this->_reasons;
186
+	}
187 187
     
188
-    /**
189
-     * Check whether cRLIssuer is set.
190
-     *
191
-     * @return bool
192
-     */
193
-    public function hasCRLIssuer(): bool
194
-    {
195
-        return isset($this->_issuer);
196
-    }
188
+	/**
189
+	 * Check whether cRLIssuer is set.
190
+	 *
191
+	 * @return bool
192
+	 */
193
+	public function hasCRLIssuer(): bool
194
+	{
195
+		return isset($this->_issuer);
196
+	}
197 197
     
198
-    /**
199
-     * Get CRL issuer.
200
-     *
201
-     * @throws \LogicException
202
-     * @return GeneralNames
203
-     */
204
-    public function crlIssuer(): GeneralNames
205
-    {
206
-        if (!$this->hasCRLIssuer()) {
207
-            throw new \LogicException("crlIssuer not set.");
208
-        }
209
-        return $this->_issuer;
210
-    }
198
+	/**
199
+	 * Get CRL issuer.
200
+	 *
201
+	 * @throws \LogicException
202
+	 * @return GeneralNames
203
+	 */
204
+	public function crlIssuer(): GeneralNames
205
+	{
206
+		if (!$this->hasCRLIssuer()) {
207
+			throw new \LogicException("crlIssuer not set.");
208
+		}
209
+		return $this->_issuer;
210
+	}
211 211
     
212
-    /**
213
-     * Generate ASN.1 structure.
214
-     *
215
-     * @return Sequence
216
-     */
217
-    public function toASN1(): Sequence
218
-    {
219
-        $elements = array();
220
-        if (isset($this->_distributionPoint)) {
221
-            $elements[] = new ExplicitlyTaggedType(0,
222
-                $this->_distributionPoint->toASN1());
223
-        }
224
-        if (isset($this->_reasons)) {
225
-            $elements[] = new ImplicitlyTaggedType(1, $this->_reasons->toASN1());
226
-        }
227
-        if (isset($this->_issuer)) {
228
-            $elements[] = new ImplicitlyTaggedType(2, $this->_issuer->toASN1());
229
-        }
230
-        return new Sequence(...$elements);
231
-    }
212
+	/**
213
+	 * Generate ASN.1 structure.
214
+	 *
215
+	 * @return Sequence
216
+	 */
217
+	public function toASN1(): Sequence
218
+	{
219
+		$elements = array();
220
+		if (isset($this->_distributionPoint)) {
221
+			$elements[] = new ExplicitlyTaggedType(0,
222
+				$this->_distributionPoint->toASN1());
223
+		}
224
+		if (isset($this->_reasons)) {
225
+			$elements[] = new ImplicitlyTaggedType(1, $this->_reasons->toASN1());
226
+		}
227
+		if (isset($this->_issuer)) {
228
+			$elements[] = new ImplicitlyTaggedType(2, $this->_issuer->toASN1());
229
+		}
230
+		return new Sequence(...$elements);
231
+	}
232 232
 }
Please login to merge, or discard this patch.