class SecurityKeyLoader {

    public AsymmetricKeys load() throws Exception {
        Preconditions.checkState(jmapDraftConfiguration.isEnabled(), "JMAP is not enabled");

        KeyStore keystore = KeyStore.getInstance(JKS);
        char[] secret;
        try (InputStream fis = fileSystem.getResource(jmapDraftConfiguration.getKeystore())) {
            secret = jmapDraftConfiguration.getSecret().toCharArray();
            keystore.load(fis, secret);
        }
        Certificate aliasCertificate = Optional
                .ofNullable(keystore.getCertificate(ALIAS))
                .orElseThrow(() -> new KeyStoreException("Alias '" + ALIAS + "' keystore can't be found"));

        PublicKey publicKey = aliasCertificate.getPublicKey();
        Key key = keystore.getKey(ALIAS, secret);
        if (! (key instanceof PrivateKey)) {
            throw new KeyStoreException("Provided key is not a PrivateKey");
        }
        return new AsymmetricKeys((PrivateKey) key, publicKey);
    }

    @VisibleForTesting @Inject  SecurityKeyLoader(FileSystem fileSystem, JMAPDraftConfiguration jmapDraftConfiguration);

}