ObjFW  Diff

Differences From Artifact [6ceb7a1c4f]:

To Artifact [2f49749142]:


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
77


78
79
80
81
82
83
84
85

86
87
88
89
90

91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112


113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129


130
131
132
133
134
135
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
77
78
79
80
81
82
83
84

85
86
87
88
89

90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110


111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127


128
129
130
131
132
133
134
135







-
+

-
+

-
+

-
-
+
+






-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
+

-
-
+
+







-
-
+
+







-
+




-
+




















-
-
+
+















-
-
+
+






@class OFData;

/**
 * @brief ASN.1 tag class.
 */
typedef enum {
	/** Universal */
	OF_ASN1_TAG_CLASS_UNIVERSAL	   = 0x0,
	OFASN1TagClassUniversal	      = 0x0,
	/** Application */
	OF_ASN1_TAG_CLASS_APPLICATION	   = 0x1,
	OFASN1TagClassApplication     = 0x1,
	/** Context specific */
	OF_ASN1_TAG_CLASS_CONTEXT_SPECIFIC = 0x2,
	OFASN1TagClassContextSpecific = 0x2,
	/** Private */
	OF_ASN1_TAG_CLASS_PRIVATE	   = 0x3
} of_asn1_tag_class_t;
	OFASN1TagClassPrivate	      = 0x3
} OFASN1TagClass;

/**
 * @brief ASN.1 tag number.
 */
typedef enum {
	/** Boolean */
	OF_ASN1_TAG_NUMBER_BOOLEAN	     = 0x01,
	OFASN1TagNumberBoolean		= 0x01,
	/** Integer */
	OF_ASN1_TAG_NUMBER_INTEGER	     = 0x02,
	OFASN1TagNumberInteger		= 0x02,
	/** Bit string */
	OF_ASN1_TAG_NUMBER_BIT_STRING	     = 0x03,
	OFASN1TagNumberBitString	= 0x03,
	/** Octet string */
	OF_ASN1_TAG_NUMBER_OCTET_STRING	     = 0x04,
	OFASN1TagNumberOctetString	= 0x04,
	/** Null */
	OF_ASN1_TAG_NUMBER_NULL		     = 0x05,
	OFASN1TagNumberNull		= 0x05,
	/** Object Identifier */
	OF_ASN1_TAG_NUMBER_OBJECT_IDENTIFIER = 0x06,
	OFASN1TagNumberObjectIdentifier	= 0x06,
	/** Enumerated */
	OF_ASN1_TAG_NUMBER_ENUMERATED	     = 0x0A,
	OFASN1TagNumberEnumerated	= 0x0A,
	/** UTF-8 string */
	OF_ASN1_TAG_NUMBER_UTF8_STRING	     = 0x0C,
	OFASN1TagNumberUTF8String	= 0x0C,
	/** Sequence */
	OF_ASN1_TAG_NUMBER_SEQUENCE	     = 0x10,
	OFASN1TagNumberSequence		= 0x10,
	/** Set */
	OF_ASN1_TAG_NUMBER_SET		     = 0x11,
	OFASN1TagNumberSet		= 0x11,
	/** NumericString */
	OF_ASN1_TAG_NUMBER_NUMERIC_STRING    = 0x12,
	OFASN1TagNumberNumericString	= 0x12,
	/** PrintableString */
	OF_ASN1_TAG_NUMBER_PRINTABLE_STRING  = 0x13,
	OFASN1TagNumberPrintableString	= 0x13,
	/** IA5String */
	OF_ASN1_TAG_NUMBER_IA5_STRING	     = 0x16
} of_asn1_tag_number_t;
	OFASN1TagNumberIA5String	= 0x16
} OFASN1TagNumber;

/**
 * @brief A class representing an ASN.1 value.
 */
OF_SUBCLASSING_RESTRICTED
@interface OFASN1Value: OFObject
{
	of_asn1_tag_class_t _tagClass;
	of_asn1_tag_number_t _tagNumber;
	OFASN1TagClass _tagClass;
	OFASN1TagNumber _tagNumber;
	bool _constructed;
	OFData *_DEREncodedContents;
}

/**
 * @brief The tag class of the value's type.
 */
@property (readonly, nonatomic) of_asn1_tag_class_t tagClass;
@property (readonly, nonatomic) OFASN1TagClass tagClass;

/**
 * @brief The tag number of the value's type.
 */
@property (readonly, nonatomic) of_asn1_tag_number_t tagNumber;
@property (readonly, nonatomic) OFASN1TagNumber tagNumber;

/**
 * @brief Whether the value if of a constructed type.
 */
@property (readonly, nonatomic, getter=isConstructed) bool constructed;

/**
 * @brief The DER-encoded contents octets of the value.
 */
@property (readonly, nonatomic) OFData *DEREncodedContents;

/**
 * @brief Creates a new ASN.1 value with the specified arguments.
 *
 * @param tagClass The tag class of the value's type
 * @param tagNumber The tag number of the value's type
 * @param constructed Whether the value if of a constructed type
 * @param DEREncodedContents The DER-encoded contents octets of the value.
 * @return A new ASN.1 value
 */
+ (instancetype)valueWithTagClass: (of_asn1_tag_class_t)tagClass
			tagNumber: (of_asn1_tag_number_t)tagNumber
+ (instancetype)valueWithTagClass: (OFASN1TagClass)tagClass
			tagNumber: (OFASN1TagNumber)tagNumber
		      constructed: (bool)constructed
	       DEREncodedContents: (OFData *)DEREncodedContents;

- (instancetype)init OF_UNAVAILABLE;

/**
 * @brief Initializes an already allocated ASN.1 value with the specified
 *	  arguments.
 *
 * @param tagClass The tag class of the value's type
 * @param tagNumber The tag number of the value's type
 * @param constructed Whether the value if of a constructed type
 * @param DEREncodedContents The DER-encoded contents octets of the value.
 * @return An initialized ASN.1 value
 */
- (instancetype)initWithTagClass: (of_asn1_tag_class_t)tagClass
		       tagNumber: (of_asn1_tag_number_t)tagNumber
- (instancetype)initWithTagClass: (OFASN1TagClass)tagClass
		       tagNumber: (OFASN1TagNumber)tagNumber
		     constructed: (bool)constructed
	      DEREncodedContents: (OFData *)DEREncodedContents
    OF_DESIGNATED_INITIALIZER;
@end

OF_ASSUME_NONNULL_END