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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
-
+
+
+
+
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
|
*/
#include <openssl/x509.h>
#import <ObjFW/OFObject.h>
#import <ObjFW/OFString.h>
@class OFDictionary;
OF_ASSUME_NONNULL_BEGIN
/* OIDs: */
#define OID_commonName @"2.5.4.3"
#define OID_surname @"2.5.4.4"
#define OID_serialNumber @"2.5.4.5"
#define OID_countryName @"2.5.4.6"
#define ID_localityName @"2.5.4.7"
#define OID_stateOrProvinceName @"2.5.4.8"
#define OID_streetAddress @"2.5.4.9"
#define OID_organizationName @"2.5.4.10"
#define OID_organizationalUnitName @"2.5.4.11"
#define OID_SRVName @"1.3.6.1.5.5.7.8.7"
@class OFDictionary;
@interface X509OID: OFObject <OFCopying>
{
OFString *_string;
}
- init OF_UNAVAILABLE;
- initWithUTF8String: (const char *)string;
- initWithUTF8String: (const char *)string OF_DESIGNATED_INITIALIZER;
@end
@interface X509Certificate: OFObject
{
X509 *_certificate;
OFDictionary *_issuer;
OFDictionary *_subject;
OFDictionary *_subjectAlternativeName;
}
@property (readonly, nonatomic) OFDictionary *issuer;
@property (readonly, nonatomic) OFDictionary *subject;
@property (readonly, nonatomic) OFDictionary *subjectAlternateName;
- init OF_UNAVAILABLE;
- initWithFile: (OFString *)file;
- initWithX509Struct: (X509 *)cert;
- (OFDictionary *)issuer;
- (OFDictionary *)subject;
- (OFDictionary *)subjectAlternativeName;
- (bool)hasCommonNameMatchingDomain: (OFString *)domain;
- (bool)hasDNSNameMatchingDomain: (OFString *)domain;
- (bool)hasSRVNameMatchingDomain: (OFString *)domain
service: (OFString *)service;
- (bool)X509_isAssertedDomain: (OFString *)asserted
equalDomain: (OFString *)domain;
- (OFDictionary *)X509_dictionaryFromX509Name: (X509_NAME *)name;
- (X509OID *)X509_stringFromASN1Object: (ASN1_OBJECT *)obj;
- (OFString *)X509_stringFromASN1String: (ASN1_STRING *)str;
@end
OF_ASSUME_NONNULL_END
|