QList<T> getList(const QString &provider) { QList<T> list; // single if(!provider.isEmpty()) { Provider *p = providerForName(provider); if(p) list = G::getList(p); } // all else { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { QList<T> other = G::getList(pl[n]); for(int k = 0; k < other.count(); ++k) { // only add what we don't have in the list if(!list.contains(other[k])) list += other[k]; } } } return list; }
T getKey(const QString &provider, const I &in, const SecureArray &passphrase, ConvertResult *result) { T k; // single if(!provider.isEmpty()) { Provider *p = providerForName(provider); if(!p) return k; k = G::getKey(p, in, passphrase, result); } // all else { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { ConvertResult r; k = G::getKey(pl[n], in, passphrase, &r); if(result) *result = r; if(!k.isNull()) break; if(r == ErrorPassphrase) // don't loop if we get this break; } } return k; }
Provider *providerForName(const QString &name) { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { if(pl[n]->name() == name) return pl[n]; } return 0; }
Provider *providerForGroupSet(DLGroupSet set) { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { if(Getter_GroupSet::getList(pl[n]).contains(set)) return pl[n]; } return 0; }
Provider *providerForPBE(PBEAlgorithm alg) { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { if(Getter_PBE::getList(pl[n]).contains(alg)) return pl[n]; } return 0; }
Provider *providerForIOType(PKey::Type type, const PKeyContext *prefer = 0) { Provider *preferProvider = 0; if(prefer) { preferProvider = prefer->provider(); if(prefer && prefer->supportedIOTypes().contains(type)) return preferProvider; } ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { if(preferProvider && pl[n] == preferProvider) continue; if(Getter_IOType::getList(pl[n]).contains(type)) return pl[n]; } return 0; }
Provider *providerForPBE(PBEAlgorithm alg, PKey::Type ioType, const PKeyContext *prefer = 0) { Provider *preferProvider = 0; if(prefer) { preferProvider = prefer->provider(); if(prefer->supportedPBEAlgorithms().contains(alg) && prefer->supportedIOTypes().contains(ioType)) return preferProvider; } ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) { if(preferProvider && pl[n] == preferProvider) continue; if(Getter_PBE::getList(pl[n]).contains(alg) && Getter_IOType::getList(pl[n]).contains(ioType)) return pl[n]; } return 0; }
QList<T> getList(const QString &provider) { QList<T> list; // single if(!provider.isEmpty()) { Provider *p = providerForName(provider); if(p) list = G::getList(p); } // all else { ProviderList pl = allProviders(); for(int n = 0; n < pl.count(); ++n) list += G::getList(pl[n]); } return list; }