security: Update Signature abstraction to match 0.1.1 spec
This commit removes intermediate SignatureWithPublicKey data
structure. All uses of such data structure should be replaced with just
Signature and check that KeyLocator is present (hasKeyLocator()).
Change-Id: I1157e05c6a717ea28df91c4bfd76c7145b520a15
Refs: #1750
diff --git a/src/security/sec-public-info-sqlite3.cpp b/src/security/sec-public-info-sqlite3.cpp
index 354c5aa..b2bd512 100644
--- a/src/security/sec-public-info-sqlite3.cpp
+++ b/src/security/sec-public-info-sqlite3.cpp
@@ -481,29 +481,14 @@
{
// this will throw an exception if the signature is not the standard one
// or there is no key locator present
- switch (certificate.getSignature().getType())
- {
- case Tlv::SignatureSha256WithRsa:
- {
- SignatureSha256WithRsa signature(certificate.getSignature());
- std::string signerName = signature.getKeyLocator().getName().toUri();
-
- sqlite3_bind_text(statement, 2, signerName, SQLITE_STATIC);
- break;
- }
- case Tlv::SignatureSha256WithEcdsa:
- {
- SignatureSha256WithEcdsa signature(certificate.getSignature());
- std::string signerName = signature.getKeyLocator().getName().toUri();
-
- sqlite3_bind_text(statement, 2, signerName, SQLITE_STATIC);
- break;
- }
- default:
- return;
- }
+ std::string signerName = certificate.getSignature().getKeyLocator().getName().toUri();
+ sqlite3_bind_text(statement, 2, signerName, SQLITE_STATIC);
}
- catch (std::runtime_error& e)
+ catch (Tlv::Error& e)
+ {
+ return;
+ }
+ catch (KeyLocator::Error& e)
{
return;
}