InAppBillingSecurity { public static String sign(String privateKey64, String data) { if (TextUtils.isEmpty(privateKey64) || TextUtils.isEmpty(data)) { throw new IllegalArgumentException("Given null data to sign"); } final PrivateKey privateKey = createPrivateKey(privateKey64); return sign(privateKey, data); }  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(expected = IllegalArgumentException.class) public void signDataWithNoKeyOrDataThrows() { InAppBillingSecurity.sign("", ""); }
@Test public void signsPurchaseData() { assertThat(InAppBillingSecurity.sign(TEST_PRIVATE_KEY, purchaseData)).isEqualTo(purchaseSignature); }