@Override
    public Mono<byte[]> decrypt(byte[] encryptedMessage) {
        return Mono.just(this.keyPair)
            .map(KeyPair::getPrivate)
            .flatMap(privateKey -> {
                try {
                    var cipher = Cipher.getInstance(TRANSFORMATION);
                    cipher.init(Cipher.DECRYPT_MODE, privateKey);
                    return Mono.just(cipher.doFinal(encryptedMessage));
                } catch (NoSuchAlgorithmException
                         | NoSuchPaddingException
                         | InvalidKeyException e) {
                    return Mono.error(new RuntimeException(
                        "Failed to read private key or the key was invalid.", e
                    ));
                } catch (IllegalBlockSizeException | BadPaddingException e) {
                    return Mono.error(new InvalidEncryptedMessageException(
                        "Invalid encrypted message."
                    ));
                }
            })
            .subscribeOn(Schedulers.boundedElastic());
    }
@Test
    void shouldFailToDecryptMessage() {
        StepVerifier.create(service.decrypt("invalid-bytes".getBytes()))
            .verifyError(InvalidEncryptedMessageException.class);
    }