Skip to content

Commit

Permalink
Tweak formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
sop committed May 15, 2019
1 parent 60a94ab commit 03b88f1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,8 @@ public static function fromASN1Params(
throw new \UnexpectedValueException('No parameters.');
}
$seq = $params->asSequence();
$salt = $seq->at(0)
->asOctetString()
->string();
$iteration_count = $seq->at(1)
->asInteger()
->intNumber();
$salt = $seq->at(0)->asOctetString()->string();
$iteration_count = $seq->at(1)->asInteger()->intNumber();
return new static($salt, $iteration_count);
}

Expand Down
10 changes: 3 additions & 7 deletions lib/PKCS5/ASN1/AlgorithmIdentifier/PBKDF2AlgorithmIdentifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,16 +131,12 @@ public static function fromASN1Params(
default:
throw new \UnexpectedValueException('Invalid salt encoding.');
}
$iteration_count = $seq->at(1)
->asInteger()
->intNumber();
$iteration_count = $seq->at(1)->asInteger()->intNumber();
$key_length = null;
$prf_algo = null;
$idx = 2;
if ($seq->has($idx, Element::TYPE_INTEGER)) {
$key_length = $seq->at($idx++)
->asInteger()
->intNumber();
$key_length = $seq->at($idx++)->asInteger()->intNumber();
}
if ($seq->has($idx, Element::TYPE_SEQUENCE)) {
$prf_algo = AlgorithmIdentifier::fromASN1(
Expand Down Expand Up @@ -222,7 +218,7 @@ protected function _paramsASN1(): ?Element
if (isset($this->_keyLength)) {
$elements[] = new Integer($this->_keyLength);
}
if (AlgorithmIdentifier::OID_HMAC_WITH_SHA1 != $this->_prfAlgo->oid()) {
if (AlgorithmIdentifier::OID_HMAC_WITH_SHA1 !== $this->_prfAlgo->oid()) {
$elements[] = $this->_prfAlgo->toASN1();
}
return new Sequence(...$elements);
Expand Down

0 comments on commit 03b88f1

Please sign in to comment.