diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-18 00:15:34 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-18 00:15:34 +0100 |
| commit | 56e7a6f1768036df852a45d939b9adc038b17057 (patch) | |
| tree | 93cf6bb1fb7c9ebe43de09d7690e69cd75b634ea /src/decrypted_kdm.cc | |
| parent | 0b85b9216da9d6519a553de67103a9417504aba1 (diff) | |
Quite large reworking of signer/cert handling.
Diffstat (limited to 'src/decrypted_kdm.cc')
| -rw-r--r-- | src/decrypted_kdm.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/decrypted_kdm.cc b/src/decrypted_kdm.cc index 8a714b1e..556cd9d5 100644 --- a/src/decrypted_kdm.cc +++ b/src/decrypted_kdm.cc @@ -98,17 +98,16 @@ get (uint8_t ** p, int N) return g; } -DecryptedKDM::DecryptedKDM (EncryptedKDM const & kdm, boost::filesystem::path private_key) +DecryptedKDM::DecryptedKDM (EncryptedKDM const & kdm, string private_key) { /* Read the private key */ - - FILE* private_key_file = fopen_boost (private_key, "r"); - if (!private_key_file) { - throw FileError ("could not find RSA private key file", private_key, errno); + + BIO* bio = BIO_new_mem_buf (const_cast<char *> (private_key.c_str ()), -1); + if (!bio) { + throw MiscError ("could not create memory BIO"); } - RSA* rsa = PEM_read_RSAPrivateKey (private_key_file, 0, 0, 0); - fclose (private_key_file); + RSA* rsa = PEM_read_bio_RSAPrivateKey (bio, 0, 0, 0); if (!rsa) { throw FileError ("could not read RSA private key file", private_key, errno); } @@ -180,6 +179,7 @@ DecryptedKDM::DecryptedKDM (EncryptedKDM const & kdm, boost::filesystem::path pr } RSA_free (rsa); + BIO_free (bio); } DecryptedKDM::DecryptedKDM ( |
