| 1153 | |
| 1154 | public: |
| 1155 | explicit CryptKeyTypeManager(MemoryPool& p) |
| 1156 | : PermanentStorage(p), knownTypes(getPool()) |
| 1157 | { |
| 1158 | LocalStatus ls; |
| 1159 | CheckStatusWrapper st(&ls); |
| 1160 | for (GetPlugins<IWireCryptPlugin> cpItr(IPluginManager::TYPE_WIRE_CRYPT); cpItr.hasData(); cpItr.next()) |
| 1161 | { |
| 1162 | WIRECRYPT_DEBUG(fprintf(stderr, "CryptKeyTypeManager %s\n", cpItr.name())); |
| 1163 | |
| 1164 | const char* list = cpItr.plugin()->getKnownTypes(&st); |
| 1165 | check(&st); |
| 1166 | fb_assert(list); |
| 1167 | PathName tmp(list); |
| 1168 | ParsedList newTypes(tmp); |
| 1169 | |
| 1170 | PathName plugin(cpItr.name()); |
| 1171 | for (unsigned i = 0; i < newTypes.getCount(); ++i) |
| 1172 | { |
| 1173 | unsigned l; |
| 1174 | bool hasSpecific = cpItr.plugin()->getSpecificData(&st, newTypes[i].c_str(), &l) != nullptr; |
| 1175 | |
| 1176 | bool found = false; |
| 1177 | for (unsigned j = 0; j < knownTypes.getCount(); ++j) |
| 1178 | { |
| 1179 | if (knownTypes[j] == newTypes[i]) |
| 1180 | { |
| 1181 | knownTypes[j].add(plugin, hasSpecific); |
| 1182 | found = true; |
| 1183 | break; |
| 1184 | } |
| 1185 | } |
| 1186 | |
| 1187 | if (!found) |
| 1188 | { |
| 1189 | knownTypes.add().set(newTypes[i], plugin, hasSpecific); |
| 1190 | } |
| 1191 | } |
| 1192 | } |
| 1193 | } |
| 1194 | |
| 1195 | PathName operator[](const PathName& keyType) const |
| 1196 | { |