UNICORN - iOS
MVerifyStoreReceipt.h
1 //
2 // MVerifyStoreReceipt.h
3 //
4 // Based on validatereceipt.h
5 // Created by Ruotger Skupin on 23.10.10.
6 // Copyright 2010-2011 Matthew Stevens, Ruotger Skupin, Apple, Alessandro Segala. All rights reserved.
7 //
8 // Modified for iOS, converted to ARC, and added additional fields by Rick Maddy 2013-08-20
9 // Copyright 2013 Rick Maddy. All rights reserved.
10 //
11 //
12 // Modified by saimushi 2014-11-27
13 
14 
15 // (!!!)
16 // Please defined apple root cert hash hear.
17 // #define APPLE_ROOT_CERT_HASH @"sha256(base64([(NSData's apple root cert) base64EncodedStringWithOptions:0]))"
18 // この定数定義はクラッキング対策です。リソースとして追加されているハズのAppleRoot証明書がJBなどで差し替えられてしまった場合に、ハードコード定数でハッシュ値チェックをすることで
19 // 正しいAppleRoot証明書によるレシートチェックが行える事を期待した処理の為の定数です。
20 #define APPLE_ROOT_CERT_HASH @"eeb8c729ef1b084e05547f51e3f56b25993619b651397ddf206b592e0b675853"
21 
22 
23 /*
24  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
25 
26  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
27 
28  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in
29  the documentation and/or other materials provided with the distribution.
30 
31  Neither the name of the copyright holders nor the names of its contributors may be used to endorse or promote products derived
32  from this software without specific prior written permission.
33 
34  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
35  BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
36  SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
38  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
39  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40  */
41 
42 #import <Foundation/Foundation.h>
43 #import <UIKit/UIKit.h>
44 
45 extern NSString *kReceiptBundleIdentifer;
46 extern NSString *kReceiptBundleIdentiferData;
47 extern NSString *kReceiptVersion;
48 extern NSString *kReceiptOpaqueValue;
49 extern NSString *kReceiptHash;
50 extern NSString *kReceiptInApp;
51 extern NSString *kReceiptOriginalVersion;
52 extern NSString *kReceiptExpirationDate;
53 
54 extern NSString *kReceiptInAppQuantity;
55 extern NSString *kReceiptInAppProductIdentifier;
56 extern NSString *kReceiptInAppTransactionIdentifier;
57 extern NSString *kReceiptInAppPurchaseDate;
58 extern NSString *kReceiptInAppOriginalTransactionIdentifier;
59 extern NSString *kReceiptInAppOriginalPurchaseDate;
60 extern NSString *kReceiptInAppSubscriptionExpirationDate;
61 extern NSString *kReceiptInAppCancellationDate;
62 extern NSString *kReceiptInAppWebOrderLineItemID;
63 
64 void setAppleRootCert(NSData *argAppleRootCert);
65 NSData *getAppleRootCert(void);
66 NSDictionary *dictionaryWithAppStoreReceipt(NSString *receiptPath);
67 NSArray *obtainInAppPurchases(NSString *receiptPath);
68 BOOL verifyReceiptAtPath(NSString *receiptPath);