InAppBillingSecurity { public static boolean verifySignature(String publicKey64, String signedData, String signature64) { if (TextUtils.isEmpty(publicKey64) || TextUtils.isEmpty(signedData) || TextUtils.isEmpty(signature64)) { return false; } final PublicKey publicKey = createPublicKey(publicKey64); return verifySignature(publicKey, signedData, signature64); }  static PublicKey createPublicKey(String publicKey64); static PrivateKey createPrivateKey(String privateKey64); static String sign(String privateKey64, String data); static String sign(PrivateKey privateKey, String data); static boolean verifySignature(String publicKey64, String signedData, String signature64); static boolean verifySignature(PublicKey publicKey, String signedData, String signature64);  }
@Test public void verifySignatureWithNoDataReturnsFalse() { assertThat(InAppBillingSecurity.verifySignature("", null, "")).isFalse(); }
@Test public void verifiesSignatures() { assertThat(InAppBillingSecurity.verifySignature(TEST_PUBLIC_KEY, purchaseData, purchaseSignature)).isTrue(); }