diff options
| author | Carl Hetherington <cth@carlh.net> | 2014-07-18 11:45:19 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2014-07-18 11:45:19 +0100 |
| commit | 9984f8318ba9999e39cf2f6688bd41408982cca9 (patch) | |
| tree | a74ace56260cbea8f326bc0cf9f5ca99e74353f0 /src/certificates.cc | |
| parent | 56e7a6f1768036df852a45d939b9adc038b17057 (diff) | |
Various small tweaks and fixes.
Diffstat (limited to 'src/certificates.cc')
| -rw-r--r-- | src/certificates.cc | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/certificates.cc b/src/certificates.cc index 46c60d6b..c03c371b 100644 --- a/src/certificates.cc +++ b/src/certificates.cc @@ -49,23 +49,6 @@ Certificate::Certificate (X509* c) } -/** Load an X509 certificate from a file. - * @param filename File to load. - */ -Certificate::Certificate (boost::filesystem::path filename) - : _certificate (0) - , _public_key (0) -{ - FILE* f = fopen_boost (filename, "r"); - if (!f) { - throw FileError ("could not open file", filename, errno); - } - - if (!PEM_read_X509 (f, &_certificate, 0, 0)) { - throw MiscError ("could not read X509 certificate"); - } -} - /** Load an X509 certificate from a string. * @param cert String to read from. */ @@ -255,8 +238,8 @@ Certificate::thumbprint () const uint8_t buffer[8192]; uint8_t* p = buffer; i2d_X509_CINF (_certificate->cert_info, &p); - int const length = p - buffer; - if (length > 8192) { + unsigned int const length = p - buffer; + if (length > sizeof (buffer)) { throw MiscError ("buffer too small to generate thumbprint"); } |
