Browse Source

Merge branch 'IPS-9'

master
Dirk Zimmermann 2 weeks ago
parent
commit
516a177044
16 changed files with 430 additions and 61 deletions
  1. +151
    -0
      Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils.xcodeproj/project.pbxproj
  2. +1
    -1
      Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils.xcodeproj/xcshareddata/xcschemes/PEPObjCTypeUtils_iOS.xcscheme
  3. +11
    -1
      Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils.xcodeproj/xcshareddata/xcschemes/PEPObjCTypeUtils_macOS.xcscheme
  4. +62
    -0
      Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils/PEPMessage+ASN1.m
  5. +29
    -0
      Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils/PublicHeaders/PEPMessage+ASN1.h
  6. +22
    -0
      Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtilsTests_macOS/Info.plist
  7. +125
    -0
      Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtilsTests_macOS/PEPMessageASN1Tests.m
  8. +2
    -2
      Subprojects/PEPObjCTypes/PEPObjCTypes.xcodeproj/project.pbxproj
  9. +1
    -1
      Subprojects/PEPObjCTypes/PEPObjCTypes.xcodeproj/xcshareddata/xcschemes/PEPObjCTypesTests_iOS.xcscheme
  10. +1
    -1
      Subprojects/PEPObjCTypes/PEPObjCTypes.xcodeproj/xcshareddata/xcschemes/PEPObjCTypes_iOS.xcscheme
  11. +1
    -1
      Subprojects/PEPObjCTypes/PEPObjCTypes.xcodeproj/xcshareddata/xcschemes/PEPObjCTypes_macOS.xcscheme
  12. +6
    -50
      Subprojects/PEPObjCTypes/PEPObjCTypes/PublicHeaders/PEPEngineTypes.h
  13. +4
    -0
      Subprojects/PEPObjCTypes/PEPObjCTypes/PublicHeaders/PEPTransportConfig.h
  14. +2
    -2
      Subprojects/PEPObjCTypes/PEPObjCTypes/src/PEPAttachment.m
  15. +11
    -1
      Subprojects/PEPObjCTypes/PEPObjCTypes/src/PEPTransportConfig.m
  16. +1
    -1
      pEpObjCAdapter/Extensions/PEPIdentity+Reset.m

+ 151
- 0
Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils.xcodeproj/project.pbxproj View File

@ -18,6 +18,13 @@
15BD31732742820400B1B1F5 /* PEPStatusNSErrorUtil.h in Headers */ = {isa = PBXBuildFile; fileRef = 15BD31702742820400B1B1F5 /* PEPStatusNSErrorUtil.h */; };
15BD31742742820400B1B1F5 /* PEPStatusNSErrorUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 15BD31712742820400B1B1F5 /* PEPStatusNSErrorUtil.m */; };
15BD31752742820400B1B1F5 /* PEPStatusNSErrorUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 15BD31712742820400B1B1F5 /* PEPStatusNSErrorUtil.m */; };
43B0EAC0274D1E7B00F5D076 /* PEPMessage+ASN1.m in Sources */ = {isa = PBXBuildFile; fileRef = 43B0EABB274D1E7B00F5D076 /* PEPMessage+ASN1.m */; };
43B0EAC1274D1E7B00F5D076 /* PEPMessage+ASN1.m in Sources */ = {isa = PBXBuildFile; fileRef = 43B0EABB274D1E7B00F5D076 /* PEPMessage+ASN1.m */; };
43B0EAC3274D1EA700F5D076 /* PEPMessage+ASN1.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B0EAC2274D1EA700F5D076 /* PEPMessage+ASN1.h */; };
43B0EAC4274D1EA700F5D076 /* PEPMessage+ASN1.h in Headers */ = {isa = PBXBuildFile; fileRef = 43B0EAC2274D1EA700F5D076 /* PEPMessage+ASN1.h */; };
43B0EAD5274D21E100F5D076 /* libPEPObjCTypeUtils_macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1585EA7C26984C4300B822E1 /* libPEPObjCTypeUtils_macOS.a */; };
43B0EAE0274D222000F5D076 /* PEPMessageASN1Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 43B0EADF274D222000F5D076 /* PEPMessageASN1Tests.m */; };
43B0EAE1274D246A00F5D076 /* libpEpEngine_macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1585EC93269C51EC00B822E1 /* libpEpEngine_macOS.a */; };
4E89010726CF900B00A683E9 /* libPEPObjCTypes_macOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4E51C1F926CD12EE007A2164 /* libPEPObjCTypes_macOS.a */; };
/* End PBXBuildFile section */
@ -92,6 +99,13 @@
remoteGlobalIDString = 4E575864268329A20084F02D;
remoteInfo = PEPObjCTypes_iOS;
};
43B0EAD6274D21E100F5D076 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1585EA7426984C4300B822E1 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 1585EA7B26984C4300B822E1;
remoteInfo = PEPObjCTypeUtils_macOS;
};
/* End PBXContainerItemProxy section */
/* Begin PBXCopyFilesBuildPhase section */
@ -116,6 +130,10 @@
15BD2FB22734487F00B1B1F5 /* PEPObjCTypeConversionUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPObjCTypeConversionUtil.m; sourceTree = "<group>"; };
15BD31702742820400B1B1F5 /* PEPStatusNSErrorUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PEPStatusNSErrorUtil.h; sourceTree = "<group>"; };
15BD31712742820400B1B1F5 /* PEPStatusNSErrorUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PEPStatusNSErrorUtil.m; sourceTree = "<group>"; };
43B0EABB274D1E7B00F5D076 /* PEPMessage+ASN1.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "PEPMessage+ASN1.m"; sourceTree = "<group>"; };
43B0EAC2274D1EA700F5D076 /* PEPMessage+ASN1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PEPMessage+ASN1.h"; sourceTree = "<group>"; };
43B0EAD1274D21E100F5D076 /* PEPObjCTypeUtilsTests_macOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PEPObjCTypeUtilsTests_macOS.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
43B0EADF274D222000F5D076 /* PEPMessageASN1Tests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PEPMessageASN1Tests.m; sourceTree = "<group>"; };
4E51C1F926CD12EE007A2164 /* libPEPObjCTypes_macOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libPEPObjCTypes_macOS.a; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
@ -136,6 +154,15 @@
);
runOnlyForDeploymentPostprocessing = 0;
};
43B0EACE274D21E100F5D076 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
43B0EAE1274D246A00F5D076 /* libpEpEngine_macOS.a in Frameworks */,
43B0EAD5274D21E100F5D076 /* libPEPObjCTypeUtils_macOS.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
@ -145,6 +172,7 @@
159805FA26CFC0C500593C9D /* PEPObjCTypes.xcodeproj */,
1585EACB269850B400B822E1 /* pEpEngine.xcodeproj */,
1585EA7E26984C4300B822E1 /* PEPObjCTypeUtils */,
43B0EAD2274D21E100F5D076 /* PEPObjCTypeUtilsTests_macOS */,
1585EA7D26984C4300B822E1 /* Products */,
1585EADB269850C700B822E1 /* Frameworks */,
);
@ -155,6 +183,7 @@
children = (
1585EA7C26984C4300B822E1 /* libPEPObjCTypeUtils_macOS.a */,
1585EB3D2698636C00B822E1 /* libPEPObjCTypeUtils_iOS.a */,
43B0EAD1274D21E100F5D076 /* PEPObjCTypeUtilsTests_macOS.xctest */,
);
name = Products;
sourceTree = "<group>";
@ -165,6 +194,7 @@
1585EA9526984DB800B822E1 /* PublicHeaders */,
15BD2FB22734487F00B1B1F5 /* PEPObjCTypeConversionUtil.m */,
15BD31712742820400B1B1F5 /* PEPStatusNSErrorUtil.m */,
43B0EABB274D1E7B00F5D076 /* PEPMessage+ASN1.m */,
);
path = PEPObjCTypeUtils;
sourceTree = "<group>";
@ -175,6 +205,7 @@
1585EBC12698A8FC00B822E1 /* PEPObjCTypeUtils.h */,
15BD2FB12734487F00B1B1F5 /* PEPObjCTypeConversionUtil.h */,
15BD31702742820400B1B1F5 /* PEPStatusNSErrorUtil.h */,
43B0EAC2274D1EA700F5D076 /* PEPMessage+ASN1.h */,
);
path = PublicHeaders;
sourceTree = "<group>";
@ -207,6 +238,14 @@
name = Products;
sourceTree = "<group>";
};
43B0EAD2274D21E100F5D076 /* PEPObjCTypeUtilsTests_macOS */ = {
isa = PBXGroup;
children = (
43B0EADF274D222000F5D076 /* PEPMessageASN1Tests.m */,
);
path = PEPObjCTypeUtilsTests_macOS;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
@ -217,6 +256,7 @@
15BD31722742820400B1B1F5 /* PEPStatusNSErrorUtil.h in Headers */,
15BD2FB32734487F00B1B1F5 /* PEPObjCTypeConversionUtil.h in Headers */,
1585EBC32698A8FC00B822E1 /* PEPObjCTypeUtils.h in Headers */,
43B0EAC3274D1EA700F5D076 /* PEPMessage+ASN1.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -227,6 +267,7 @@
15BD31732742820400B1B1F5 /* PEPStatusNSErrorUtil.h in Headers */,
15BD2FB42734487F00B1B1F5 /* PEPObjCTypeConversionUtil.h in Headers */,
1585EC79269C3E1700B822E1 /* PEPObjCTypeUtils.h in Headers */,
43B0EAC4274D1EA700F5D076 /* PEPMessage+ASN1.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -274,6 +315,24 @@
productReference = 1585EB3D2698636C00B822E1 /* libPEPObjCTypeUtils_iOS.a */;
productType = "com.apple.product-type.library.static";
};
43B0EAD0274D21E100F5D076 /* PEPObjCTypeUtilsTests_macOS */ = {
isa = PBXNativeTarget;
buildConfigurationList = 43B0EADE274D21E100F5D076 /* Build configuration list for PBXNativeTarget "PEPObjCTypeUtilsTests_macOS" */;
buildPhases = (
43B0EACD274D21E100F5D076 /* Sources */,
43B0EACE274D21E100F5D076 /* Frameworks */,
43B0EACF274D21E100F5D076 /* Resources */,
);
buildRules = (
);
dependencies = (
43B0EAD7274D21E100F5D076 /* PBXTargetDependency */,
);
name = PEPObjCTypeUtilsTests_macOS;
productName = PEPObjCTypeUtilsTests_macOS;
productReference = 43B0EAD1274D21E100F5D076 /* PEPObjCTypeUtilsTests_macOS.xctest */;
productType = "com.apple.product-type.bundle.unit-test";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
@ -288,6 +347,9 @@
1585EB3C2698636C00B822E1 = {
CreatedOnToolsVersion = 12.5;
};
43B0EAD0274D21E100F5D076 = {
CreatedOnToolsVersion = 13.1;
};
};
};
buildConfigurationList = 1585EA7726984C4300B822E1 /* Build configuration list for PBXProject "PEPObjCTypeUtils" */;
@ -315,6 +377,7 @@
targets = (
1585EA7B26984C4300B822E1 /* PEPObjCTypeUtils_macOS */,
1585EB3C2698636C00B822E1 /* PEPObjCTypeUtils_iOS */,
43B0EAD0274D21E100F5D076 /* PEPObjCTypeUtilsTests_macOS */,
);
};
/* End PBXProject section */
@ -364,6 +427,16 @@
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
43B0EACF274D21E100F5D076 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
1585EA9626984E6F00B822E1 /* Copy Artefacts to Custom Build Dir */ = {
isa = PBXShellScriptBuildPhase;
@ -411,6 +484,7 @@
files = (
15BD2FB52734487F00B1B1F5 /* PEPObjCTypeConversionUtil.m in Sources */,
15BD31742742820400B1B1F5 /* PEPStatusNSErrorUtil.m in Sources */,
43B0EAC0274D1E7B00F5D076 /* PEPMessage+ASN1.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -420,6 +494,15 @@
files = (
15BD2FB62734487F00B1B1F5 /* PEPObjCTypeConversionUtil.m in Sources */,
15BD31752742820400B1B1F5 /* PEPStatusNSErrorUtil.m in Sources */,
43B0EAC1274D1E7B00F5D076 /* PEPMessage+ASN1.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
43B0EACD274D21E100F5D076 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
43B0EAE0274D222000F5D076 /* PEPMessageASN1Tests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -446,6 +529,11 @@
name = PEPObjCTypes_iOS;
targetProxy = 1598062E26CFCA8800593C9D /* PBXContainerItemProxy */;
};
43B0EAD7274D21E100F5D076 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 1585EA7B26984C4300B822E1 /* PEPObjCTypeUtils_macOS */;
targetProxy = 43B0EAD6274D21E100F5D076 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
@ -501,6 +589,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"${PROJECT_DIR}/../../../pEpEngine/build-mac/build/include/",
"${PROJECT_DIR}/../../../pEpEngine/build-mac/build/include/pEp",
"${PROJECT_DIR}/../PEPObjCTypes/build/include",
"${PROJECT_DIR}/../../../libpEpTransport/build-mac/build/include",
@ -510,6 +599,10 @@
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(OTHER_LDFLAGS)",
"-ObjC",
);
SDKROOT = macosx;
};
name = Debug;
@ -560,6 +653,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"${PROJECT_DIR}/../../../pEpEngine/build-mac/build/include/",
"${PROJECT_DIR}/../../../pEpEngine/build-mac/build/include/pEp",
"${PROJECT_DIR}/../PEPObjCTypes/build/include",
"${PROJECT_DIR}/../../../libpEpTransport/build-mac/build/include",
@ -568,6 +662,10 @@
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
OTHER_LDFLAGS = (
"$(OTHER_LDFLAGS)",
"-ObjC",
);
SDKROOT = macosx;
};
name = Release;
@ -621,6 +719,50 @@
};
name = Release;
};
43B0EAD8274D21E100F5D076 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = NQLYU6MGPN;
GENERATE_INFOPLIST_FILE = YES;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "security.pEp.PEPObjCTypeUtilsTests-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
};
name = Debug;
};
43B0EAD9274D21E100F5D076 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = NQLYU6MGPN;
GENERATE_INFOPLIST_FILE = YES;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.5;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = "security.pEp.PEPObjCTypeUtilsTests-macOS";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
@ -651,6 +793,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
43B0EADE274D21E100F5D076 /* Build configuration list for PBXNativeTarget "PEPObjCTypeUtilsTests_macOS" */ = {
isa = XCConfigurationList;
buildConfigurations = (
43B0EAD8274D21E100F5D076 /* Debug */,
43B0EAD9274D21E100F5D076 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 1585EA7426984C4300B822E1 /* Project object */;


+ 1
- 1
Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils.xcodeproj/xcshareddata/xcschemes/PEPObjCTypeUtils_iOS.xcscheme View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"


+ 11
- 1
Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils.xcodeproj/xcshareddata/xcschemes/PEPObjCTypeUtils_macOS.xcscheme View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "NO"
@ -42,6 +42,16 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "43B0EAD0274D21E100F5D076"
BuildableName = "PEPObjCTypeUtilsTests_macOS.xctest"
BlueprintName = "PEPObjCTypeUtilsTests_macOS"
ReferencedContainer = "container:PEPObjCTypeUtils.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction


+ 62
- 0
Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils/PEPMessage+ASN1.m View File

@ -0,0 +1,62 @@
//
// PEPMessage+ASN1.m
// pEpCC_macOS
//
// Created by Dirk Zimmermann on 25.08.21.
//
#import "PEPMessage+ASN1.h"
#import "PEPObjCTypeUtils.h"
#import "map_asn1.h"
#import "message_codec.h"
@implementation PEPMessage (ASN1)
+ (instancetype _Nullable)messageFromAsn1Data:(NSData *)asn1Data
{
ASN1Message_t *asn1Message = NULL;
PEP_STATUS status = decode_ASN1Message_message(asn1Data.bytes, asn1Data.length, &asn1Message);
if (status != PEP_STATUS_OK) {
return nil;
}
message *msg = ASN1Message_to_message(asn1Message, NULL, YES, 0);
// TODO: Use free_ASN1Message as soon as available (see ENGINE-969)
ASN_STRUCT_FREE(asn_DEF_ASN1Message, asn1Message);
if (!msg) {
return nil;
}
return [PEPObjCTypeConversionUtil pEpMessagefromStruct:msg];
}
- (NSData *)asn1Data
{
message *msg = [PEPObjCTypeConversionUtil structFromPEPMessage:self];
ASN1Message_t *asn1Message = ASN1Message_from_message(msg, NULL, YES, 0);
free_message(msg);
if (asn1Message == NULL) {
return nil;
}
char *msgBytes = NULL;
size_t msgBytesSze = 0;
PEP_STATUS status = encode_ASN1Message_message(asn1Message, &msgBytes, &msgBytesSze);
// TODO: Use free_ASN1Message as soon as available (see ENGINE-969)
ASN_STRUCT_FREE(asn_DEF_ASN1Message, asn1Message);
if (status != PEP_STATUS_OK) {
return nil;
}
NSData *msgData = [[NSData alloc] initWithBytesNoCopy:msgBytes length:msgBytesSze];
return msgData;
}
@end

+ 29
- 0
Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtils/PublicHeaders/PEPMessage+ASN1.h View File

@ -0,0 +1,29 @@
//
// PEPMessage+ASN1.h
// pEpCC_macOS
//
// Created by Dirk Zimmermann on 25.08.21.
//
#import <Foundation/Foundation.h>
#import "PEPMessage.h"
NS_ASSUME_NONNULL_BEGIN
/// Extensions for converting asn.1 to and from `PEPMessage`.
///
/// @see https://dev.pep.foundation/Engine/ASN1Message
@interface PEPMessage (ASN1)
/// Try to create a message from bytes, using asn.1.
+ (instancetype _Nullable)messageFromAsn1Data:(NSData *)asn1Data;
/// The message serialized to bytes, via asn.1.
///
/// @return The asn.1 encoded message bytes, or nil if encoding didn't work, and maybe on insufficient memory.
- (NSData * _Nullable)asn1Data;
@end
NS_ASSUME_NONNULL_END

+ 22
- 0
Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtilsTests_macOS/Info.plist View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

+ 125
- 0
Subprojects/PEPObjCTypeUtils/PEPObjCTypeUtilsTests_macOS/PEPMessageASN1Tests.m View File

@ -0,0 +1,125 @@
//
// PEPMessageASN1Tests.m
// pEpCCTests
//
// Created by Dirk Zimmermann on 26.08.21.
//
#import <XCTest/XCTest.h>
#import "PEPMessage+ASN1.h"
#import "PEPObjCTypes.h"
@interface PEPMessageASN1Tests : XCTestCase
@end
@implementation PEPMessageASN1Tests
/// Encodes and decodes a "minimal" message, that is a message with the minimum amount of data
/// needed to get encoded/decoded.
- (void)testBasicAsn1EncodeDecodeRoundTripMinimalMessageFakeFingerprint
{
PEPIdentity *fromId = [[PEPIdentity alloc]
initWithAddress:@"someone1@example.com"
userID:@"1"
userName:@"Some One 1"
isOwn:NO];
fromId.fingerPrint = @"0E12343434343434343434EAB3484343434343434";
PEPIdentity *toId = [[PEPIdentity alloc]
initWithAddress:@"someone2@example.com"
userID:@"2"
userName:@"Some One 2"
isOwn:NO];
toId.fingerPrint = @"123434343434343C3434343434343734349A34344";
PEPMessage *msg1 = [PEPMessage new];
msg1.from = fromId;
msg1.to = @[toId];
NSData *blob = [msg1 asn1Data];
XCTAssertNotNil(blob);
PEPMessage *msg2 = [PEPMessage messageFromAsn1Data:blob];
XCTAssertNotNil(msg2);
XCTAssertEqualObjects(msg1, msg2);
}
/// Encodes and decodes a "minimal" message, that is a message with the minimum amount of data
/// needed to get encoded/decoded, with fingerprint set to nil.
- (void)testBasicAsn1EncodeDecodeRoundTripMinimalMessageNilFingerprint
{
PEPIdentity *fromId = [[PEPIdentity alloc]
initWithAddress:@"someone1@example.com"
userID:@"1"
userName:@"Some One 1"
isOwn:NO];
fromId.fingerPrint = nil;
PEPIdentity *toId = [[PEPIdentity alloc]
initWithAddress:@"someone2@example.com"
userID:@"2"
userName:@"Some One 2"
isOwn:NO];
toId.fingerPrint = nil;
PEPMessage *msg1 = [PEPMessage new];
msg1.from = fromId;
msg1.to = @[toId];
NSData *blob = [msg1 asn1Data];
XCTAssertNotNil(blob);
PEPMessage *msg2 = [PEPMessage messageFromAsn1Data:blob];
XCTAssertNotNil(msg2);
XCTAssertEqualObjects(msg1, msg2);
}
/// Encodes and decodes a "minimal" message, that is a message with the minimum amount of data
/// needed to get encoded/decoded, with fingerprint set to the empty string.
- (void)testBasicAsn1EncodeDecodeRoundTripMinimalMessageEmptyFingerprint
{
PEPIdentity *fromId = [[PEPIdentity alloc]
initWithAddress:@"someone1@example.com"
userID:@"1"
userName:@"Some One 1"
isOwn:NO];
fromId.fingerPrint = @"";
PEPIdentity *toId = [[PEPIdentity alloc]
initWithAddress:@"someone2@example.com"
userID:@"2"
userName:@"Some One 2"
isOwn:NO];
toId.fingerPrint = @"";
PEPMessage *msg1 = [PEPMessage new];
msg1.from = fromId;
msg1.to = @[toId];
NSData *blob = [msg1 asn1Data];
XCTAssertNotNil(blob);
PEPMessage *msg2 = [PEPMessage messageFromAsn1Data:blob];
XCTAssertNotNil(msg2);
XCTAssertEqualObjects(msg1, msg2);
}
#pragma mark - Private Helpers
- (NSData *)randomDataWithLength:(NSUInteger)length
{
NSMutableData *mutableData = [NSMutableData dataWithLength:length];
for (NSInteger i = 0; i < length; ++i) {
((char *) mutableData.mutableBytes)[i] = arc4random();
}
return [NSData dataWithData:mutableData];
}
@end

+ 2
- 2
Subprojects/PEPObjCTypes/PEPObjCTypes.xcodeproj/project.pbxproj View File

@ -449,7 +449,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "CUSTOM_BUILD_DIR=${PROJECT_DIR}/build\nmkdir -p ${CUSTOM_BUILD_DIR}\nCUSTOM_INCLUDE_DIR=${PROJECT_DIR}/build/include\nmkdir -p ${CUSTOM_INCLUDE_DIR}\n\ncp \"${PROJECT_DIR}/PEPObjCTypes/PublicHeaders\"/* ${CUSTOM_INCLUDE_DIR}\ncp \"${BUILT_PRODUCTS_DIR}/libPEPObjCTypes_macOS.a\" ${CUSTOM_BUILD_DIR}\n";
shellScript = "CUSTOM_BUILD_DIR=${PROJECT_DIR}/build\nmkdir -p ${CUSTOM_BUILD_DIR}\nCUSTOM_INCLUDE_DIR=${PROJECT_DIR}/build/include\nmkdir -p ${CUSTOM_INCLUDE_DIR}\n\ncp \"${PROJECT_DIR}/PEPObjCTypes/PublicHeaders\"/* ${CUSTOM_INCLUDE_DIR}\ncp \"${PROJECT_DIR}/../../../libpEpTransport/build-mac/build/include/pEp/PEPTransportStatusCode.h\" ${CUSTOM_INCLUDE_DIR}\ncp \"${BUILT_PRODUCTS_DIR}/libPEPObjCTypes_macOS.a\" ${CUSTOM_BUILD_DIR}\n";
};
4E5758F8268371B10084F02D /* Copy artefacts to custom build dir */ = {
isa = PBXShellScriptBuildPhase;
@ -467,7 +467,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "CUSTOM_BUILD_DIR=${PROJECT_DIR}/build\nmkdir -p ${CUSTOM_BUILD_DIR}\necho \"{BUILD_DIR}: ${BUILD_DIR}\"\n\ncp \"${PROJECT_DIR}/PEPObjCTypes/PublicHeaders\"/* ${CUSTOM_INCLUDE_DIR}\ncp \"${BUILT_PRODUCTS_DIR}/libPEPObjCTypes_iOS.a\" ${CUSTOM_BUILD_DIR}\n";
shellScript = "CUSTOM_BUILD_DIR=${PROJECT_DIR}/build\nmkdir -p ${CUSTOM_BUILD_DIR}\necho \"{BUILD_DIR}: ${BUILD_DIR}\"\n\ncp \"${PROJECT_DIR}/PEPObjCTypes/PublicHeaders\"/* ${CUSTOM_INCLUDE_DIR}\ncp \"${PROJECT_DIR}/../../../libpEpTransport/build-mac/build/include/pEp/PEPTransportStatusCode.h\" ${CUSTOM_INCLUDE_DIR}\ncp \"${BUILT_PRODUCTS_DIR}/libPEPObjCTypes_iOS.a\" ${CUSTOM_BUILD_DIR}\n";
};
/* End PBXShellScriptBuildPhase section */


+ 1
- 1
Subprojects/PEPObjCTypes/PEPObjCTypes.xcodeproj/xcshareddata/xcschemes/PEPObjCTypesTests_iOS.xcscheme View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1310"
version = "2.0">
<BuildAction
parallelizeBuildables = "YES"


+ 1
- 1
Subprojects/PEPObjCTypes/PEPObjCTypes.xcodeproj/xcshareddata/xcschemes/PEPObjCTypes_iOS.xcscheme View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"


+ 1
- 1
Subprojects/PEPObjCTypes/PEPObjCTypes.xcodeproj/xcshareddata/xcschemes/PEPObjCTypes_macOS.xcscheme View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
LastUpgradeVersion = "1310"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"


+ 6
- 50
Subprojects/PEPObjCTypes/PEPObjCTypes/PublicHeaders/PEPEngineTypes.h View File

@ -13,60 +13,16 @@
typedef NS_CLOSED_ENUM(NSUInteger, PEPTransportID) {
PEPCCTransportIDTransportAuto = 0, // auto transport chooses transport per message automatically
PEPTransportIDTransportAuto = 0, // auto transport chooses transport per message automatically
// Currently unsupported
// PEPCCTransportIDTransportEmail = 0x01,
// PEPCCTransportIDTransportRCE = 0x02,
// PEPTransportIDTransportEmail = 0x01,
// PEPTransportIDTransportRCE = 0x02,
// Used for figuring out the number of trasnport types. Which is all previously defined transport types plus one, the controll channel.
PEPCCTransportIDTransportCount,
PEPTransportIDTransportCount,
PEPCCTransportIDTransportCC = 0xfe
};
/// From https://dev.pep.foundation/Engine/TransportStatusCode
typedef NS_CLOSED_ENUM(NSInteger, PEPTransportStatusCode) {
// General / Common
PEPTransportStatusCodeReady = 0x0, // not an error state
PEPTransportStatusCodeConnectionDown = 0x1, // sent by connection based transports
PEPTransportStatusCodeConnectionUp = 0x2, // not an error state; sent by connection based transports
PEPTransportStatusCodeConnectionSomeRecipientsUnreachable = 0x3, // message could not be delivered to all recipients
PEPTransportStatusCodeConnectionNoRecipientsReachable = 0x4, // message could not be delivered at all
PEPTransportStatusCodeConnectionNoConfig = 0x5,
PEPTransportStatusCodeConnectionInvalidConfig = 0x6, // config incomplete or wrong
PEPTransportStatusCodeNoSendConfig = 0x7,
PEPTransportStatusCodeNoRecvConfig = 0x8,
PEPTransportStatusCodeInvalidSendConfig = 0x9,
PEPTransportStatusCodeInvalidRecvConfig = 0xA,
PEPTransportStatusCodeNetworkTimeout = 0xB,
PEPTransportStatusCodeMessageDelivered = 0x100000, // not an error state
PEPTransportStatusCodeMessageOnTheWay = 0x100001, // not an error state
PEPTransportStatusCodeCouldNotDeliver_Resending = 0x100002, // not an error state
PEPTransportStatusCodeCouldNotDeliver_GivingUp = 0x100003,
// Email
PEPTransportStatusCodeEmailSMTPServerUnreachable = 0x1100001,
PEPTransportStatusCodeEmailSMTPUnknownError = 0x110FFFF,
PEPTransportStatusCodeEmailIMAPServerUnreachable = 0x01110001,
PEPTransportStatusCodeEmailIMAPUnknownError = 0x0111FFFF,
// RCE
PEPTransportStatusCodeRCETorrentWithoutSeeders = 0x02FF0001,
PEPTransportStatusCodeRCEUnknownTorrentError = 0x02FFFFFF,
// Control Channel
PEPTransportStatusCodePEPCCUnknownSCTPError = 0xFEFFFFFF,
// Misc. errors
PEPTransportStatusCodeUnknownError = 0xFFFFFFFF
};
typedef NS_CLOSED_ENUM(int, PEPTransportCallbackExcecutionType) {
/// execute callbacks immediately only
PEPTransportCallbackExcecutionTypePolling = 0,
/// execute callbacks multiple times later on any thread; call with PEP_cbe_polling to disable
PEPTransportCallbackExcecutionTypeAsync,
/// the last one is for the transport system only. Do not implement it in transports.
/// Rephrase: DO NOT IMPLEMENT, IGNORE :-)
PEPTransportCallbackExcecutionTypeBlocking = 255
PEPTransportIDTransportSCTP = 0xfd,
PEPTransportIDTransportCC = 0xfe
};
typedef NS_CLOSED_ENUM(int, PEPDecryptFlags) {


+ 4
- 0
Subprojects/PEPObjCTypes/PEPObjCTypes/PublicHeaders/PEPTransportConfig.h View File

@ -10,8 +10,12 @@
NS_ASSUME_NONNULL_BEGIN
@interface PEPTransportConfig : NSObject
@property (nonatomic) Size size;
@property (nonatomic) UInt16 port;
- (instancetype)initWithSize:(Size)size port:(UInt16)port;
@end
NS_ASSUME_NONNULL_END

+ 2
- 2
Subprojects/PEPObjCTypes/PEPObjCTypes/src/PEPAttachment.m View File

@ -23,8 +23,8 @@
{
NSMutableString *str =
[NSMutableString
stringWithFormat:@"<PEPAttachment 0x%u %ld bytes, contentDisposition %d",
(uint) self, (long) self.size, self.contentDisposition];
stringWithFormat:@"<PEPAttachment 0x%ld %ld bytes, contentDisposition %d",
(long) self, (long) self.size, self.contentDisposition];
if (self.mimeType) {
[str appendFormat:@", %@", self.mimeType];


+ 11
- 1
Subprojects/PEPObjCTypes/PEPObjCTypes/src/PEPTransportConfig.m View File

@ -1,6 +1,6 @@
//
// PEPTransportConfig.m
// pEpCC_macOS
// PEPObjCTypes
//
// Created by Andreas Buff on 16.08.21.
//
@ -9,4 +9,14 @@
@implementation PEPTransportConfig
- (instancetype)initWithSize:(Size)size port:(UInt16)port
{
self = [super init];
if (self) {
_size = size;
_port = port;
}
return self;
}
@end

+ 1
- 1
pEpObjCAdapter/Extensions/PEPIdentity+Reset.m View File

@ -16,7 +16,7 @@
- (void)reset
{
self.commType = PEP_ct_unknown;
self.commType = (PEPCommType) PEP_ct_unknown;
self.language = nil;
self.fingerPrint = nil;
self.userID = @"";


Loading…
Cancel
Save