private KeyPair loadOrCreateKeyPair(final File file) throws IOException {
        val acme = casProperties.getAcme();
        if (file.exists()) {
            try (val fr = new FileReader(file, StandardCharsets.UTF_8)) {
                return KeyPairUtils.readKeyPair(fr);
            }
        } else {
            val userKeyPair = KeyPairUtils.createKeyPair(acme.getKeySize());
            try (val fw = new FileWriter(file, StandardCharsets.UTF_8)) {
                KeyPairUtils.writeKeyPair(userKeyPair, fw);
            }
            return userKeyPair;
        }
    }
Loads a domain key pair. If the file does not exist,
a new key pair is generated and saved.

@return Domain {@link KeyPair}.
support/cas-server-support-acme/src/main/java/org/apereo/cas/acme/DefaultAcmeCertificateManager.java