Skip to content
This repository has been archived by the owner on Jun 23, 2021. It is now read-only.

Commit

Permalink
Fixing remaining OS X compilation bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
mattt committed Nov 15, 2013
1 parent fff990d commit 7da7c02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
7 changes: 1 addition & 6 deletions CargoBay/CargoBay.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@

#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>

#import <Availability.h>

#ifndef _SECURITY_SECBASE_H_
#warning Security framework not found in project, or not included in precompiled header. Server trust validation on receipt verifications will not be available.
#endif
#import <Security/Security.h>

/**
`CargoBay` provides a convenient block-based API to StoreKit functionality, as well as advanced functionality like receipt and transaction verification and external product information querying.
Expand Down
6 changes: 5 additions & 1 deletion CargoBay/CargoBay.m
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,9 @@ BOOL CBValidateTransactionMatchesPurchaseInfo(SKPaymentTransaction *transaction,

BOOL CBCheckReceiptSecurity(NSString *purchaseInfoString, NSString *signatureString, NSDate *purchaseDate) {
#ifdef _SECURITY_SECBASE_H_

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
BOOL isValid = NO;
SecCertificateRef leaf = NULL;
SecCertificateRef intermediate = NULL;
Expand Down Expand Up @@ -538,7 +541,7 @@ BOOL CBCheckReceiptSecurity(NSString *purchaseInfoString, NSString *signatureStr

CC_SHA1_Init(&SHA1Context);
CC_SHA1_Update(&SHA1Context, &signatureBlob->_receiptVersion, sizeof(signatureBlob->_receiptVersion));
CC_SHA1_Update(&SHA1Context, purchaseInfoBytes, purchaseInfoLength);
CC_SHA1_Update(&SHA1Context, purchaseInfoBytes, (CC_LONG)purchaseInfoLength);
CC_SHA1_Final(dataToBeVerified, &SHA1Context);

SecKeyRef receiptSigningKey = SecTrustCopyPublicKey(trust);
Expand Down Expand Up @@ -570,6 +573,7 @@ BOOL CBCheckReceiptSecurity(NSString *purchaseInfoString, NSString *signatureStr
}

return isValid;
#pragma clang diagnostic pop
#else
return YES;
#endif
Expand Down

0 comments on commit 7da7c02

Please sign in to comment.