return dpk;
}
-std::unique_ptr<DNSCryptoKeyEngine> DNSCryptoKeyEngine::makeFromPEMFile(DNSKEYRecordContent& drc, const std::string& filename, std::FILE& inputFile, const uint8_t algorithm)
+std::unique_ptr<DNSCryptoKeyEngine> DNSCryptoKeyEngine::makeFromPEMFile(DNSKEYRecordContent& drc, const uint8_t algorithm, std::FILE& inputFile, const std::string& filename)
{
auto maker = DNSCryptoKeyEngine::make(algorithm);
maker->createFromPEMFile(drc, filename, inputFile);
/**
* \brief Creates a key engine from a PEM file.
*
- * Receives an open file handle with PEM contents and creates a key
- * engine corresponding to the algorithm requested.
+ * Receives an open file handle with PEM contents and creates a key engine
+ * corresponding to the algorithm requested.
*
* \param[in] drc Key record contents to be populated.
*
- * \param[in] filename Only used for providing filename information
- * in error messages.
- *
- * \param[in] fp An open file handle to a file containing PEM
- * contents.
- *
* \param[in] algorithm Which algorithm to use. See
* https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml
*
- * \return A key engine corresponding to the requested algorithm and
- * populated with the contents of the PEM file.
+ * \param[in] fp An open file handle to a file containing PEM contents.
+ *
+ * \param[in] filename Only used for providing filename information in error messages.
+ *
+ * \return A key engine corresponding to the requested algorithm and populated with
+ * the contents of the PEM file.
*/
- static std::unique_ptr<DNSCryptoKeyEngine> makeFromPEMFile(DNSKEYRecordContent& drc, const std::string& filename, std::FILE& inputFile, uint8_t algorithm);
+ static std::unique_ptr<DNSCryptoKeyEngine> makeFromPEMFile(DNSKEYRecordContent& drc, uint8_t algorithm, std::FILE& inputFile, const std::string& filename);
static std::unique_ptr<DNSCryptoKeyEngine> makeFromISCString(DNSKEYRecordContent& drc, const std::string& content);
static std::unique_ptr<DNSCryptoKeyEngine> makeFromPublicKeyString(unsigned int algorithm, const std::string& raw);
}
DNSKEYRecordContent drc;
- shared_ptr<DNSCryptoKeyEngine> key{DNSCryptoKeyEngine::makeFromPEMFile(drc, filename, *fp, algorithm)};
+ shared_ptr<DNSCryptoKeyEngine> key{DNSCryptoKeyEngine::makeFromPEMFile(drc, algorithm, *fp, filename)};
if (!key) {
cerr << "Could not convert key from PEM to internal format" << endl;
return 1;
BOOST_REQUIRE(inputFile.get() != nullptr);
DNSKEYRecordContent pemDRC;
- shared_ptr<DNSCryptoKeyEngine> pemKey{DNSCryptoKeyEngine::makeFromPEMFile(pemDRC, "<buffer>", *inputFile, signer.algorithm)};
+ shared_ptr<DNSCryptoKeyEngine> pemKey{DNSCryptoKeyEngine::makeFromPEMFile(pemDRC, signer.algorithm, *inputFile, "<buffer>")};
BOOST_CHECK_EQUAL(pemKey->convertToISC(), dcke->convertToISC());