/** * @param Pbkdf2Params $params * @return Sequence */ public function getAsn(Pbkdf2Params $params) { $inner = new Sequence(new OctetString(unpack("H*", $params->getSalt())[1]), new Integer($params->getIterationCount())); if ($params->getKeyLength() !== null) { $inner[] = new Integer($params->getKeyLength()); } if ($params->getMethod() !== null) { $inner[] = new AlgorithmIdentifier(Pbkdf2AlgoOidMapper::getOidByName($params->getMethod())->getContent()); } return new Sequence(DigestOidMapper::getOidByName(Pbkdf2Factory::NAME_PBKDF2), $inner); }
public function testGetNameFromOid() { $oid = Pbkdf2AlgoOidMapper::getOidByName(Pbkdf2Factory::PBKDF2_WITH_SHA224); $name = Pbkdf2AlgoOidMapper::getNameFromOid($oid); $this->assertEquals(Pbkdf2Factory::PBKDF2_WITH_SHA224, $name); }