diff options
author | Satbir Tanda <satbirtanda@gmail.com> | 2019-09-05 17:59:38 -0700 |
---|---|---|
committer | Satbir Tanda <satbirtanda@gmail.com> | 2019-09-05 17:59:38 -0700 |
commit | ae9c67b09d3219b34f7edeafc2898d43722e75c5 (patch) | |
tree | af6af72e6918e857c5f88b6a9bb3a5fa7429cc54 | |
parent | 915b87ad7519eea4d0eb49a02097a2621c9311bc (diff) | |
download | sdl_ios-ae9c67b09d3219b34f7edeafc2898d43722e75c5.tar.gz |
Add a public startRPCEncryption method to SDLManager
-rw-r--r-- | SmartDeviceLink/SDLEncryptionLifecycleManager.h | 7 | ||||
-rw-r--r-- | SmartDeviceLink/SDLEncryptionLifecycleManager.m | 8 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLifecycleManager.h | 5 | ||||
-rw-r--r-- | SmartDeviceLink/SDLLifecycleManager.m | 3 | ||||
-rw-r--r-- | SmartDeviceLink/SDLManager.h | 6 | ||||
-rw-r--r-- | SmartDeviceLink/SDLManager.m | 3 |
6 files changed, 28 insertions, 4 deletions
diff --git a/SmartDeviceLink/SDLEncryptionLifecycleManager.h b/SmartDeviceLink/SDLEncryptionLifecycleManager.h index 336b08781..eb6aa951e 100644 --- a/SmartDeviceLink/SDLEncryptionLifecycleManager.h +++ b/SmartDeviceLink/SDLEncryptionLifecycleManager.h @@ -45,10 +45,15 @@ NS_ASSUME_NONNULL_BEGIN - (void)stop; /** - * Check whether or not an RPC needs encryption + * Check whether or not an RPC needs encryption. */ - (BOOL)rpcRequiresEncryption:(__kindof SDLRPCMessage *)rpc; +/** + * Attempt to manually start a secure service. + */ +- (void)startEncryptionService; + @end NS_ASSUME_NONNULL_END diff --git a/SmartDeviceLink/SDLEncryptionLifecycleManager.m b/SmartDeviceLink/SDLEncryptionLifecycleManager.m index b5afc7874..b42b53d69 100644 --- a/SmartDeviceLink/SDLEncryptionLifecycleManager.m +++ b/SmartDeviceLink/SDLEncryptionLifecycleManager.m @@ -84,6 +84,10 @@ NS_ASSUME_NONNULL_BEGIN return [self.encryptionStateMachine isCurrentState:SDLEncryptionLifecycleManagerStateReady]; } +- (void)startEncryptionService { + [self.encryptionStateMachine transitionToState:SDLEncryptionLifecycleManagerStateStarting]; +} + - (void)sdl_startEncryptionService { SDLLogV(@"Attempting to start Encryption Service"); if (!self.protocol || !self.currentHMILevel) { @@ -92,9 +96,7 @@ NS_ASSUME_NONNULL_BEGIN return; } - if (![self.currentHMILevel isEqualToEnum:SDLHMILevelNone]) { - -// } && [self appRequiresEncryption]) { + if (![self.currentHMILevel isEqualToEnum:SDLHMILevelNone] && [self appRequiresEncryption]) { [self.encryptionStateMachine transitionToState:SDLEncryptionLifecycleManagerStateStarting]; } else { SDLLogE(@"Encryption Manager is not ready to encrypt."); diff --git a/SmartDeviceLink/SDLLifecycleManager.h b/SmartDeviceLink/SDLLifecycleManager.h index 067cd6af5..519cdbf8f 100644 --- a/SmartDeviceLink/SDLLifecycleManager.h +++ b/SmartDeviceLink/SDLLifecycleManager.h @@ -118,6 +118,11 @@ typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error); */ - (void)stop; +/** + * Start the encryption lifecycle manager, which will attempt to open a secure service. + * + */ +- (void)startRPCEncryption; #pragma mark Send RPC Requests diff --git a/SmartDeviceLink/SDLLifecycleManager.m b/SmartDeviceLink/SDLLifecycleManager.m index d6622c3ad..c0cefe354 100644 --- a/SmartDeviceLink/SDLLifecycleManager.m +++ b/SmartDeviceLink/SDLLifecycleManager.m @@ -199,6 +199,9 @@ NSString *const BackgroundTaskTransportName = @"com.sdl.transport.backgroundTask }); } +- (void)startRPCEncryption { + [self.encryptionLifecycleManager startEncryptionService]; +} #pragma mark Getters diff --git a/SmartDeviceLink/SDLManager.h b/SmartDeviceLink/SDLManager.h index 9764f3f3a..0e3f22f3e 100644 --- a/SmartDeviceLink/SDLManager.h +++ b/SmartDeviceLink/SDLManager.h @@ -135,6 +135,12 @@ typedef void (^SDLManagerReadyBlock)(BOOL success, NSError *_Nullable error); */ - (void)stop; +/** + * Start the encryption lifecycle manager, which will attempt to open a secure service. + * + * Please call this method in the successful callback of startWithReadyHandler. If you do call this method, you must wait for SDLServiceEncryptionDelegate's serviceEncryptionUpdatedOnService delegate method before you send any encrypted RPCs. + */ +- (void)startRPCEncryption; #pragma mark Manually Send RPC Requests diff --git a/SmartDeviceLink/SDLManager.m b/SmartDeviceLink/SDLManager.m index b198f7e52..e9cb1c5c3 100644 --- a/SmartDeviceLink/SDLManager.m +++ b/SmartDeviceLink/SDLManager.m @@ -65,6 +65,9 @@ NS_ASSUME_NONNULL_BEGIN [self.lifecycleManager stop]; } +- (void)startRPCEncryption { + [self.lifecycleManager startRPCEncryption]; +} #pragma mark - Passthrough getters / setters |