aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
authorKai Michaelis <[email protected]>2016-09-22 13:43:43 +0200
committerseu <[email protected]>2016-10-02 18:10:43 +0200
commit16eb674ecfc29102a0eef6c38929b78848c4467b (patch)
treeb6495bcd82d6809f0bc24be7ad5671157a385d5d /src/lib
parent6c8998cb853605f17cebb76dd61496b05941d04f (diff)
1st review round
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/cert/x509/certstor.cpp3
-rw-r--r--src/lib/cert/x509/certstor_sql/certstor_sql.cpp12
-rw-r--r--src/lib/cert/x509/certstor_sql/certstor_sql.h8
3 files changed, 8 insertions, 15 deletions
diff --git a/src/lib/cert/x509/certstor.cpp b/src/lib/cert/x509/certstor.cpp
index 4ef0e5240..6d02d41c6 100644
--- a/src/lib/cert/x509/certstor.cpp
+++ b/src/lib/cert/x509/certstor.cpp
@@ -5,7 +5,6 @@
* Botan is released under the Simplified BSD License (see license.txt)
*/
-#include <cassert>
#include <botan/certstor.h>
#include <botan/ber_dec.h>
#include <botan/der_enc.h>
@@ -16,8 +15,6 @@
#include <botan/hash.h>
#include <botan/hex.h>
-#include <iostream>
-
namespace Botan {
std::shared_ptr<const X509_CRL> Certificate_Store::find_crl_for(const X509_Certificate&) const
diff --git a/src/lib/cert/x509/certstor_sql/certstor_sql.cpp b/src/lib/cert/x509/certstor_sql/certstor_sql.cpp
index d8325fb87..3a457a2a4 100644
--- a/src/lib/cert/x509/certstor_sql/certstor_sql.cpp
+++ b/src/lib/cert/x509/certstor_sql/certstor_sql.cpp
@@ -175,15 +175,15 @@ Certificate_Store_In_SQL::find_certs_for_key(const Private_Key& key) const
stmt->bind(1,fpr);
- std::shared_ptr<const X509_Certificate> cert;
+ std::vector<std::shared_ptr<const X509_Certificate>> certs;
while(stmt->step())
{
auto blob = stmt->get_blob(0);
- cert = std::make_shared<X509_Certificate>(
- std::vector<byte>(blob.first,blob.first + blob.second));
+ certs.push_back(std::make_shared<X509_Certificate>(
+ std::vector<byte>(blob.first,blob.first + blob.second)));
}
- return {cert};
+ return certs;
}
bool Certificate_Store_In_SQL::insert_key(const X509_Certificate& cert, const Private_Key& key) {
@@ -196,8 +196,6 @@ bool Certificate_Store_In_SQL::insert_key(const X509_Certificate& cert, const Pr
auto pkcs8 = PKCS8::BER_encode(key,rng,m_password);
auto fpr = fingerprint_key(key);
- //m_database->new_statement("BEGIN TRANSACTION")->spin();
-
auto stmt1 = m_database->new_statement(
"INSERT OR REPLACE INTO keys ( fingerprint, key ) VALUES ( ?1, ?2 )");
@@ -212,8 +210,6 @@ bool Certificate_Store_In_SQL::insert_key(const X509_Certificate& cert, const Pr
stmt2->bind(2,cert.fingerprint("SHA-256"));
stmt2->spin();
- //m_database->new_statement("END TRANSACTION")->spin();
-
return true;
}
diff --git a/src/lib/cert/x509/certstor_sql/certstor_sql.h b/src/lib/cert/x509/certstor_sql/certstor_sql.h
index 24db88cdd..096426b7a 100644
--- a/src/lib/cert/x509/certstor_sql/certstor_sql.h
+++ b/src/lib/cert/x509/certstor_sql/certstor_sql.h
@@ -33,10 +33,6 @@ class BOTAN_DLL Certificate_Store_In_SQL : public Certificate_Store
virtual std::shared_ptr<const X509_Certificate>
find_cert(const X509_DN& subject_dn, const std::vector<byte>& key_id) const override;
- /// Generates a CRL for all certificates issued by "subject"s issuer.
- virtual std::shared_ptr<const X509_CRL>
- find_crl_for(const X509_Certificate& subject) const override;
-
/// Returns all subject DNs known to the store instance,
virtual std::vector<X509_DN> all_subjects() const override;
@@ -80,6 +76,10 @@ class BOTAN_DLL Certificate_Store_In_SQL : public Certificate_Store
*/
std::vector<X509_CRL> generate_crls() const;
+ /// Generates a CRL for all certificates issued by the given issuer.
+ virtual std::shared_ptr<const X509_CRL>
+ find_crl_for(const X509_Certificate& issuer) const override;
+
private:
std::string fingerprint_key(const Private_Key&) const;