lululombard / CertRemainTime

A tool to know when your Electra/yalu (and some forks like Yalu Dark)/mach portal/Home Depot cert will expire.
Do What The F*ck You Want To Public License
17 stars 11 forks source link

Reading .mobileprovision with ManagedConfiguration.framework #8

Open julioverne opened 7 years ago

julioverne commented 7 years ago

by linking Private Framework ManagedConfiguration.framework can be decode .mobileprovision to NSDictionary without crash. i have used this method in Ext3nder and fix all crash.

#import "CertUtils.h"

@interface MCProfile : NSObject
+ (NSDictionary*)profileDictionaryFromProfileData:(NSData*)arg1 outError:(NSError **)arg2;
@end

@implementation CertUtils
+ (NSDictionary *)provisioningProfileAtPath:(NSString *)path {
    @try {
        if(NSData *fileData = [NSData dataWithContentsOfFile:path]) {
            if(NSDictionary *plist = [MCProfile profileDictionaryFromProfileData:fileData outError:nil]) {
                return plist;
            }
        }
    }@catch (NSException * e) {
        return @{};
    }
    return @{};
}
@end