tv.ouya.console.api
Class OuyaEncryptionHelper

java.lang.Object
  extended by tv.ouya.console.api.OuyaEncryptionHelper

public class OuyaEncryptionHelper
extends java.lang.Object


Constructor Summary
OuyaEncryptionHelper()
           
 
Method Summary
static tv.ouya.console.api.Product decryptProductResponse(java.lang.String encryptedResponse, byte[] appKey)
          Decrypt a Product response from the server using the supplied application public key.
 java.lang.String decryptPurchaseResponse(org.json.JSONObject encryptedResponse, java.security.PublicKey appKey)
          Decrypt a purchase response from the server using the supplied application public key.
 java.util.List<tv.ouya.console.api.Receipt> decryptReceiptResponse(org.json.JSONObject encryptedResponse, java.security.PublicKey appKey)
          Decrypt a receipt response from the server using the supplied application public key.
 java.util.List<tv.ouya.console.api.Receipt> parseJSONReceiptResponse(org.json.JSONArray receiptArray)
          Parse a JSONArray holding Receipts.
 java.util.List<tv.ouya.console.api.Receipt> parseJSONReceiptResponse(java.lang.String receiptResponse)
          Parse the receipt JSON.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OuyaEncryptionHelper

public OuyaEncryptionHelper()
Method Detail

decryptReceiptResponse

public java.util.List<tv.ouya.console.api.Receipt> decryptReceiptResponse(org.json.JSONObject encryptedResponse,
                                                                          java.security.PublicKey appKey)
                                                                   throws java.security.GeneralSecurityException,
                                                                          java.io.IOException,
                                                                          org.json.JSONException,
                                                                          java.text.ParseException
Decrypt a receipt response from the server using the supplied application public key.

Parameters:
encryptedResponse - The encrypted response from the server.
appKey - The applications public key.
Returns:
A List of Receipts which are in the response.
Throws:
java.security.GeneralSecurityException - Thrown if there is an issue decrypting the server response.
java.io.IOException - Thrown if there is a problem parsing the response from the server.
org.json.JSONException
java.text.ParseException

decryptPurchaseResponse

public java.lang.String decryptPurchaseResponse(org.json.JSONObject encryptedResponse,
                                                java.security.PublicKey appKey)
                                         throws java.security.GeneralSecurityException,
                                                java.io.IOException,
                                                org.json.JSONException,
                                                java.text.ParseException
Decrypt a purchase response from the server using the supplied application public key.

Parameters:
encryptedResponse - The encrypted response from the server.
appKey - The applications public key.
Returns:
The ID which was returned from the server.
Throws:
java.security.GeneralSecurityException - Thrown if there is an issue decrypting the server response.
java.io.IOException - Thrown if there is a problem parsing the response from the server.
org.json.JSONException
java.text.ParseException

parseJSONReceiptResponse

public java.util.List<tv.ouya.console.api.Receipt> parseJSONReceiptResponse(java.lang.String receiptResponse)
                                                                     throws java.io.IOException
Parse the receipt JSON.

Parameters:
receiptResponse - the receipt response to parse
Returns:
A List of Receipt objects.
Throws:
java.io.IOException

parseJSONReceiptResponse

public java.util.List<tv.ouya.console.api.Receipt> parseJSONReceiptResponse(org.json.JSONArray receiptArray)
                                                                     throws org.json.JSONException,
                                                                            java.text.ParseException
Parse a JSONArray holding Receipts.

Parameters:
receiptArray - The JSON array holding the purchase information.
Returns:
A List of Receipt objects.
Throws:
org.json.JSONException
java.text.ParseException

decryptProductResponse

public static tv.ouya.console.api.Product decryptProductResponse(java.lang.String encryptedResponse,
                                                                 byte[] appKey)
                                                          throws java.security.GeneralSecurityException,
                                                                 java.io.IOException,
                                                                 org.json.JSONException
Decrypt a Product response from the server using the supplied application public key.

Parameters:
encryptedResponse - The encrypted response from the server.
appKey - The applications public key.
Returns:
The decrypted Product
Throws:
java.security.GeneralSecurityException - Thrown if there is an issue decrypting the server response.
java.io.IOException - Thrown if there is a problem parsing the response from the server.
org.json.JSONException


Copyright © 2012 OUYA, Inc. All Rights Reserved.