Overview
Context
Changes
Modified src/Makefile
from [25efe5c01f]
to [80f64e4680].
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
|
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
|
+
+
+
+
+
-
+
+
|
include ../extra.mk
SUBDIRS = ${RUNTIME} exceptions ${ENCODINGS} forwarding invocation
SUBDIRS_AFTER = ${BRIDGE}
DISTCLEAN = objfw-defs.h
SHARED_LIB = ${OBJFW_SHARED_LIB}
STATIC_LIB = ${OBJFW_STATIC_LIB}
FRAMEWORK = ${OBJFW_FRAMEWORK}
LIB_MAJOR = ${OBJFW_LIB_MAJOR}
LIB_MINOR = ${OBJFW_LIB_MINOR}
SRCS = OFASN1Boolean.m \
OFASN1Integer.m \
OFASN1Null.m \
OFASN1UTF8String.m \
OFASN1Value.m \
SRCS = OFApplication.m \
OFApplication.m \
OFArray.m \
OFAutoreleasePool.m \
OFBlock.m \
OFCharacterSet.m \
OFColor.m \
OFConstantString.m \
OFCountedSet.m \
OFData.m \
OFData+ASN1DERValue.m \
OFData+CryptoHashing.m \
OFData+MessagePackValue.m \
OFDate.m \
OFDictionary.m \
OFEnumerator.m \
OFGZIPStream.m \
OFHMAC.m \
|
︙ | | |
Added src/OFASN1Boolean.h version [9272d43696].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFASN1Value.h"
OF_ASSUME_NONNULL_BEGIN
/*!
* @brief An ASN.1 boolean.
*/
@interface OFASN1Boolean: OFASN1Value
{
bool _booleanValue;
}
/*!
* @brief The boolean value.
*/
@property (readonly, nonatomic) bool booleanValue;
@end
OF_ASSUME_NONNULL_END
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/OFASN1Boolean.m version [32df9da0af].
|
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
61
62
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFASN1Boolean.h"
#import "OFData.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
@implementation OFASN1Boolean
@synthesize booleanValue = _booleanValue;
- (instancetype)initWithTagClass: (of_asn1_tag_class_t)tagClass
tagNumber: (of_asn1_tag_number_t)tagNumber
constructed: (bool)constructed
DEREncodedContents: (OFData *)DEREncodedContents
{
self = [super initWithTagClass: tagClass
tagNumber: tagNumber
constructed: constructed
DEREncodedContents: DEREncodedContents];
@try {
unsigned char value;
if (_tagClass != OF_ASN1_TAG_CLASS_UNIVERSAL ||
_tagNumber != OF_ASN1_TAG_NUMBER_BOOLEAN || _constructed)
@throw [OFInvalidArgumentException exception];
if ([_DEREncodedContents count] != 1)
@throw [OFInvalidFormatException exception];
value = *(unsigned char *)[_DEREncodedContents itemAtIndex: 0];
if (value != 0 && value != 0xFF)
@throw [OFInvalidFormatException exception];
_booleanValue = value;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/OFASN1Integer.h version [076cb23965].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFASN1Value.h"
OF_ASSUME_NONNULL_BEGIN
/*!
* @brief An ASN.1 integer.
*/
@interface OFASN1Integer: OFASN1Value
{
intmax_t _integerValue;
}
/*!
* @brief The integer value.
*/
@property (readonly, nonatomic) intmax_t integerValue;
@end
OF_ASSUME_NONNULL_END
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/OFASN1Integer.m version [17624dc32d].
|
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFASN1Integer.h"
#import "OFData.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
#import "OFOutOfRangeException.h"
@implementation OFASN1Integer
@synthesize integerValue = _integerValue;
- (instancetype)initWithTagClass: (of_asn1_tag_class_t)tagClass
tagNumber: (of_asn1_tag_number_t)tagNumber
constructed: (bool)constructed
DEREncodedContents: (OFData *)DEREncodedContents
{
self = [super initWithTagClass: tagClass
tagNumber: tagNumber
constructed: constructed
DEREncodedContents: DEREncodedContents];
@try {
const unsigned char *items;
size_t count;
uintmax_t value;
if (_tagClass != OF_ASN1_TAG_CLASS_UNIVERSAL ||
_tagNumber != OF_ASN1_TAG_NUMBER_INTEGER || _constructed)
@throw [OFInvalidArgumentException exception];
/* TODO: Support for big numbers */
items = [_DEREncodedContents items];
count = [_DEREncodedContents count];
value = 0;
if (count > sizeof(uintmax_t) &&
(count != sizeof(uintmax_t) + 1 || items[0] != 0))
@throw [OFOutOfRangeException exception];
if (count >= 2 && ((items[0] == 0 && !(items[1] & 0x80)) ||
(items[0] == 0xFF && items[1] & 0x80)))
@throw [OFInvalidFormatException exception];
if (count >= 1 && items[0] & 0x80)
value = ~(uintmax_t)0;
while (count--)
value = (value << 8) | *items++;
_integerValue = value;
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/OFASN1Null.h version [98f997dcb0].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFASN1Value.h"
OF_ASSUME_NONNULL_BEGIN
/*!
* @brief An ASN.1 null value.
*/
@interface OFASN1Null: OFASN1Value
@end
OF_ASSUME_NONNULL_END
|
| | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/OFASN1Null.m version [94777af6ac].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFASN1Null.h"
#import "OFData.h"
#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"
@implementation OFASN1Null
- (instancetype)initWithTagClass: (of_asn1_tag_class_t)tagClass
tagNumber: (of_asn1_tag_number_t)tagNumber
constructed: (bool)constructed
DEREncodedContents: (OFData *)DEREncodedContents
{
self = [super initWithTagClass: tagClass
tagNumber: tagNumber
constructed: constructed
DEREncodedContents: DEREncodedContents];
@try {
if (_tagClass != OF_ASN1_TAG_CLASS_UNIVERSAL ||
_tagNumber != OF_ASN1_TAG_NUMBER_NULL || _constructed)
@throw [OFInvalidArgumentException exception];
if ([_DEREncodedContents count] != 0)
@throw [OFInvalidFormatException exception];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/OFASN1UTF8String.h version [5546a22768].
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#import "OFASN1Value.h"
OF_ASSUME_NONNULL_BEGIN
@class OFString;
/*!
* @brief An ASN.1 UTF-8 string.
*/
@interface OFASN1UTF8String: OFASN1Value
{
OFString *_stringValue;
}
/*!
* @brief The string value.
*/
@property (readonly, nonatomic) OFString *stringValue;
@end
OF_ASSUME_NONNULL_END
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/OFASN1UTF8String.m version [73edad1684].
|
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
61
62
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
* Alternatively, it may be distributed under the terms of the GNU General
* Public License, either version 2 or 3, which can be found in the file
* LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
* file.
*/
#include "config.h"
#import "OFASN1UTF8String.h"
#import "OFData.h"
#import "OFString.h"
#import "OFInvalidArgumentException.h"
@implementation OFASN1UTF8String
@synthesize stringValue = _stringValue;
- (instancetype)initWithTagClass: (of_asn1_tag_class_t)tagClass
tagNumber: (of_asn1_tag_number_t)tagNumber
constructed: (bool)constructed
DEREncodedContents: (OFData *)DEREncodedContents
{
self = [super initWithTagClass: tagClass
tagNumber: tagNumber
constructed: constructed
DEREncodedContents: DEREncodedContents];
@try {
if (_tagClass != OF_ASN1_TAG_CLASS_UNIVERSAL ||
_tagNumber != OF_ASN1_TAG_NUMBER_UTF8_STRING ||
_constructed)
@throw [OFInvalidArgumentException exception];
_stringValue = [[OFString alloc]
initWithUTF8String: [_DEREncodedContents items]
length: [_DEREncodedContents count]];
} @catch (id e) {
[self release];
@throw e;
}
return self;
}
- (void)dealloc
{
[_stringValue release];
[super dealloc];
}
@end
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
Added src/OFASN1Value.h version [5fc1ae337b].