Assert.assertEquals(keyPair1.getPublic(), retData.publicKey());
// verify that data signature is still the same
Assert.assertTrue(retData.verify(keyPair1.getPublic(), factory));
// create signature with keys 1 having the data object
byte[] signature1 = factory.sign(keyPair1.getPrivate(), intialData.buffer()).encode();
// decrypt signature to get hash of the object
Cipher rsa = Cipher.getInstance("RSA");
rsa.init(Cipher.DECRYPT_MODE, keyPair1.getPublic());
byte[] hash = rsa.doFinal(signature1);