Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for external encryption libraries #348

Merged
merged 59 commits into from Aug 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
37a2868
Add a security type protocol for end to end encryption libraries to b…
joeljfischer Feb 3, 2016
f1cfd7b
Add a security manager property to SDLProxy
joeljfischer Feb 3, 2016
354449e
Untrack Quick & Nimble libs
joeljfischer Feb 8, 2016
0902154
Add 'encryption' bit to Protocol Headers, deprecate 'compression' whi…
joeljfischer Feb 8, 2016
8983b80
Add a method to SDLProtocol to allow a service to be started with enc…
joeljfischer Feb 8, 2016
49b2313
Update security type to make start synchronous
joeljfischer Feb 8, 2016
3ada53d
Streaming media can attempt to start with encryption
joeljfischer Feb 8, 2016
f753288
Additional minor updates to make 'encrypted' bit more explicit
joeljfischer Feb 11, 2016
8aaeff7
Large refactor of security code
joeljfischer Feb 11, 2016
0d63699
sendRPC:encrypted:error: now returns a BOOL for success
joeljfischer Feb 12, 2016
ac3b173
Update StreamingMediaManager to indicate if streaming started with en…
joeljfischer Feb 12, 2016
25c6359
Update SDLProtocolListener protocol to send entire header for StartSe…
joeljfischer Feb 12, 2016
0a26661
StreamingMediaManager will now send encrypted data if it can
joeljfischer Feb 15, 2016
ddabdea
Commenting updates to SDLProtocol's TLS code
joeljfischer Feb 15, 2016
a40e4ed
Fix missing SDLAbstractProtocol method definitions, then deprecate th…
joeljfischer Feb 15, 2016
d4f38a7
Merge branch 'develop' into feature/external_security_support
joeljfischer Feb 15, 2016
509fdd6
Change SDLProxy delegate implementation to not use the deprecated method
joeljfischer Feb 16, 2016
b2952de
Update SDLV2ProtocolHeaderSpec for deprecations and additions
joeljfischer Feb 16, 2016
677b208
Update private methods with prefixes
joeljfischer Feb 16, 2016
af83306
Fix some specs broken by deprecations
joeljfischer Feb 16, 2016
af6e0e7
Alter `setSecurityManager:forMake:` API to `add..`
joeljfischer Feb 17, 2016
3bd9cde
Fix Protocol not having access to the security manager
joeljfischer Feb 18, 2016
8a5b736
Fix `SDLProxy securityManagerForMake:` not using passed string
joeljfischer Feb 18, 2016
f782e8d
Fix StreamingMediaManager always trying to start with encryption
joeljfischer Feb 18, 2016
334bc6b
Adding a securitymanager now adds the object itself
joeljfischer Feb 22, 2016
5ed760a
Revert "Adding a securitymanager now adds the object itself"
joeljfischer Feb 22, 2016
e796f09
Fix Proxy not initializing security manager dictionary
joeljfischer Feb 22, 2016
a865b6e
Only call `onProxyOpened` from SDLProxy if it's the RPC service
joeljfischer Feb 23, 2016
a0b201f
Merge branch 'develop' into feature/external_security_support
joeljfischer Feb 26, 2016
c3a03b9
Update security interface to take an app id
joeljfischer Mar 2, 2016
d122779
Merge branch 'develop' into feature/external_security_support
joeljfischer Mar 4, 2016
52624ee
Merge branch 'develop' into feature/external_security_support
joeljfischer Mar 9, 2016
f72b47b
Merge branch 'develop' into feature/external_security_support
joeljfischer Mar 15, 2016
6943a34
SDLProxy addSecurityManager now takes an array of vehicleMakes
joeljfischer Mar 15, 2016
1c823b2
Store the entire header for services instead of just the sessionId
joeljfischer Mar 15, 2016
9e9a133
Remove the separate storage for the RPC session Id
joeljfischer Mar 16, 2016
61d8542
Merge branch 'develop' into feature/external_security_support
joeljfischer Apr 13, 2016
b78184a
Allow authenticated streaming without encryption
joeljfischer Apr 14, 2016
cc4b34c
Update protocol spec
joeljfischer Apr 14, 2016
9051def
Add a TODO for future work
joeljfischer Apr 15, 2016
097e5a8
Merge branch 'develop' into feature/external_security_support
joeljfischer May 4, 2016
c821cb0
Fix starting a secure session not starting the secure session
joeljfischer May 4, 2016
dc83ac6
Merge branch 'develop' into feature/external_security_support
joeljfischer May 20, 2016
b912244
Fix proxy version set incorrectly
joeljfischer May 20, 2016
cb6b2be
Merge branch 'develop' into feature/external_security_support
joeljfischer May 27, 2016
fc60bb0
Updated sessionID retrieval in start service to correctly pull sessio…
asm09fsu May 31, 2016
c50f3b0
Revert to previous code for getting header's sessionID.
asm09fsu May 31, 2016
137812c
Added payload length checks for encryption/decryption.
asm09fsu Jun 1, 2016
91513bd
Setting header's bytesInPayload after encryption for correct payload …
asm09fsu Jun 1, 2016
bd33e75
Update Proxy to no longer take makes when adding a security manager
joeljfischer Jul 27, 2016
b3f51a0
Proxy can now take all security manager classes at once
joeljfischer Jul 27, 2016
e1a9c0f
Merge remote-tracking branch 'origin/develop' into feature/external_s…
asm09fsu Jul 28, 2016
7f87d5c
Developers add appId in the same step as adding security managers
joeljfischer Jul 28, 2016
300e075
Use an enum instead of multiple BOOLs for starting streaming media
joeljfischer Jul 28, 2016
e67a81b
Merge branch 'develop' into feature/external_security_support
joeljfischer Jul 28, 2016
76e57b7
Fix using a deprecated enum
joeljfischer Jul 28, 2016
4e39844
Fixed issue with starting audio streaming using incorrect completion …
asm09fsu Jul 29, 2016
e8e5a5b
Updated starting audio session function declaration to match video se…
asm09fsu Jul 29, 2016
1eb39d3
Merge branch 'develop' into feature/external_security_support
joeljfischer Jul 29, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions SmartDeviceLink-iOS.xcodeproj/project.pbxproj
Expand Up @@ -747,6 +747,7 @@
5D61FE121A84238C00846EE7 /* SDLWarningLightStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FC251A84238C00846EE7 /* SDLWarningLightStatus.m */; };
5D61FE131A84238C00846EE7 /* SDLWiperStatus.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D61FC261A84238C00846EE7 /* SDLWiperStatus.h */; settings = {ATTRIBUTES = (Public, ); }; };
5D61FE141A84238C00846EE7 /* SDLWiperStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D61FC271A84238C00846EE7 /* SDLWiperStatus.m */; };
5D6CC8EF1C610E660027F60A /* SDLSecurityType.h in Headers */ = {isa = PBXBuildFile; fileRef = 5D6CC8EE1C610E660027F60A /* SDLSecurityType.h */; settings = {ATTRIBUTES = (Public, ); }; };
5D86022E1C99AF5100A55266 /* OCMock.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D1464351C99AC0900727339 /* OCMock.framework */; };
5D86022F1C99AF5900A55266 /* OCMock.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5D1464351C99AC0900727339 /* OCMock.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
5D8602301C99AF8300A55266 /* Nimble.framework.dSYM in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5D1464311C99AC0000727339 /* Nimble.framework.dSYM */; };
Expand Down Expand Up @@ -1649,6 +1650,7 @@
5D61FC251A84238C00846EE7 /* SDLWarningLightStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLWarningLightStatus.m; sourceTree = "<group>"; };
5D61FC261A84238C00846EE7 /* SDLWiperStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLWiperStatus.h; sourceTree = "<group>"; };
5D61FC271A84238C00846EE7 /* SDLWiperStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLWiperStatus.m; sourceTree = "<group>"; };
5D6CC8EE1C610E660027F60A /* SDLSecurityType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLSecurityType.h; sourceTree = "<group>"; };
5D8B174D1AC9D266006A6E1C /* SDLDialNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLDialNumber.h; sourceTree = "<group>"; };
5D8B174E1AC9D266006A6E1C /* SDLDialNumber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLDialNumber.m; sourceTree = "<group>"; };
5D8B17511AC9E11B006A6E1C /* SDLDialNumberResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLDialNumberResponse.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2199,6 +2201,7 @@
5D5934ED1A85160400687FB9 /* Proxy */ = {
isa = PBXGroup;
children = (
5D6CC8ED1C610E490027F60A /* Security */,
5D5934FE1A851B2500687FB9 /* @protocols */,
5D61FB031A84238A00846EE7 /* SDLLockScreenManager.h */,
5D61FB041A84238A00846EE7 /* SDLLockScreenManager.m */,
Expand Down Expand Up @@ -2942,6 +2945,14 @@
name = "Supporting Files";
sourceTree = "<group>";
};
5D6CC8ED1C610E490027F60A /* Security */ = {
isa = PBXGroup;
children = (
5D6CC8EE1C610E660027F60A /* SDLSecurityType.h */,
);
name = Security;
sourceTree = "<group>";
};
5DB92D201AC47AC400C15BB0 /* UtilitiesSpecs */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3063,6 +3074,7 @@
5D61FC5F1A84238C00846EE7 /* SDLCharacterSet.h in Headers */,
5D61FCFF1A84238C00846EE7 /* SDLOnAppInterfaceUnregistered.h in Headers */,
5D61FDC51A84238C00846EE7 /* SDLTCPTransport.h in Headers */,
5D6CC8EF1C610E660027F60A /* SDLSecurityType.h in Headers */,
5D61FCF61A84238C00846EE7 /* SDLMediaClockFormat.h in Headers */,
5D61FD831A84238C00846EE7 /* SDLSetDisplayLayout.h in Headers */,
5D61FCC91A84238C00846EE7 /* SDLIgnitionStableStatus.h in Headers */,
Expand Down
17 changes: 13 additions & 4 deletions SmartDeviceLink/SDLAbstractProtocol.h
Expand Up @@ -6,6 +6,7 @@
@class SDLRPCRequest;

#import "SDLProtocolListener.h"
#import "SDLSecurityType.h"
#import "SDLTransportDelegate.h"


Expand All @@ -14,15 +15,23 @@
@property (strong) NSString *debugConsoleGroupName;
@property (weak) SDLAbstractTransport *transport;
@property (strong) NSHashTable *protocolDelegateTable; // table of id<SDLProtocolListener>
@property (nonatomic, strong) id<SDLSecurityType> securityManager;
@property (nonatomic, copy) NSString *appId;

// Sending
- (void)sendStartSessionWithType:(SDLServiceType)serviceType;
- (void)sendEndSessionWithType:(SDLServiceType)serviceType;
- (void)sendStartSessionWithType:(SDLServiceType)serviceType __deprecated_msg(("Use startServiceWithType: instead"));
- (void)startServiceWithType:(SDLServiceType)serviceType;
- (void)startSecureServiceWithType:(SDLServiceType)serviceType completionHandler:(void (^)(BOOL success, NSError *error))completionHandler;
- (void)sendEndSessionWithType:(SDLServiceType)serviceType __deprecated_msg(("Use endServiceWithType: instead"));
- (void)endServiceWithType:(SDLServiceType)serviceType;
- (void)sendRPC:(SDLRPCMessage *)message;
- (BOOL)sendRPC:(SDLRPCMessage *)message encrypted:(BOOL)encryption error:(NSError **)error;
- (void)sendRPCRequest:(SDLRPCRequest *)rpcRequest __deprecated_msg(("Use sendRPC: instead"));
- (void)sendHeartbeat __deprecated_msg("Heartbeat is no longer used.");
- (void)sendRawDataStream:(NSInputStream *)inputStream withServiceType:(SDLServiceType)serviceType;
- (void)sendRawData:(NSData *)data withServiceType:(SDLServiceType)serviceType;
- (void)sendEncryptedRawData:(NSData *)data onService:(SDLServiceType)serviceType;

- (void)sendRawDataStream:(NSInputStream *)inputStream withServiceType:(SDLServiceType)serviceType __deprecated_msg("This is not implemented and will cause a crash if called");
- (void)sendHeartbeat __deprecated_msg("This is not implemented and will cause a crash if called");

// Recieving
- (void)handleBytesFromTransport:(NSData *)receivedData;
Expand Down
23 changes: 22 additions & 1 deletion SmartDeviceLink/SDLAbstractProtocol.m
Expand Up @@ -20,14 +20,31 @@ - (void)sendStartSessionWithType:(SDLServiceType)serviceType {
[self doesNotRecognizeSelector:_cmd];
}

- (void)startServiceWithType:(SDLServiceType)serviceType {
[self doesNotRecognizeSelector:_cmd];
}

- (void)startSecureServiceWithType:(SDLServiceType)serviceType completionHandler:(void (^)(BOOL success, NSError *error))completionHandler {
[self doesNotRecognizeSelector:_cmd];
}

- (void)sendEndSessionWithType:(SDLServiceType)serviceType {
[self doesNotRecognizeSelector:_cmd];
}

- (void)endServiceWithType:(SDLServiceType)serviceType {
[self doesNotRecognizeSelector:_cmd];
}

- (void)sendRPC:(SDLRPCMessage *)message {
[self doesNotRecognizeSelector:_cmd];
}

- (BOOL)sendRPC:(SDLRPCMessage *)message encrypted:(BOOL)encryption error:(NSError *__autoreleasing *)error {
[self doesNotRecognizeSelector:_cmd];
return NO;
}

- (void)sendRPCRequest:(SDLRPCRequest *)rpcRequest {
[self doesNotRecognizeSelector:_cmd];
}
Expand All @@ -40,11 +57,15 @@ - (void)handleBytesFromTransport:(NSData *)receivedData {
[self doesNotRecognizeSelector:_cmd];
}

- (void)sendRawData:(NSData *)data withServiceType:(SDLServiceType)serviceType {
[self doesNotRecognizeSelector:_cmd];
}

- (void)sendRawDataStream:(NSInputStream *)inputStream withServiceType:(SDLServiceType)serviceType {
[self doesNotRecognizeSelector:_cmd];
}

- (void)sendRawData:(NSData *)data withServiceType:(SDLServiceType)serviceType {
- (void)sendEncryptedRawData:(NSData *)data onService:(SDLServiceType)serviceType {
[self doesNotRecognizeSelector:_cmd];
}

Expand Down
14 changes: 12 additions & 2 deletions SmartDeviceLink/SDLProtocol.h
Expand Up @@ -5,15 +5,25 @@
@class SDLProtocolHeader;
@class SDLProtocolRecievedMessageRouter;

typedef NS_ENUM(NSUInteger, SDLProtocolError) {
SDLProtocolErrorNoSecurityManager,
};

extern NSString *const SDLProtocolSecurityErrorDomain;

@interface SDLProtocol : SDLAbstractProtocol <SDLProtocolListener>

// Sending
- (void)sendStartSessionWithType:(SDLServiceType)serviceType;
- (void)sendEndSessionWithType:(SDLServiceType)serviceType;
- (void)sendStartSessionWithType:(SDLServiceType)serviceType __deprecated_msg(("Use startServiceWithType: instead"));
- (void)startServiceWithType:(SDLServiceType)serviceType;
- (void)startSecureServiceWithType:(SDLServiceType)serviceType completionHandler:(void (^)(BOOL success, NSError *error))completionHandler;
- (void)sendEndSessionWithType:(SDLServiceType)serviceType __deprecated_msg(("Use endServiceWithType: instead"));
- (void)endServiceWithType:(SDLServiceType)serviceType;
- (void)sendRPC:(SDLRPCMessage *)message;
- (BOOL)sendRPC:(SDLRPCMessage *)message encrypted:(BOOL)encryption error:(NSError **)error;
- (void)sendRPCRequest:(SDLRPCRequest *)rpcRequest __deprecated_msg(("Use sendRPC: instead"));
- (void)sendRawData:(NSData *)data withServiceType:(SDLServiceType)serviceType;
- (void)sendEncryptedRawData:(NSData *)data onService:(SDLServiceType)serviceType;

// Recieving
- (void)handleBytesFromTransport:(NSData *)receivedData;
Expand Down