public Optional<EndpointCertificateMetadata> readEndpointCertificateMetadata(ApplicationId application) {
        try {
            Optional<byte[]> data = curator.getData(endpointCertificateMetadataPathOf(application));
            if (data.isEmpty() || data.get().length == 0) return Optional.empty();
            Slime slime = SlimeUtils.jsonToSlime(data.get());
            EndpointCertificateMetadata endpointCertificateMetadata = EndpointCertificateMetadataSerializer.fromSlime(slime.get());
            return Optional.of(endpointCertificateMetadata);
        } catch (Exception e) {
            throw new RuntimeException("Error reading endpoint certificate metadata for " + application, e);
        }
    }
@Test
    public void reads_object_format() {
        curator.set(endpointCertificateMetadataPath,
                "{\"keyName\": \"vespa.tlskeys.tenant1--app1-key\", \"certName\":\"vespa.tlskeys.tenant1--app1-cert\", \"version\": 0}"
                        .getBytes());

        // Read from zk and verify cert and key are available
        var secrets = endpointCertificateMetadataStore.readEndpointCertificateMetadata(applicationId)
                .flatMap(endpointCertificateRetriever::readEndpointCertificateSecrets);
        assertTrue(secrets.isPresent());
        assertTrue(secrets.get().key().startsWith("-----BEGIN EC PRIVATE KEY"));
        assertTrue(secrets.get().certificate().startsWith("-----BEGIN CERTIFICATE"));
    }