diff options
author | Tomasz Swierczek <t.swierczek@samsung.com> | 2019-01-31 08:40:34 +0100 |
---|---|---|
committer | Tomasz Swierczek <t.swierczek@samsung.com> | 2019-01-31 12:58:07 +0100 |
commit | 3827b8432c226eb97d304d097cca1118bbba6aae (patch) | |
tree | e1506171c5338603f40a55ad6f24cd118246e1a3 | |
parent | 1b8e9d25cc5fd91e77d7e5c4f1d550f6fb7021c2 (diff) | |
download | cert-svc-3827b8432c226eb97d304d097cca1118bbba6aae.tar.gz cert-svc-3827b8432c226eb97d304d097cca1118bbba6aae.tar.bz2 cert-svc-3827b8432c226eb97d304d097cca1118bbba6aae.zip |
Add arbitrary key-value map data interface to pass data between plugins and API clientssubmit/tizen/20190201.054001submit/tizen/20190131.135638accepted/tizen/unified/20190202.022436
cert-svc allows to use validator plugins that can have any arbitrary logic embedded.
Installers may need to get special information, characteristic for plugins, from cert-svc.
New SignatureData class methods allow to set (on plugin side) and retrieve (on installer side)
simple string values that can have their meaning defined by plugin logic.
Installer should depend on specific plugin's key name definition (alternative is hard-coding)
and check for values using SignatureData interface.
Change-Id: I098a33b981d2b175ea72ba16cd8c968048ff116d
-rw-r--r-- | src/vcore/SignatureData.cpp | 17 | ||||
-rw-r--r-- | src/vcore/SignatureData.h | 8 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/vcore/SignatureData.cpp b/src/vcore/SignatureData.cpp index cfbcc1e..466b37c 100644 --- a/src/vcore/SignatureData.cpp +++ b/src/vcore/SignatureData.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2016 - 2019 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -153,4 +153,19 @@ CertificatePtr SignatureData::getRootCaCertificatePtr() const return CertificatePtr(); } +void SignatureData::setExtSignatureParam(const std::string &key, const std::string value) +{ + m_extSignatureParams[key] = value; +} + +bool SignatureData::getExtSignatureParam(const std::string &key, std::string &value) +{ + std::unordered_map<std::string, std::string>::const_iterator it = m_extSignatureParams.find(key); + if (it != m_extSignatureParams.end()) { + value = it->second; + return true; + } + return false; +} + } // ValidationCore diff --git a/src/vcore/SignatureData.h b/src/vcore/SignatureData.h index b3677d4..e7bb352 100644 --- a/src/vcore/SignatureData.h +++ b/src/vcore/SignatureData.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved + * Copyright (c) 2016 - 2019 Samsung Electronics Co., Ltd All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ #include <list> #include <set> #include <map> +#include <unordered_map> #include <string> #include <vcore/Certificate.h> @@ -75,6 +76,8 @@ public: const MEIDList &getMEIDList() const; CertificatePtr getEndEntityCertificatePtr() const; CertificatePtr getRootCaCertificatePtr() const; + void setExtSignatureParam(const std::string &key, const std::string value); + bool getExtSignatureParam(const std::string &key, std::string &value); friend class SignatureReader; @@ -100,6 +103,9 @@ private: ObjectList m_objectList; CertStoreId::Set m_storeIdSet; bool m_certificateSorted; + + //A map that can be used ie. by validator plugins to pass additional information to installer + std::unordered_map<std::string, std::string> m_extSignatureParams; }; } // ValidationCore |