/** * Get PRF by algorithm identifier. * * @param PRFAlgorithmIdentifier $algo * @throws \UnexpectedValueException * @return self */ public static function fromAlgorithmIdentifier(PRFAlgorithmIdentifier $algo) { $oid = $algo->oid(); if (array_key_exists($oid, self::MAP_HASH_OID_TO_CLASS)) { $cls = self::MAP_HASH_OID_TO_CLASS[$oid]; return new $cls(); } throw new \UnexpectedValueException("PRF algorithm " . $algo->oid() . " not supported."); }
protected function _paramsASN1() { $elements = array(); $elements[] = new OctetString($this->_specifiedSalt); $elements[] = new Integer($this->_iterationCount); if (isset($this->_keyLength)) { $elements[] = new Integer($this->_keyLength); } if ($this->_prfAlgo->oid() !== AlgorithmIdentifier::OID_HMAC_WITH_SHA1) { $elements[] = $this->_prfAlgo->toASN1(); } return new Sequence(...$elements); }