-
Notifications
You must be signed in to change notification settings - Fork 3
/
MissingPrivateKeyProblem.m
60 lines (53 loc) · 1.63 KB
/
MissingPrivateKeyProblem.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//
// MissingPrivateKeyProblem.m
// CertificateHelper
//
// Created by Karsten Kusche on 30.12.11.
// Copyright 2011 Briksoftware.com. All rights reserved.
//
#import "MissingPrivateKeyProblem.h"
#import "CertificateAccess.h"
@implementation MissingPrivateKeyProblem
@synthesize certificatesWithoutIdentity;
- (NSString*)htmlDescription
{
return @"<h1 class='red'>The following Certificates do not have a Private Key</h1>\n"
"<p class='description'>In order to use a certificate for signing, you need the private keys of the certificates</p>\n"
"<p class='help'>Please export the private key that are associated with the certificates on a mac, where they are available and then import the key to this mac</p>";
}
- (NSArray*)infoObjects
{
return self.certificatesWithoutIdentity;
}
+ (void)load
{
[self registerSubclass];
}
+ (id)problemIfExists
{
CertificateAccess* access = [CertificateAccess certificateAccess];
NSArray* allCertificates = [access developerCertificatesInList:[access availableCertificateNames]];
NSArray* properCertificates = [access developerCertificatesInList:[access workingCertificateNames]];
NSMutableArray* array = [NSMutableArray array];
for (NSString* certificateName in allCertificates)
{
if ([properCertificates containsObject:certificateName] == NO)
{
[array addObject: certificateName];
}
};
MissingPrivateKeyProblem* problem = nil;
if ([array count])
{
problem = [self problem];
NSLog(@"array: %@",array);
problem.certificatesWithoutIdentity = array;
}
return problem;
}
- (ProblemSeverity)severity
{
// used to sort the problems, the problem with the highest count is taken
return high;
}
@end