public Optional<KeyStore> get() throws KeyStoreStorageException {
        return loadKeystore().filter(this::isValidKeyAndCert);
    }
@Test
    void testReadLegacyKeystore() throws Exception {
        final MongoConnection mongoConnection = mongodb.mongoConnection();

        final String passwordSecret = "this_is_my_secret_password";
        final SimpleNodeId nodeId = new SimpleNodeId("5ca1ab1e-0000-4000-a000-000000000000");
        final EncryptedValueService encryptedValueService = new EncryptedValueService(passwordSecret);

        final KeyStore keystore = createSignedKeystore(passwordSecret);
        final String keystoreStringRepresentation = keystoreToBase64(keystore, passwordSecret.toCharArray());
        writeCertToMongo(mongoConnection.getMongoDatabase(), nodeId, keystoreStringRepresentation, encryptedValueService);

        final LegacyDatanodeKeystoreProvider legacyDatanodeKeystoreProvider = new LegacyDatanodeKeystoreProvider(nodeId, passwordSecret, Mockito.mock(DatanodeConfiguration.class), mongoConnection, encryptedValueService);

        final Optional<KeyStore> legacyKeystore = legacyDatanodeKeystoreProvider.get();
        Assertions.assertThat(legacyKeystore)
                .isPresent()
                .hasValueSatisfying(keyStore -> {
                    try {
                        Assertions.assertThat(keyStore.getKey("datanode", passwordSecret.toCharArray())).isNotNull();
                        Assertions.assertThat(keyStore.getCertificateChain("datanode")).isNotNull().hasSize(2);
                    } catch (KeyStoreException | NoSuchAlgorithmException | UnrecoverableKeyException e) {
                        throw new RuntimeException(e);
                    }
                });
    }