| 891 | } |
| 892 | |
| 893 | std::shared_ptr<X509> StringToCertificate(const String& cert) |
| 894 | { |
| 895 | BIO *bio = BIO_new(BIO_s_mem()); |
| 896 | BIO_write(bio, (const void *)cert.CStr(), cert.GetLength()); |
| 897 | |
| 898 | X509 *rawCert = PEM_read_bio_X509_AUX(bio, nullptr, nullptr, nullptr); |
| 899 | |
| 900 | BIO_free(bio); |
| 901 | |
| 902 | if (!rawCert) |
| 903 | BOOST_THROW_EXCEPTION(std::invalid_argument("The specified X509 certificate is invalid.")); |
| 904 | |
| 905 | return std::shared_ptr<X509>(rawCert, X509_free); |
| 906 | } |
| 907 | |
| 908 | String PBKDF2_SHA1(const String& password, const String& salt, int iterations) |
| 909 | { |
no test coverage detected