public class Security
extends java.lang.Object
| 构造器和说明 |
|---|
Security() |
| 限定符和类型 | 方法和说明 |
|---|---|
static java.security.PublicKey |
generatePublicKey(java.lang.String encodedPublicKey)
Generates a PublicKey instance from a string containing the
Base64-encoded public key.
|
static boolean |
verify(java.security.PublicKey publicKey,
java.lang.String signedData,
java.lang.String signature)
Verifies that the signature from the server matches the computed
signature on the data.
|
static boolean |
verifyPurchase(java.lang.String base64PublicKey,
java.lang.String signedData,
java.lang.String signature)
Verifies that the data was signed with the given signature, and returns
the verified purchase.
|
public static boolean verifyPurchase(java.lang.String base64PublicKey,
java.lang.String signedData,
java.lang.String signature)
PurchaseState
and product ID of the purchase.base64PublicKey - the base64-encoded public key to use for verifying.signedData - the signed JSON string (signed, not encrypted)signature - the signature for the data, signed with the private keypublic static java.security.PublicKey generatePublicKey(java.lang.String encodedPublicKey)
encodedPublicKey - Base64-encoded public keyjava.lang.IllegalArgumentException - if encodedPublicKey is invalidpublic static boolean verify(java.security.PublicKey publicKey,
java.lang.String signedData,
java.lang.String signature)
publicKey - public key associated with the developer accountsignedData - signed data from serversignature - server signature