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.
Completed
Push — master ( ff3a63...584877 )
by Joni
04:52
created
lib/X509/AttributeCertificate/Validation/ACValidationConfig.php 1 patch
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -10,112 +10,112 @@
 block discarded – undo
10 10
  */
11 11
 class ACValidationConfig
12 12
 {
13
-    /**
14
-     * Certification path of the AC holder.
15
-     *
16
-     * @var CertificationPath
17
-     */
18
-    protected $_holderPath;
13
+	/**
14
+	 * Certification path of the AC holder.
15
+	 *
16
+	 * @var CertificationPath
17
+	 */
18
+	protected $_holderPath;
19 19
     
20
-    /**
21
-     * Certification path of the AC issuer.
22
-     *
23
-     * @var CertificationPath
24
-     */
25
-    protected $_issuerPath;
20
+	/**
21
+	 * Certification path of the AC issuer.
22
+	 *
23
+	 * @var CertificationPath
24
+	 */
25
+	protected $_issuerPath;
26 26
     
27
-    /**
28
-     * Evaluation reference time.
29
-     *
30
-     * @var \DateTimeImmutable
31
-     */
32
-    protected $_evalTime;
27
+	/**
28
+	 * Evaluation reference time.
29
+	 *
30
+	 * @var \DateTimeImmutable
31
+	 */
32
+	protected $_evalTime;
33 33
     
34
-    /**
35
-     * Permitted targets.
36
-     *
37
-     * @var Target[]
38
-     */
39
-    protected $_targets;
34
+	/**
35
+	 * Permitted targets.
36
+	 *
37
+	 * @var Target[]
38
+	 */
39
+	protected $_targets;
40 40
     
41
-    /**
42
-     * Constructor.
43
-     *
44
-     * @param CertificationPath $holder_path Certification path of the AC holder
45
-     * @param CertificationPath $issuer_path Certification path of the AC issuer
46
-     */
47
-    public function __construct(CertificationPath $holder_path,
48
-        CertificationPath $issuer_path)
49
-    {
50
-        $this->_holderPath = $holder_path;
51
-        $this->_issuerPath = $issuer_path;
52
-        $this->_evalTime = new \DateTimeImmutable();
53
-        $this->_targets = array();
54
-    }
41
+	/**
42
+	 * Constructor.
43
+	 *
44
+	 * @param CertificationPath $holder_path Certification path of the AC holder
45
+	 * @param CertificationPath $issuer_path Certification path of the AC issuer
46
+	 */
47
+	public function __construct(CertificationPath $holder_path,
48
+		CertificationPath $issuer_path)
49
+	{
50
+		$this->_holderPath = $holder_path;
51
+		$this->_issuerPath = $issuer_path;
52
+		$this->_evalTime = new \DateTimeImmutable();
53
+		$this->_targets = array();
54
+	}
55 55
     
56
-    /**
57
-     * Get certification path of the AC's holder.
58
-     *
59
-     * @return CertificationPath
60
-     */
61
-    public function holderPath()
62
-    {
63
-        return $this->_holderPath;
64
-    }
56
+	/**
57
+	 * Get certification path of the AC's holder.
58
+	 *
59
+	 * @return CertificationPath
60
+	 */
61
+	public function holderPath()
62
+	{
63
+		return $this->_holderPath;
64
+	}
65 65
     
66
-    /**
67
-     * Get certification path of the AC's issuer.
68
-     *
69
-     * @return CertificationPath
70
-     */
71
-    public function issuerPath()
72
-    {
73
-        return $this->_issuerPath;
74
-    }
66
+	/**
67
+	 * Get certification path of the AC's issuer.
68
+	 *
69
+	 * @return CertificationPath
70
+	 */
71
+	public function issuerPath()
72
+	{
73
+		return $this->_issuerPath;
74
+	}
75 75
     
76
-    /**
77
-     * Get self with given evaluation reference time.
78
-     *
79
-     * @param \DateTimeImmutable $dt
80
-     * @return self
81
-     */
82
-    public function withEvaluationTime(\DateTimeImmutable $dt)
83
-    {
84
-        $obj = clone $this;
85
-        $obj->_evalTime = $dt;
86
-        return $obj;
87
-    }
76
+	/**
77
+	 * Get self with given evaluation reference time.
78
+	 *
79
+	 * @param \DateTimeImmutable $dt
80
+	 * @return self
81
+	 */
82
+	public function withEvaluationTime(\DateTimeImmutable $dt)
83
+	{
84
+		$obj = clone $this;
85
+		$obj->_evalTime = $dt;
86
+		return $obj;
87
+	}
88 88
     
89
-    /**
90
-     * Get the evaluation reference time.
91
-     *
92
-     * @return \DateTimeImmutable
93
-     */
94
-    public function evaluationTime()
95
-    {
96
-        return $this->_evalTime;
97
-    }
89
+	/**
90
+	 * Get the evaluation reference time.
91
+	 *
92
+	 * @return \DateTimeImmutable
93
+	 */
94
+	public function evaluationTime()
95
+	{
96
+		return $this->_evalTime;
97
+	}
98 98
     
99
-    /**
100
-     * Get self with permitted targets.
101
-     *
102
-     * @param Target ...$targets
103
-     * @return self
104
-     */
105
-    public function withTargets(Target ...$targets)
106
-    {
107
-        $obj = clone $this;
108
-        $obj->_targets = $targets;
109
-        return $obj;
110
-    }
99
+	/**
100
+	 * Get self with permitted targets.
101
+	 *
102
+	 * @param Target ...$targets
103
+	 * @return self
104
+	 */
105
+	public function withTargets(Target ...$targets)
106
+	{
107
+		$obj = clone $this;
108
+		$obj->_targets = $targets;
109
+		return $obj;
110
+	}
111 111
     
112
-    /**
113
-     * Get array of permitted targets
114
-     *
115
-     * @return Target[]
116
-     */
117
-    public function targets()
118
-    {
119
-        return $this->_targets;
120
-    }
112
+	/**
113
+	 * Get array of permitted targets
114
+	 *
115
+	 * @return Target[]
116
+	 */
117
+	public function targets()
118
+	{
119
+		return $this->_targets;
120
+	}
121 121
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/Validation/ACValidator.php 1 patch
Indentation   +164 added lines, -164 removed lines patch added patch discarded remove patch
@@ -19,178 +19,178 @@
 block discarded – undo
19 19
  */
20 20
 class ACValidator
21 21
 {
22
-    /**
23
-     * Attribute certificate.
24
-     *
25
-     * @var AttributeCertificate
26
-     */
27
-    protected $_ac;
22
+	/**
23
+	 * Attribute certificate.
24
+	 *
25
+	 * @var AttributeCertificate
26
+	 */
27
+	protected $_ac;
28 28
     
29
-    /**
30
-     * Validation configuration.
31
-     *
32
-     * @var ACValidationConfig
33
-     */
34
-    protected $_config;
29
+	/**
30
+	 * Validation configuration.
31
+	 *
32
+	 * @var ACValidationConfig
33
+	 */
34
+	protected $_config;
35 35
     
36
-    /**
37
-     * Crypto engine.
38
-     *
39
-     * @var Crypto
40
-     */
41
-    protected $_crypto;
36
+	/**
37
+	 * Crypto engine.
38
+	 *
39
+	 * @var Crypto
40
+	 */
41
+	protected $_crypto;
42 42
     
43
-    /**
44
-     * Constructor.
45
-     *
46
-     * @param AttributeCertificate $ac Attribute certificate to validate
47
-     * @param ACValidationConfig $config Validation configuration
48
-     * @param Crypto|null $crypto Crypto engine, use default if not set
49
-     */
50
-    public function __construct(AttributeCertificate $ac,
51
-        ACValidationConfig $config, Crypto $crypto = null)
52
-    {
53
-        $this->_ac = $ac;
54
-        $this->_config = $config;
55
-        $this->_crypto = $crypto ?: Crypto::getDefault();
56
-    }
43
+	/**
44
+	 * Constructor.
45
+	 *
46
+	 * @param AttributeCertificate $ac Attribute certificate to validate
47
+	 * @param ACValidationConfig $config Validation configuration
48
+	 * @param Crypto|null $crypto Crypto engine, use default if not set
49
+	 */
50
+	public function __construct(AttributeCertificate $ac,
51
+		ACValidationConfig $config, Crypto $crypto = null)
52
+	{
53
+		$this->_ac = $ac;
54
+		$this->_config = $config;
55
+		$this->_crypto = $crypto ?: Crypto::getDefault();
56
+	}
57 57
     
58
-    /**
59
-     * Validate attribute certificate.
60
-     *
61
-     * @throws ACValidationException If validation fails
62
-     * @return AttributeCertificate Validated AC
63
-     */
64
-    public function validate()
65
-    {
66
-        $this->_validateHolder();
67
-        $issuer = $this->_verifyIssuer();
68
-        $this->_validateIssuerProfile($issuer);
69
-        $this->_validateTime();
70
-        $this->_validateTargeting();
71
-        return $this->_ac;
72
-    }
58
+	/**
59
+	 * Validate attribute certificate.
60
+	 *
61
+	 * @throws ACValidationException If validation fails
62
+	 * @return AttributeCertificate Validated AC
63
+	 */
64
+	public function validate()
65
+	{
66
+		$this->_validateHolder();
67
+		$issuer = $this->_verifyIssuer();
68
+		$this->_validateIssuerProfile($issuer);
69
+		$this->_validateTime();
70
+		$this->_validateTargeting();
71
+		return $this->_ac;
72
+	}
73 73
     
74
-    /**
75
-     * Validate AC holder's certification.
76
-     *
77
-     * @throws ACValidationException
78
-     * @return Certificate Certificate of the AC's holder
79
-     */
80
-    private function _validateHolder()
81
-    {
82
-        $path = $this->_config->holderPath();
83
-        $config = PathValidationConfig::defaultConfig()->withMaxLength(
84
-            count($path))->withDateTime($this->_config->evaluationTime());
85
-        try {
86
-            $holder = $path->validate($config, $this->_crypto)->certificate();
87
-        } catch (PathValidationException $e) {
88
-            throw new ACValidationException(
89
-                "Failed to validate holder PKC's certification path.", null, $e);
90
-        }
91
-        if (!$this->_ac->isHeldBy($holder)) {
92
-            throw new ACValidationException("Name mismatch of AC's holder PKC.");
93
-        }
94
-        return $holder;
95
-    }
74
+	/**
75
+	 * Validate AC holder's certification.
76
+	 *
77
+	 * @throws ACValidationException
78
+	 * @return Certificate Certificate of the AC's holder
79
+	 */
80
+	private function _validateHolder()
81
+	{
82
+		$path = $this->_config->holderPath();
83
+		$config = PathValidationConfig::defaultConfig()->withMaxLength(
84
+			count($path))->withDateTime($this->_config->evaluationTime());
85
+		try {
86
+			$holder = $path->validate($config, $this->_crypto)->certificate();
87
+		} catch (PathValidationException $e) {
88
+			throw new ACValidationException(
89
+				"Failed to validate holder PKC's certification path.", null, $e);
90
+		}
91
+		if (!$this->_ac->isHeldBy($holder)) {
92
+			throw new ACValidationException("Name mismatch of AC's holder PKC.");
93
+		}
94
+		return $holder;
95
+	}
96 96
     
97
-    /**
98
-     * Verify AC's signature and issuer's certification.
99
-     *
100
-     * @throws ACValidationException
101
-     * @return Certificate Certificate of the AC's issuer
102
-     */
103
-    private function _verifyIssuer()
104
-    {
105
-        $path = $this->_config->issuerPath();
106
-        $config = PathValidationConfig::defaultConfig()->withMaxLength(
107
-            count($path))->withDateTime($this->_config->evaluationTime());
108
-        try {
109
-            $issuer = $path->validate($config, $this->_crypto)->certificate();
110
-        } catch (PathValidationException $e) {
111
-            throw new ACValidationException(
112
-                "Failed to validate issuer PKC's certification path.", null, $e);
113
-        }
114
-        if (!$this->_ac->isIssuedBy($issuer)) {
115
-            throw new ACValidationException("Name mismatch of AC's issuer PKC.");
116
-        }
117
-        $pubkey_info = $issuer->tbsCertificate()->subjectPublicKeyInfo();
118
-        if (!$this->_ac->verify($pubkey_info, $this->_crypto)) {
119
-            throw new ACValidationException("Failed to verify signature.");
120
-        }
121
-        return $issuer;
122
-    }
97
+	/**
98
+	 * Verify AC's signature and issuer's certification.
99
+	 *
100
+	 * @throws ACValidationException
101
+	 * @return Certificate Certificate of the AC's issuer
102
+	 */
103
+	private function _verifyIssuer()
104
+	{
105
+		$path = $this->_config->issuerPath();
106
+		$config = PathValidationConfig::defaultConfig()->withMaxLength(
107
+			count($path))->withDateTime($this->_config->evaluationTime());
108
+		try {
109
+			$issuer = $path->validate($config, $this->_crypto)->certificate();
110
+		} catch (PathValidationException $e) {
111
+			throw new ACValidationException(
112
+				"Failed to validate issuer PKC's certification path.", null, $e);
113
+		}
114
+		if (!$this->_ac->isIssuedBy($issuer)) {
115
+			throw new ACValidationException("Name mismatch of AC's issuer PKC.");
116
+		}
117
+		$pubkey_info = $issuer->tbsCertificate()->subjectPublicKeyInfo();
118
+		if (!$this->_ac->verify($pubkey_info, $this->_crypto)) {
119
+			throw new ACValidationException("Failed to verify signature.");
120
+		}
121
+		return $issuer;
122
+	}
123 123
     
124
-    /**
125
-     * Validate AC issuer's profile.
126
-     *
127
-     * @link https://tools.ietf.org/html/rfc5755#section-4.5
128
-     * @param Certificate $cert
129
-     * @throws ACValidationException
130
-     */
131
-    private function _validateIssuerProfile(Certificate $cert)
132
-    {
133
-        $exts = $cert->tbsCertificate()->extensions();
134
-        if ($exts->hasKeyUsage() && !$exts->keyUsage()->isDigitalSignature()) {
135
-            throw new ACValidationException(
136
-                "Issuer PKC's Key Usage extension doesn't permit" .
137
-                     " verification of digital signatures.");
138
-        }
139
-        if ($exts->hasBasicConstraints() && $exts->basicConstraints()->isCA()) {
140
-            throw new ACValidationException("Issuer PKC must not be a CA.");
141
-        }
142
-    }
124
+	/**
125
+	 * Validate AC issuer's profile.
126
+	 *
127
+	 * @link https://tools.ietf.org/html/rfc5755#section-4.5
128
+	 * @param Certificate $cert
129
+	 * @throws ACValidationException
130
+	 */
131
+	private function _validateIssuerProfile(Certificate $cert)
132
+	{
133
+		$exts = $cert->tbsCertificate()->extensions();
134
+		if ($exts->hasKeyUsage() && !$exts->keyUsage()->isDigitalSignature()) {
135
+			throw new ACValidationException(
136
+				"Issuer PKC's Key Usage extension doesn't permit" .
137
+					 " verification of digital signatures.");
138
+		}
139
+		if ($exts->hasBasicConstraints() && $exts->basicConstraints()->isCA()) {
140
+			throw new ACValidationException("Issuer PKC must not be a CA.");
141
+		}
142
+	}
143 143
     
144
-    /**
145
-     * Validate AC's validity period.
146
-     *
147
-     * @throws ACValidationException
148
-     */
149
-    private function _validateTime()
150
-    {
151
-        $t = $this->_config->evaluationTime();
152
-        $validity = $this->_ac->acinfo()->validityPeriod();
153
-        if ($validity->notBeforeTime()->diff($t)->invert) {
154
-            throw new ACValidationException("Validity period has not started.");
155
-        }
156
-        if ($t->diff($validity->notAfterTime())->invert) {
157
-            throw new ACValidationException("Attribute certificate has expired.");
158
-        }
159
-    }
144
+	/**
145
+	 * Validate AC's validity period.
146
+	 *
147
+	 * @throws ACValidationException
148
+	 */
149
+	private function _validateTime()
150
+	{
151
+		$t = $this->_config->evaluationTime();
152
+		$validity = $this->_ac->acinfo()->validityPeriod();
153
+		if ($validity->notBeforeTime()->diff($t)->invert) {
154
+			throw new ACValidationException("Validity period has not started.");
155
+		}
156
+		if ($t->diff($validity->notAfterTime())->invert) {
157
+			throw new ACValidationException("Attribute certificate has expired.");
158
+		}
159
+	}
160 160
     
161
-    /**
162
-     * Validate AC's target information.
163
-     *
164
-     * @throws ACValidationException
165
-     */
166
-    private function _validateTargeting()
167
-    {
168
-        $exts = $this->_ac->acinfo()->extensions();
169
-        // if target information extension is not present
170
-        if (!$exts->has(Extension::OID_TARGET_INFORMATION)) {
171
-            return;
172
-        }
173
-        $ext = $exts->get(Extension::OID_TARGET_INFORMATION);
174
-        if ($ext instanceof TargetInformationExtension &&
175
-             !$this->_hasMatchingTarget($ext->targets())) {
176
-            throw new ACValidationException(
177
-                "Attribute certificate doesn't have a matching target.");
178
-        }
179
-    }
161
+	/**
162
+	 * Validate AC's target information.
163
+	 *
164
+	 * @throws ACValidationException
165
+	 */
166
+	private function _validateTargeting()
167
+	{
168
+		$exts = $this->_ac->acinfo()->extensions();
169
+		// if target information extension is not present
170
+		if (!$exts->has(Extension::OID_TARGET_INFORMATION)) {
171
+			return;
172
+		}
173
+		$ext = $exts->get(Extension::OID_TARGET_INFORMATION);
174
+		if ($ext instanceof TargetInformationExtension &&
175
+			 !$this->_hasMatchingTarget($ext->targets())) {
176
+			throw new ACValidationException(
177
+				"Attribute certificate doesn't have a matching target.");
178
+		}
179
+	}
180 180
     
181
-    /**
182
-     * Check whether validation configuration has matching targets.
183
-     *
184
-     * @param Targets $targets Set of eligible targets
185
-     * @return boolean
186
-     */
187
-    private function _hasMatchingTarget(Targets $targets)
188
-    {
189
-        foreach ($this->_config->targets() as $target) {
190
-            if ($targets->hasTarget($target)) {
191
-                return true;
192
-            }
193
-        }
194
-        return false;
195
-    }
181
+	/**
182
+	 * Check whether validation configuration has matching targets.
183
+	 *
184
+	 * @param Targets $targets Set of eligible targets
185
+	 * @return boolean
186
+	 */
187
+	private function _hasMatchingTarget(Targets $targets)
188
+	{
189
+		foreach ($this->_config->targets() as $target) {
190
+			if ($targets->hasTarget($target)) {
191
+				return true;
192
+			}
193
+		}
194
+		return false;
195
+	}
196 196
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/V2Form.php 1 patch
Indentation   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -15,143 +15,143 @@
 block discarded – undo
15 15
  */
16 16
 class V2Form extends AttCertIssuer
17 17
 {
18
-    /**
19
-     * Issuer name.
20
-     *
21
-     * @var GeneralNames $_issuerName
22
-     */
23
-    protected $_issuerName;
18
+	/**
19
+	 * Issuer name.
20
+	 *
21
+	 * @var GeneralNames $_issuerName
22
+	 */
23
+	protected $_issuerName;
24 24
     
25
-    /**
26
-     * Issuer PKC's issuer and serial.
27
-     *
28
-     * @var IssuerSerial $_baseCertificateID
29
-     */
30
-    protected $_baseCertificateID;
25
+	/**
26
+	 * Issuer PKC's issuer and serial.
27
+	 *
28
+	 * @var IssuerSerial $_baseCertificateID
29
+	 */
30
+	protected $_baseCertificateID;
31 31
     
32
-    /**
33
-     * Linked object.
34
-     *
35
-     * @var ObjectDigestInfo $_objectDigestInfo
36
-     */
37
-    protected $_objectDigestInfo;
32
+	/**
33
+	 * Linked object.
34
+	 *
35
+	 * @var ObjectDigestInfo $_objectDigestInfo
36
+	 */
37
+	protected $_objectDigestInfo;
38 38
     
39
-    /**
40
-     * Constructor.
41
-     *
42
-     * @param GeneralNames|null $names
43
-     */
44
-    public function __construct(GeneralNames $names = null)
45
-    {
46
-        $this->_issuerName = $names;
47
-        $this->_baseCertificateID = null;
48
-        $this->_objectDigestInfo = null;
49
-    }
39
+	/**
40
+	 * Constructor.
41
+	 *
42
+	 * @param GeneralNames|null $names
43
+	 */
44
+	public function __construct(GeneralNames $names = null)
45
+	{
46
+		$this->_issuerName = $names;
47
+		$this->_baseCertificateID = null;
48
+		$this->_objectDigestInfo = null;
49
+	}
50 50
     
51
-    /**
52
-     * Initialize from ASN.1.
53
-     *
54
-     * @param Sequence $seq
55
-     * @return self
56
-     */
57
-    public static function fromV2ASN1(Sequence $seq)
58
-    {
59
-        $issuer = null;
60
-        $cert_id = null;
61
-        $digest_info = null;
62
-        if ($seq->has(0, Element::TYPE_SEQUENCE)) {
63
-            $issuer = GeneralNames::fromASN1($seq->at(0)->asSequence());
64
-        }
65
-        if ($seq->hasTagged(0)) {
66
-            $cert_id = IssuerSerial::fromASN1(
67
-                $seq->getTagged(0)
68
-                    ->asImplicit(Element::TYPE_SEQUENCE)
69
-                    ->asSequence());
70
-        }
71
-        if ($seq->hasTagged(1)) {
72
-            $digest_info = ObjectDigestInfo::fromASN1(
73
-                $seq->getTagged(1)
74
-                    ->asImplicit(Element::TYPE_SEQUENCE)
75
-                    ->asSequence());
76
-        }
77
-        $obj = new self($issuer);
78
-        $obj->_baseCertificateID = $cert_id;
79
-        $obj->_objectDigestInfo = $digest_info;
80
-        return $obj;
81
-    }
51
+	/**
52
+	 * Initialize from ASN.1.
53
+	 *
54
+	 * @param Sequence $seq
55
+	 * @return self
56
+	 */
57
+	public static function fromV2ASN1(Sequence $seq)
58
+	{
59
+		$issuer = null;
60
+		$cert_id = null;
61
+		$digest_info = null;
62
+		if ($seq->has(0, Element::TYPE_SEQUENCE)) {
63
+			$issuer = GeneralNames::fromASN1($seq->at(0)->asSequence());
64
+		}
65
+		if ($seq->hasTagged(0)) {
66
+			$cert_id = IssuerSerial::fromASN1(
67
+				$seq->getTagged(0)
68
+					->asImplicit(Element::TYPE_SEQUENCE)
69
+					->asSequence());
70
+		}
71
+		if ($seq->hasTagged(1)) {
72
+			$digest_info = ObjectDigestInfo::fromASN1(
73
+				$seq->getTagged(1)
74
+					->asImplicit(Element::TYPE_SEQUENCE)
75
+					->asSequence());
76
+		}
77
+		$obj = new self($issuer);
78
+		$obj->_baseCertificateID = $cert_id;
79
+		$obj->_objectDigestInfo = $digest_info;
80
+		return $obj;
81
+	}
82 82
     
83
-    /**
84
-     * Check whether issuer name is set.
85
-     *
86
-     * @return bool
87
-     */
88
-    public function hasIssuerName()
89
-    {
90
-        return isset($this->_issuerName);
91
-    }
83
+	/**
84
+	 * Check whether issuer name is set.
85
+	 *
86
+	 * @return bool
87
+	 */
88
+	public function hasIssuerName()
89
+	{
90
+		return isset($this->_issuerName);
91
+	}
92 92
     
93
-    /**
94
-     * Get issuer name.
95
-     *
96
-     * @throws \LogicException
97
-     * @return GeneralNames
98
-     */
99
-    public function issuerName()
100
-    {
101
-        if (!$this->hasIssuerName()) {
102
-            throw new \LogicException("issuerName not set.");
103
-        }
104
-        return $this->_issuerName;
105
-    }
93
+	/**
94
+	 * Get issuer name.
95
+	 *
96
+	 * @throws \LogicException
97
+	 * @return GeneralNames
98
+	 */
99
+	public function issuerName()
100
+	{
101
+		if (!$this->hasIssuerName()) {
102
+			throw new \LogicException("issuerName not set.");
103
+		}
104
+		return $this->_issuerName;
105
+	}
106 106
     
107
-    /**
108
-     * Get DN of the issuer.
109
-     *
110
-     * This is a convenience method conforming to RFC 5755, which states
111
-     * that Issuer must contain only one non-empty distinguished name.
112
-     *
113
-     * @return \X501\ASN1\Name
114
-     */
115
-    public function name()
116
-    {
117
-        return $this->issuerName()->firstDN();
118
-    }
107
+	/**
108
+	 * Get DN of the issuer.
109
+	 *
110
+	 * This is a convenience method conforming to RFC 5755, which states
111
+	 * that Issuer must contain only one non-empty distinguished name.
112
+	 *
113
+	 * @return \X501\ASN1\Name
114
+	 */
115
+	public function name()
116
+	{
117
+		return $this->issuerName()->firstDN();
118
+	}
119 119
     
120
-    /**
121
-     *
122
-     * @see \X509\AttributeCertificate\AttCertIssuer::ASN1()
123
-     * @return ImplicitlyTaggedType Tagged Sequence
124
-     */
125
-    public function toASN1()
126
-    {
127
-        $elements = array();
128
-        if (isset($this->_issuerName)) {
129
-            $elements[] = $this->_issuerName->toASN1();
130
-        }
131
-        if (isset($this->_baseCertificateID)) {
132
-            $elements[] = new ImplicitlyTaggedType(0,
133
-                $this->_baseCertificateID->toASN1());
134
-        }
135
-        if (isset($this->_objectDigestInfo)) {
136
-            $elements[] = new ImplicitlyTaggedType(1,
137
-                $this->_objectDigestInfo->toASN1());
138
-        }
139
-        return new ImplicitlyTaggedType(0, new Sequence(...$elements));
140
-    }
120
+	/**
121
+	 *
122
+	 * @see \X509\AttributeCertificate\AttCertIssuer::ASN1()
123
+	 * @return ImplicitlyTaggedType Tagged Sequence
124
+	 */
125
+	public function toASN1()
126
+	{
127
+		$elements = array();
128
+		if (isset($this->_issuerName)) {
129
+			$elements[] = $this->_issuerName->toASN1();
130
+		}
131
+		if (isset($this->_baseCertificateID)) {
132
+			$elements[] = new ImplicitlyTaggedType(0,
133
+				$this->_baseCertificateID->toASN1());
134
+		}
135
+		if (isset($this->_objectDigestInfo)) {
136
+			$elements[] = new ImplicitlyTaggedType(1,
137
+				$this->_objectDigestInfo->toASN1());
138
+		}
139
+		return new ImplicitlyTaggedType(0, new Sequence(...$elements));
140
+	}
141 141
     
142
-    /**
143
-     *
144
-     * @see \X509\AttributeCertificate\AttCertIssuer::identifiesPKC()
145
-     * @return bool
146
-     */
147
-    public function identifiesPKC(Certificate $cert)
148
-    {
149
-        $name = $this->_issuerName->firstDN();
150
-        if (!$cert->tbsCertificate()
151
-            ->subject()
152
-            ->equals($name)) {
153
-            return false;
154
-        }
155
-        return true;
156
-    }
142
+	/**
143
+	 *
144
+	 * @see \X509\AttributeCertificate\AttCertIssuer::identifiesPKC()
145
+	 * @return bool
146
+	 */
147
+	public function identifiesPKC(Certificate $cert)
148
+	{
149
+		$name = $this->_issuerName->firstDN();
150
+		if (!$cert->tbsCertificate()
151
+			->subject()
152
+			->equals($name)) {
153
+			return false;
154
+		}
155
+		return true;
156
+	}
157 157
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/ObjectDigestInfo.php 1 patch
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -18,92 +18,92 @@
 block discarded – undo
18 18
  */
19 19
 class ObjectDigestInfo
20 20
 {
21
-    const TYPE_PUBLIC_KEY = 0;
22
-    const TYPE_PUBLIC_KEY_CERT = 1;
23
-    const TYPE_OTHER_OBJECT_TYPES = 2;
21
+	const TYPE_PUBLIC_KEY = 0;
22
+	const TYPE_PUBLIC_KEY_CERT = 1;
23
+	const TYPE_OTHER_OBJECT_TYPES = 2;
24 24
     
25
-    /**
26
-     * Object type.
27
-     *
28
-     * @var int $_digestedObjectType
29
-     */
30
-    protected $_digestedObjectType;
25
+	/**
26
+	 * Object type.
27
+	 *
28
+	 * @var int $_digestedObjectType
29
+	 */
30
+	protected $_digestedObjectType;
31 31
     
32
-    /**
33
-     * OID of other object type.
34
-     *
35
-     * @var string|null $_otherObjectTypeID
36
-     */
37
-    protected $_otherObjectTypeID;
32
+	/**
33
+	 * OID of other object type.
34
+	 *
35
+	 * @var string|null $_otherObjectTypeID
36
+	 */
37
+	protected $_otherObjectTypeID;
38 38
     
39
-    /**
40
-     * Digest algorithm.
41
-     *
42
-     * @var AlgorithmIdentifierType $_digestAlgorithm
43
-     */
44
-    protected $_digestAlgorithm;
39
+	/**
40
+	 * Digest algorithm.
41
+	 *
42
+	 * @var AlgorithmIdentifierType $_digestAlgorithm
43
+	 */
44
+	protected $_digestAlgorithm;
45 45
     
46
-    /**
47
-     * Object digest.
48
-     *
49
-     * @var BitString $_objectDigest
50
-     */
51
-    protected $_objectDigest;
46
+	/**
47
+	 * Object digest.
48
+	 *
49
+	 * @var BitString $_objectDigest
50
+	 */
51
+	protected $_objectDigest;
52 52
     
53
-    /**
54
-     * Constructor.
55
-     *
56
-     * @param int $type
57
-     * @param AlgorithmIdentifierType $algo
58
-     * @param BitString $digest
59
-     */
60
-    public function __construct($type, AlgorithmIdentifierType $algo,
61
-        BitString $digest)
62
-    {
63
-        $this->_digestedObjectType = $type;
64
-        $this->_otherObjectTypeID = null;
65
-        $this->_digestAlgorithm = $algo;
66
-        $this->_objectDigest = $digest;
67
-    }
53
+	/**
54
+	 * Constructor.
55
+	 *
56
+	 * @param int $type
57
+	 * @param AlgorithmIdentifierType $algo
58
+	 * @param BitString $digest
59
+	 */
60
+	public function __construct($type, AlgorithmIdentifierType $algo,
61
+		BitString $digest)
62
+	{
63
+		$this->_digestedObjectType = $type;
64
+		$this->_otherObjectTypeID = null;
65
+		$this->_digestAlgorithm = $algo;
66
+		$this->_objectDigest = $digest;
67
+	}
68 68
     
69
-    /**
70
-     * Initialize from ASN.1.
71
-     *
72
-     * @param Sequence $seq
73
-     * @return self
74
-     */
75
-    public static function fromASN1(Sequence $seq)
76
-    {
77
-        $type = $seq->at(0)
78
-            ->asEnumerated()
79
-            ->number();
80
-        $oid = null;
81
-        $idx = 1;
82
-        if ($seq->has($idx, Element::TYPE_OBJECT_IDENTIFIER)) {
83
-            $oid = $seq->at($idx++)
84
-                ->asObjectIdentifier()
85
-                ->oid();
86
-        }
87
-        $algo = AlgorithmIdentifier::fromASN1($seq->at($idx++)->asSequence());
88
-        $digest = $seq->at($idx)->asBitString();
89
-        $obj = new self($type, $algo, $digest);
90
-        $obj->_otherObjectTypeID = $oid;
91
-        return $obj;
92
-    }
69
+	/**
70
+	 * Initialize from ASN.1.
71
+	 *
72
+	 * @param Sequence $seq
73
+	 * @return self
74
+	 */
75
+	public static function fromASN1(Sequence $seq)
76
+	{
77
+		$type = $seq->at(0)
78
+			->asEnumerated()
79
+			->number();
80
+		$oid = null;
81
+		$idx = 1;
82
+		if ($seq->has($idx, Element::TYPE_OBJECT_IDENTIFIER)) {
83
+			$oid = $seq->at($idx++)
84
+				->asObjectIdentifier()
85
+				->oid();
86
+		}
87
+		$algo = AlgorithmIdentifier::fromASN1($seq->at($idx++)->asSequence());
88
+		$digest = $seq->at($idx)->asBitString();
89
+		$obj = new self($type, $algo, $digest);
90
+		$obj->_otherObjectTypeID = $oid;
91
+		return $obj;
92
+	}
93 93
     
94
-    /**
95
-     * Generate ASN.1 structure.
96
-     *
97
-     * @return Sequence
98
-     */
99
-    public function toASN1()
100
-    {
101
-        $elements = array(new Enumerated($this->_digestedObjectType));
102
-        if (isset($this->_otherObjectTypeID)) {
103
-            $elements[] = new ObjectIdentifier($this->_otherObjectTypeID);
104
-        }
105
-        $elements[] = $this->_digestAlgorithm->toASN1();
106
-        $elements[] = $this->_objectDigest;
107
-        return new Sequence(...$elements);
108
-    }
94
+	/**
95
+	 * Generate ASN.1 structure.
96
+	 *
97
+	 * @return Sequence
98
+	 */
99
+	public function toASN1()
100
+	{
101
+		$elements = array(new Enumerated($this->_digestedObjectType));
102
+		if (isset($this->_otherObjectTypeID)) {
103
+			$elements[] = new ObjectIdentifier($this->_otherObjectTypeID);
104
+		}
105
+		$elements[] = $this->_digestAlgorithm->toASN1();
106
+		$elements[] = $this->_objectDigest;
107
+		return new Sequence(...$elements);
108
+	}
109 109
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/Attribute/IetfAttrValue.php 1 patch
Indentation   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -15,161 +15,161 @@
 block discarded – undo
15 15
  */
16 16
 class IetfAttrValue
17 17
 {
18
-    /**
19
-     * Element type tag.
20
-     *
21
-     * @var int $_type
22
-     */
23
-    protected $_type;
18
+	/**
19
+	 * Element type tag.
20
+	 *
21
+	 * @var int $_type
22
+	 */
23
+	protected $_type;
24 24
     
25
-    /**
26
-     * Value.
27
-     *
28
-     * @var string $_value
29
-     */
30
-    protected $_value;
25
+	/**
26
+	 * Value.
27
+	 *
28
+	 * @var string $_value
29
+	 */
30
+	protected $_value;
31 31
     
32
-    /**
33
-     * Constructor.
34
-     *
35
-     * @param string $value
36
-     * @param int $type
37
-     */
38
-    public function __construct($value, $type)
39
-    {
40
-        $this->_type = $type;
41
-        $this->_value = $value;
42
-    }
32
+	/**
33
+	 * Constructor.
34
+	 *
35
+	 * @param string $value
36
+	 * @param int $type
37
+	 */
38
+	public function __construct($value, $type)
39
+	{
40
+		$this->_type = $type;
41
+		$this->_value = $value;
42
+	}
43 43
     
44
-    /**
45
-     * Initialize from ASN.1.
46
-     *
47
-     * @param UnspecifiedType $el
48
-     * @throws \UnexpectedValueException
49
-     * @return self
50
-     */
51
-    public static function fromASN1(UnspecifiedType $el)
52
-    {
53
-        switch ($el->tag()) {
54
-            case Element::TYPE_OCTET_STRING:
55
-            case Element::TYPE_UTF8_STRING:
56
-                return new self($el->asString()->string(), $el->tag());
57
-            case Element::TYPE_OBJECT_IDENTIFIER:
58
-                return new self($el->asObjectIdentifier()->oid(), $el->tag());
59
-        }
60
-        throw new \UnexpectedValueException(
61
-            "Type " . Element::tagToName($el->tag()) . " not supported.");
62
-    }
44
+	/**
45
+	 * Initialize from ASN.1.
46
+	 *
47
+	 * @param UnspecifiedType $el
48
+	 * @throws \UnexpectedValueException
49
+	 * @return self
50
+	 */
51
+	public static function fromASN1(UnspecifiedType $el)
52
+	{
53
+		switch ($el->tag()) {
54
+			case Element::TYPE_OCTET_STRING:
55
+			case Element::TYPE_UTF8_STRING:
56
+				return new self($el->asString()->string(), $el->tag());
57
+			case Element::TYPE_OBJECT_IDENTIFIER:
58
+				return new self($el->asObjectIdentifier()->oid(), $el->tag());
59
+		}
60
+		throw new \UnexpectedValueException(
61
+			"Type " . Element::tagToName($el->tag()) . " not supported.");
62
+	}
63 63
     
64
-    /**
65
-     * Initialize from octet string.
66
-     *
67
-     * @param string $octets
68
-     * @return self
69
-     */
70
-    public static function fromOctets($octets)
71
-    {
72
-        return new self($octets, Element::TYPE_OCTET_STRING);
73
-    }
64
+	/**
65
+	 * Initialize from octet string.
66
+	 *
67
+	 * @param string $octets
68
+	 * @return self
69
+	 */
70
+	public static function fromOctets($octets)
71
+	{
72
+		return new self($octets, Element::TYPE_OCTET_STRING);
73
+	}
74 74
     
75
-    /**
76
-     * Initialize from UTF-8 string.
77
-     *
78
-     * @param string $str
79
-     * @return self
80
-     */
81
-    public static function fromString($str)
82
-    {
83
-        return new self($str, Element::TYPE_UTF8_STRING);
84
-    }
75
+	/**
76
+	 * Initialize from UTF-8 string.
77
+	 *
78
+	 * @param string $str
79
+	 * @return self
80
+	 */
81
+	public static function fromString($str)
82
+	{
83
+		return new self($str, Element::TYPE_UTF8_STRING);
84
+	}
85 85
     
86
-    /**
87
-     * Initialize from OID.
88
-     *
89
-     * @param string $oid
90
-     * @return self
91
-     */
92
-    public static function fromOID($oid)
93
-    {
94
-        return new self($oid, Element::TYPE_OBJECT_IDENTIFIER);
95
-    }
86
+	/**
87
+	 * Initialize from OID.
88
+	 *
89
+	 * @param string $oid
90
+	 * @return self
91
+	 */
92
+	public static function fromOID($oid)
93
+	{
94
+		return new self($oid, Element::TYPE_OBJECT_IDENTIFIER);
95
+	}
96 96
     
97
-    /**
98
-     * Get type tag.
99
-     *
100
-     * @return int
101
-     */
102
-    public function type()
103
-    {
104
-        return $this->_type;
105
-    }
97
+	/**
98
+	 * Get type tag.
99
+	 *
100
+	 * @return int
101
+	 */
102
+	public function type()
103
+	{
104
+		return $this->_type;
105
+	}
106 106
     
107
-    /**
108
-     * Whether value type is octets.
109
-     *
110
-     * @return bool
111
-     */
112
-    public function isOctets()
113
-    {
114
-        return $this->_type == Element::TYPE_OCTET_STRING;
115
-    }
107
+	/**
108
+	 * Whether value type is octets.
109
+	 *
110
+	 * @return bool
111
+	 */
112
+	public function isOctets()
113
+	{
114
+		return $this->_type == Element::TYPE_OCTET_STRING;
115
+	}
116 116
     
117
-    /**
118
-     * Whether value type is OID.
119
-     *
120
-     * @return bool
121
-     */
122
-    public function isOID()
123
-    {
124
-        return $this->_type == Element::TYPE_OBJECT_IDENTIFIER;
125
-    }
117
+	/**
118
+	 * Whether value type is OID.
119
+	 *
120
+	 * @return bool
121
+	 */
122
+	public function isOID()
123
+	{
124
+		return $this->_type == Element::TYPE_OBJECT_IDENTIFIER;
125
+	}
126 126
     
127
-    /**
128
-     * Whether value type is string.
129
-     *
130
-     * @return bool
131
-     */
132
-    public function isString()
133
-    {
134
-        return $this->_type == Element::TYPE_UTF8_STRING;
135
-    }
127
+	/**
128
+	 * Whether value type is string.
129
+	 *
130
+	 * @return bool
131
+	 */
132
+	public function isString()
133
+	{
134
+		return $this->_type == Element::TYPE_UTF8_STRING;
135
+	}
136 136
     
137
-    /**
138
-     * Get value.
139
-     *
140
-     * @return string
141
-     */
142
-    public function value()
143
-    {
144
-        return $this->_value;
145
-    }
137
+	/**
138
+	 * Get value.
139
+	 *
140
+	 * @return string
141
+	 */
142
+	public function value()
143
+	{
144
+		return $this->_value;
145
+	}
146 146
     
147
-    /**
148
-     * Generate ASN.1 structure.
149
-     *
150
-     * @throws \LogicException
151
-     * @return Element
152
-     */
153
-    public function toASN1()
154
-    {
155
-        switch ($this->_type) {
156
-            case Element::TYPE_OCTET_STRING:
157
-                return new OctetString($this->_value);
158
-            case Element::TYPE_UTF8_STRING:
159
-                return new UTF8String($this->_value);
160
-            case Element::TYPE_OBJECT_IDENTIFIER:
161
-                return new ObjectIdentifier($this->_value);
162
-        }
163
-        throw new \LogicException(
164
-            "Type " . Element::tagToName($this->_type) . " not supported.");
165
-    }
147
+	/**
148
+	 * Generate ASN.1 structure.
149
+	 *
150
+	 * @throws \LogicException
151
+	 * @return Element
152
+	 */
153
+	public function toASN1()
154
+	{
155
+		switch ($this->_type) {
156
+			case Element::TYPE_OCTET_STRING:
157
+				return new OctetString($this->_value);
158
+			case Element::TYPE_UTF8_STRING:
159
+				return new UTF8String($this->_value);
160
+			case Element::TYPE_OBJECT_IDENTIFIER:
161
+				return new ObjectIdentifier($this->_value);
162
+		}
163
+		throw new \LogicException(
164
+			"Type " . Element::tagToName($this->_type) . " not supported.");
165
+	}
166 166
     
167
-    /**
168
-     *
169
-     * @return string
170
-     */
171
-    public function __toString()
172
-    {
173
-        return $this->_value;
174
-    }
167
+	/**
168
+	 *
169
+	 * @return string
170
+	 */
171
+	public function __toString()
172
+	{
173
+		return $this->_value;
174
+	}
175 175
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/Attribute/RoleAttributeValue.php 1 patch
Indentation   +138 added lines, -138 removed lines patch added patch discarded remove patch
@@ -21,154 +21,154 @@
 block discarded – undo
21 21
  */
22 22
 class RoleAttributeValue extends AttributeValue
23 23
 {
24
-    /**
25
-     * Issuing authority.
26
-     *
27
-     * @var GeneralNames $_roleAuthority
28
-     */
29
-    protected $_roleAuthority;
24
+	/**
25
+	 * Issuing authority.
26
+	 *
27
+	 * @var GeneralNames $_roleAuthority
28
+	 */
29
+	protected $_roleAuthority;
30 30
     
31
-    /**
32
-     * Role name.
33
-     *
34
-     * @var GeneralName $_roleName
35
-     */
36
-    protected $_roleName;
31
+	/**
32
+	 * Role name.
33
+	 *
34
+	 * @var GeneralName $_roleName
35
+	 */
36
+	protected $_roleName;
37 37
     
38
-    /**
39
-     * Constructor.
40
-     *
41
-     * @param GeneralName $name Role name
42
-     * @param GeneralNames|null $authority Issuing authority
43
-     */
44
-    public function __construct(GeneralName $name, GeneralNames $authority = null)
45
-    {
46
-        $this->_roleAuthority = $authority;
47
-        $this->_roleName = $name;
48
-        $this->_oid = AttributeType::OID_ROLE;
49
-    }
38
+	/**
39
+	 * Constructor.
40
+	 *
41
+	 * @param GeneralName $name Role name
42
+	 * @param GeneralNames|null $authority Issuing authority
43
+	 */
44
+	public function __construct(GeneralName $name, GeneralNames $authority = null)
45
+	{
46
+		$this->_roleAuthority = $authority;
47
+		$this->_roleName = $name;
48
+		$this->_oid = AttributeType::OID_ROLE;
49
+	}
50 50
     
51
-    /**
52
-     * Initialize from a role string.
53
-     *
54
-     * @param string $role_name Role name in URI format
55
-     * @param GeneralNames|null $authority Issuing authority
56
-     * @return self
57
-     */
58
-    public static function fromString($role_name, GeneralNames $authority = null)
59
-    {
60
-        return new self(new UniformResourceIdentifier($role_name), $authority);
61
-    }
51
+	/**
52
+	 * Initialize from a role string.
53
+	 *
54
+	 * @param string $role_name Role name in URI format
55
+	 * @param GeneralNames|null $authority Issuing authority
56
+	 * @return self
57
+	 */
58
+	public static function fromString($role_name, GeneralNames $authority = null)
59
+	{
60
+		return new self(new UniformResourceIdentifier($role_name), $authority);
61
+	}
62 62
     
63
-    /**
64
-     *
65
-     * @param UnspecifiedType $el
66
-     * @return self
67
-     */
68
-    public static function fromASN1(UnspecifiedType $el)
69
-    {
70
-        $seq = $el->asSequence();
71
-        $authority = null;
72
-        if ($seq->hasTagged(0)) {
73
-            $authority = GeneralNames::fromASN1(
74
-                $seq->getTagged(0)
75
-                    ->asImplicit(Element::TYPE_SEQUENCE)
76
-                    ->asSequence());
77
-        }
78
-        $name = GeneralName::fromASN1(
79
-            $seq->getTagged(1)
80
-                ->asExplicit()
81
-                ->asTagged());
82
-        return new self($name, $authority);
83
-    }
63
+	/**
64
+	 *
65
+	 * @param UnspecifiedType $el
66
+	 * @return self
67
+	 */
68
+	public static function fromASN1(UnspecifiedType $el)
69
+	{
70
+		$seq = $el->asSequence();
71
+		$authority = null;
72
+		if ($seq->hasTagged(0)) {
73
+			$authority = GeneralNames::fromASN1(
74
+				$seq->getTagged(0)
75
+					->asImplicit(Element::TYPE_SEQUENCE)
76
+					->asSequence());
77
+		}
78
+		$name = GeneralName::fromASN1(
79
+			$seq->getTagged(1)
80
+				->asExplicit()
81
+				->asTagged());
82
+		return new self($name, $authority);
83
+	}
84 84
     
85
-    /**
86
-     * Check whether issuing authority is present.
87
-     *
88
-     * @return bool
89
-     */
90
-    public function hasRoleAuthority()
91
-    {
92
-        return isset($this->_roleAuthority);
93
-    }
85
+	/**
86
+	 * Check whether issuing authority is present.
87
+	 *
88
+	 * @return bool
89
+	 */
90
+	public function hasRoleAuthority()
91
+	{
92
+		return isset($this->_roleAuthority);
93
+	}
94 94
     
95
-    /**
96
-     * Get issuing authority.
97
-     *
98
-     * @throws \LogicException
99
-     * @return GeneralNames
100
-     */
101
-    public function roleAuthority()
102
-    {
103
-        if (!$this->hasRoleAuthority()) {
104
-            throw new \LogicException("roleAuthority not set.");
105
-        }
106
-        return $this->_roleAuthority;
107
-    }
95
+	/**
96
+	 * Get issuing authority.
97
+	 *
98
+	 * @throws \LogicException
99
+	 * @return GeneralNames
100
+	 */
101
+	public function roleAuthority()
102
+	{
103
+		if (!$this->hasRoleAuthority()) {
104
+			throw new \LogicException("roleAuthority not set.");
105
+		}
106
+		return $this->_roleAuthority;
107
+	}
108 108
     
109
-    /**
110
-     * Get role name.
111
-     *
112
-     * @return GeneralName
113
-     */
114
-    public function roleName()
115
-    {
116
-        return $this->_roleName;
117
-    }
109
+	/**
110
+	 * Get role name.
111
+	 *
112
+	 * @return GeneralName
113
+	 */
114
+	public function roleName()
115
+	{
116
+		return $this->_roleName;
117
+	}
118 118
     
119
-    /**
120
-     *
121
-     * @see \X501\ASN1\AttributeValue\AttributeValue::toASN1()
122
-     * @return Sequence
123
-     */
124
-    public function toASN1()
125
-    {
126
-        $elements = array();
127
-        if (isset($this->_roleAuthority)) {
128
-            $elements[] = new ImplicitlyTaggedType(0,
129
-                $this->_roleAuthority->toASN1());
130
-        }
131
-        $elements[] = new ExplicitlyTaggedType(1, $this->_roleName->toASN1());
132
-        return new Sequence(...$elements);
133
-    }
119
+	/**
120
+	 *
121
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::toASN1()
122
+	 * @return Sequence
123
+	 */
124
+	public function toASN1()
125
+	{
126
+		$elements = array();
127
+		if (isset($this->_roleAuthority)) {
128
+			$elements[] = new ImplicitlyTaggedType(0,
129
+				$this->_roleAuthority->toASN1());
130
+		}
131
+		$elements[] = new ExplicitlyTaggedType(1, $this->_roleName->toASN1());
132
+		return new Sequence(...$elements);
133
+	}
134 134
     
135
-    /**
136
-     *
137
-     * @see \X501\ASN1\AttributeValue\AttributeValue::stringValue()
138
-     * @return string
139
-     */
140
-    public function stringValue()
141
-    {
142
-        return "#" . bin2hex($this->toASN1()->toDER());
143
-    }
135
+	/**
136
+	 *
137
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::stringValue()
138
+	 * @return string
139
+	 */
140
+	public function stringValue()
141
+	{
142
+		return "#" . bin2hex($this->toASN1()->toDER());
143
+	}
144 144
     
145
-    /**
146
-     *
147
-     * @see \X501\ASN1\AttributeValue\AttributeValue::equalityMatchingRule()
148
-     * @return BinaryMatch
149
-     */
150
-    public function equalityMatchingRule()
151
-    {
152
-        return new BinaryMatch();
153
-    }
145
+	/**
146
+	 *
147
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::equalityMatchingRule()
148
+	 * @return BinaryMatch
149
+	 */
150
+	public function equalityMatchingRule()
151
+	{
152
+		return new BinaryMatch();
153
+	}
154 154
     
155
-    /**
156
-     *
157
-     * @see \X501\ASN1\AttributeValue\AttributeValue::rfc2253String()
158
-     * @return string
159
-     */
160
-    public function rfc2253String()
161
-    {
162
-        return $this->stringValue();
163
-    }
155
+	/**
156
+	 *
157
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::rfc2253String()
158
+	 * @return string
159
+	 */
160
+	public function rfc2253String()
161
+	{
162
+		return $this->stringValue();
163
+	}
164 164
     
165
-    /**
166
-     *
167
-     * @see \X501\ASN1\AttributeValue\AttributeValue::_transcodedString()
168
-     * @return string
169
-     */
170
-    protected function _transcodedString()
171
-    {
172
-        return $this->stringValue();
173
-    }
165
+	/**
166
+	 *
167
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::_transcodedString()
168
+	 * @return string
169
+	 */
170
+	protected function _transcodedString()
171
+	{
172
+		return $this->stringValue();
173
+	}
174 174
 }
Please login to merge, or discard this patch.
X509/AttributeCertificate/Attribute/AuthenticationInfoAttributeValue.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -11,19 +11,19 @@
 block discarded – undo
11 11
  */
12 12
 class AuthenticationInfoAttributeValue extends SvceAuthInfo
13 13
 {
14
-    const OID = "1.3.6.1.5.5.7.10.1";
14
+	const OID = "1.3.6.1.5.5.7.10.1";
15 15
     
16
-    /**
17
-     * Constructor.
18
-     *
19
-     * @param GeneralName $service
20
-     * @param GeneralName $ident
21
-     * @param string|null $auth_info
22
-     */
23
-    public function __construct(GeneralName $service, GeneralName $ident,
24
-        $auth_info = null)
25
-    {
26
-        parent::__construct($service, $ident, $auth_info);
27
-        $this->_oid = self::OID;
28
-    }
16
+	/**
17
+	 * Constructor.
18
+	 *
19
+	 * @param GeneralName $service
20
+	 * @param GeneralName $ident
21
+	 * @param string|null $auth_info
22
+	 */
23
+	public function __construct(GeneralName $service, GeneralName $ident,
24
+		$auth_info = null)
25
+	{
26
+		parent::__construct($service, $ident, $auth_info);
27
+		$this->_oid = self::OID;
28
+	}
29 29
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/Attribute/ChargingIdentityAttributeValue.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@
 block discarded – undo
9 9
  */
10 10
 class ChargingIdentityAttributeValue extends IetfAttrSyntax
11 11
 {
12
-    const OID = "1.3.6.1.5.5.7.10.3";
12
+	const OID = "1.3.6.1.5.5.7.10.3";
13 13
     
14
-    /**
15
-     * Constructor.
16
-     *
17
-     * @param IetfAttrValue ...$values
18
-     */
19
-    public function __construct(IetfAttrValue ...$values)
20
-    {
21
-        parent::__construct(...$values);
22
-        $this->_oid = self::OID;
23
-    }
14
+	/**
15
+	 * Constructor.
16
+	 *
17
+	 * @param IetfAttrValue ...$values
18
+	 */
19
+	public function __construct(IetfAttrValue ...$values)
20
+	{
21
+		parent::__construct(...$values);
22
+		$this->_oid = self::OID;
23
+	}
24 24
 }
Please login to merge, or discard this patch.
lib/X509/AttributeCertificate/Attribute/IetfAttrSyntax.php 1 patch
Indentation   +183 added lines, -183 removed lines patch added patch discarded remove patch
@@ -17,203 +17,203 @@
 block discarded – undo
17 17
  * @link https://tools.ietf.org/html/rfc5755#section-4.4
18 18
  */
19 19
 abstract class IetfAttrSyntax extends AttributeValue implements 
20
-    \Countable,
21
-    \IteratorAggregate
20
+	\Countable,
21
+	\IteratorAggregate
22 22
 {
23
-    /**
24
-     * Policy authority.
25
-     *
26
-     * @var GeneralNames|null $_policyAuthority
27
-     */
28
-    protected $_policyAuthority;
23
+	/**
24
+	 * Policy authority.
25
+	 *
26
+	 * @var GeneralNames|null $_policyAuthority
27
+	 */
28
+	protected $_policyAuthority;
29 29
     
30
-    /**
31
-     * Values.
32
-     *
33
-     * @var IetfAttrValue[] $_values
34
-     */
35
-    protected $_values;
30
+	/**
31
+	 * Values.
32
+	 *
33
+	 * @var IetfAttrValue[] $_values
34
+	 */
35
+	protected $_values;
36 36
     
37
-    /**
38
-     * Constructor.
39
-     *
40
-     * @param IetfAttrValue ...$values
41
-     */
42
-    public function __construct(IetfAttrValue ...$values)
43
-    {
44
-        $this->_policyAuthority = null;
45
-        $this->_values = $values;
46
-    }
37
+	/**
38
+	 * Constructor.
39
+	 *
40
+	 * @param IetfAttrValue ...$values
41
+	 */
42
+	public function __construct(IetfAttrValue ...$values)
43
+	{
44
+		$this->_policyAuthority = null;
45
+		$this->_values = $values;
46
+	}
47 47
     
48
-    /**
49
-     *
50
-     * @param UnspecifiedType $el
51
-     * @return self
52
-     */
53
-    public static function fromASN1(UnspecifiedType $el)
54
-    {
55
-        $seq = $el->asSequence();
56
-        $authority = null;
57
-        $idx = 0;
58
-        if ($seq->hasTagged(0)) {
59
-            $authority = GeneralNames::fromASN1(
60
-                $seq->getTagged(0)
61
-                    ->asImplicit(Element::TYPE_SEQUENCE)
62
-                    ->asSequence());
63
-            ++$idx;
64
-        }
65
-        $values = array_map(
66
-            function (UnspecifiedType $el) {
67
-                return IetfAttrValue::fromASN1($el);
68
-            },
69
-            $seq->at($idx)
70
-                ->asSequence()
71
-                ->elements());
72
-        $obj = new static(...$values);
73
-        $obj->_policyAuthority = $authority;
74
-        return $obj;
75
-    }
48
+	/**
49
+	 *
50
+	 * @param UnspecifiedType $el
51
+	 * @return self
52
+	 */
53
+	public static function fromASN1(UnspecifiedType $el)
54
+	{
55
+		$seq = $el->asSequence();
56
+		$authority = null;
57
+		$idx = 0;
58
+		if ($seq->hasTagged(0)) {
59
+			$authority = GeneralNames::fromASN1(
60
+				$seq->getTagged(0)
61
+					->asImplicit(Element::TYPE_SEQUENCE)
62
+					->asSequence());
63
+			++$idx;
64
+		}
65
+		$values = array_map(
66
+			function (UnspecifiedType $el) {
67
+				return IetfAttrValue::fromASN1($el);
68
+			},
69
+			$seq->at($idx)
70
+				->asSequence()
71
+				->elements());
72
+		$obj = new static(...$values);
73
+		$obj->_policyAuthority = $authority;
74
+		return $obj;
75
+	}
76 76
     
77
-    /**
78
-     * Get self with policy authority.
79
-     *
80
-     * @param GeneralNames $names
81
-     * @return self
82
-     */
83
-    public function withPolicyAuthority(GeneralNames $names)
84
-    {
85
-        $obj = clone $this;
86
-        $obj->_policyAuthority = $names;
87
-        return $obj;
88
-    }
77
+	/**
78
+	 * Get self with policy authority.
79
+	 *
80
+	 * @param GeneralNames $names
81
+	 * @return self
82
+	 */
83
+	public function withPolicyAuthority(GeneralNames $names)
84
+	{
85
+		$obj = clone $this;
86
+		$obj->_policyAuthority = $names;
87
+		return $obj;
88
+	}
89 89
     
90
-    /**
91
-     * Check whether policy authority is present.
92
-     *
93
-     * @return bool
94
-     */
95
-    public function hasPolicyAuthority()
96
-    {
97
-        return isset($this->_policyAuthority);
98
-    }
90
+	/**
91
+	 * Check whether policy authority is present.
92
+	 *
93
+	 * @return bool
94
+	 */
95
+	public function hasPolicyAuthority()
96
+	{
97
+		return isset($this->_policyAuthority);
98
+	}
99 99
     
100
-    /**
101
-     * Get policy authority.
102
-     *
103
-     * @throws \LogicException
104
-     * @return GeneralNames
105
-     */
106
-    public function policyAuthority()
107
-    {
108
-        if (!$this->hasPolicyAuthority()) {
109
-            throw new \LogicException("policyAuthority not set.");
110
-        }
111
-        return $this->_policyAuthority;
112
-    }
100
+	/**
101
+	 * Get policy authority.
102
+	 *
103
+	 * @throws \LogicException
104
+	 * @return GeneralNames
105
+	 */
106
+	public function policyAuthority()
107
+	{
108
+		if (!$this->hasPolicyAuthority()) {
109
+			throw new \LogicException("policyAuthority not set.");
110
+		}
111
+		return $this->_policyAuthority;
112
+	}
113 113
     
114
-    /**
115
-     * Get values.
116
-     *
117
-     * @return IetfAttrValue[]
118
-     */
119
-    public function values()
120
-    {
121
-        return $this->_values;
122
-    }
114
+	/**
115
+	 * Get values.
116
+	 *
117
+	 * @return IetfAttrValue[]
118
+	 */
119
+	public function values()
120
+	{
121
+		return $this->_values;
122
+	}
123 123
     
124
-    /**
125
-     * Get first value.
126
-     *
127
-     * @throws \LogicException
128
-     * @return IetfAttrValue
129
-     */
130
-    public function first()
131
-    {
132
-        if (!count($this->_values)) {
133
-            throw new \LogicException("No values.");
134
-        }
135
-        return $this->_values[0];
136
-    }
124
+	/**
125
+	 * Get first value.
126
+	 *
127
+	 * @throws \LogicException
128
+	 * @return IetfAttrValue
129
+	 */
130
+	public function first()
131
+	{
132
+		if (!count($this->_values)) {
133
+			throw new \LogicException("No values.");
134
+		}
135
+		return $this->_values[0];
136
+	}
137 137
     
138
-    /**
139
-     *
140
-     * @see \X501\ASN1\AttributeValue\AttributeValue::toASN1()
141
-     * @return Sequence
142
-     */
143
-    public function toASN1()
144
-    {
145
-        $elements = array();
146
-        if (isset($this->_policyAuthority)) {
147
-            $elements[] = new ImplicitlyTaggedType(0,
148
-                $this->_policyAuthority->toASN1());
149
-        }
150
-        $values = array_map(
151
-            function (IetfAttrValue $val) {
152
-                return $val->toASN1();
153
-            }, $this->_values);
154
-        $elements[] = new Sequence(...$values);
155
-        return new Sequence(...$elements);
156
-    }
138
+	/**
139
+	 *
140
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::toASN1()
141
+	 * @return Sequence
142
+	 */
143
+	public function toASN1()
144
+	{
145
+		$elements = array();
146
+		if (isset($this->_policyAuthority)) {
147
+			$elements[] = new ImplicitlyTaggedType(0,
148
+				$this->_policyAuthority->toASN1());
149
+		}
150
+		$values = array_map(
151
+			function (IetfAttrValue $val) {
152
+				return $val->toASN1();
153
+			}, $this->_values);
154
+		$elements[] = new Sequence(...$values);
155
+		return new Sequence(...$elements);
156
+	}
157 157
     
158
-    /**
159
-     *
160
-     * @see \X501\ASN1\AttributeValue\AttributeValue::stringValue()
161
-     * @return string
162
-     */
163
-    public function stringValue()
164
-    {
165
-        return "#" . bin2hex($this->toASN1()->toDER());
166
-    }
158
+	/**
159
+	 *
160
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::stringValue()
161
+	 * @return string
162
+	 */
163
+	public function stringValue()
164
+	{
165
+		return "#" . bin2hex($this->toASN1()->toDER());
166
+	}
167 167
     
168
-    /**
169
-     *
170
-     * @see \X501\ASN1\AttributeValue\AttributeValue::equalityMatchingRule()
171
-     * @return BinaryMatch
172
-     */
173
-    public function equalityMatchingRule()
174
-    {
175
-        return new BinaryMatch();
176
-    }
168
+	/**
169
+	 *
170
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::equalityMatchingRule()
171
+	 * @return BinaryMatch
172
+	 */
173
+	public function equalityMatchingRule()
174
+	{
175
+		return new BinaryMatch();
176
+	}
177 177
     
178
-    /**
179
-     *
180
-     * @see \X501\ASN1\AttributeValue\AttributeValue::rfc2253String()
181
-     * @return string
182
-     */
183
-    public function rfc2253String()
184
-    {
185
-        return $this->stringValue();
186
-    }
178
+	/**
179
+	 *
180
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::rfc2253String()
181
+	 * @return string
182
+	 */
183
+	public function rfc2253String()
184
+	{
185
+		return $this->stringValue();
186
+	}
187 187
     
188
-    /**
189
-     *
190
-     * @see \X501\ASN1\AttributeValue\AttributeValue::_transcodedString()
191
-     * @return string
192
-     */
193
-    protected function _transcodedString()
194
-    {
195
-        return $this->stringValue();
196
-    }
188
+	/**
189
+	 *
190
+	 * @see \X501\ASN1\AttributeValue\AttributeValue::_transcodedString()
191
+	 * @return string
192
+	 */
193
+	protected function _transcodedString()
194
+	{
195
+		return $this->stringValue();
196
+	}
197 197
     
198
-    /**
199
-     * Get number of values.
200
-     *
201
-     * @see \Countable::count()
202
-     * @return int
203
-     */
204
-    public function count()
205
-    {
206
-        return count($this->_values);
207
-    }
198
+	/**
199
+	 * Get number of values.
200
+	 *
201
+	 * @see \Countable::count()
202
+	 * @return int
203
+	 */
204
+	public function count()
205
+	{
206
+		return count($this->_values);
207
+	}
208 208
     
209
-    /**
210
-     * Get iterator for values.
211
-     *
212
-     * @see \IteratorAggregate::getIterator()
213
-     * @return \ArrayIterator
214
-     */
215
-    public function getIterator()
216
-    {
217
-        return new \ArrayIterator($this->_values);
218
-    }
209
+	/**
210
+	 * Get iterator for values.
211
+	 *
212
+	 * @see \IteratorAggregate::getIterator()
213
+	 * @return \ArrayIterator
214
+	 */
215
+	public function getIterator()
216
+	{
217
+		return new \ArrayIterator($this->_values);
218
+	}
219 219
 }
Please login to merge, or discard this patch.