/** * List of all the entries in the secure store belonging to the specified namespace. No filtering or authentication * is done here. * @return A list of {@link SecureStoreMetadata} objects representing the data stored in the store. * @param namespace The namespace this key belongs to. * @throws NamespaceNotFoundException If the specified namespace does not exist. * @throws IOException If there was a problem reading from the keystore. */ @Override public List<SecureStoreMetadata> list(String namespace) throws Exception { checkNamespaceExists(namespace); readLock.lock(); try { Enumeration<String> aliases = keyStore.aliases(); List<SecureStoreMetadata> metadataList = new ArrayList<>(); String prefix = namespace + NAME_SEPARATOR; while (aliases.hasMoreElements()) { String alias = aliases.nextElement(); // Filter out elements not in this namespace. if (alias.startsWith(prefix)) { metadataList.add(getSecureStoreMetadata(alias)); } } return metadataList; } catch (KeyStoreException e) { throw new IOException("Failed to get the list of elements from the secure store.", e); } finally { readLock.unlock(); } }