public static boolean matchingKeys(final PrivateKey privateKey,
                                final PublicKey publicKey) throws GeneralSecurityException {
        Signature sign = Signature.getInstance(SIGNING_ALGORITHM);

        byte[] bytes = SAMPLE_CHALLANGE.getBytes(StandardCharsets.UTF_8);

        sign.initSign(privateKey);
        sign.update(bytes);
        byte[] signature = sign.sign();

        sign.initVerify(publicKey);
        sign.update(bytes);
        return sign.verify(signature);
    }
@Test
    void testMatchingPrivatePublicKeysvalid() throws Exception {
        KeyPairGenerator keyGen = KeyPairGenerator.getInstance(KEY_GENERATION_ALGORITHM);
        keyGen.initialize(2048);
        final java.security.KeyPair keyPair = keyGen.genKeyPair();
        Assertions.assertThat(KeystoreUtils.matchingKeys(keyPair.getPrivate(), keyPair.getPublic())).isTrue();
    }