summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSatbir Tanda <satbirtanda@gmail.com>2019-09-04 12:43:42 -0700
committerSatbir Tanda <satbirtanda@gmail.com>2019-09-04 12:43:42 -0700
commit5668b97c0c460835c2f7cf8e0c70634ee46fdea3 (patch)
treea6010b9fdf59c895c474a45321fa6330f19e941c
parentbc71e5c2299deab68de41040708fa35a4f2b7223 (diff)
downloadsdl_ios-5668b97c0c460835c2f7cf8e0c70634ee46fdea3.tar.gz
Update SDLEncryptionLifecycleManager.m
Add proper checks
-rw-r--r--SmartDeviceLink/SDLEncryptionLifecycleManager.m14
1 files changed, 12 insertions, 2 deletions
diff --git a/SmartDeviceLink/SDLEncryptionLifecycleManager.m b/SmartDeviceLink/SDLEncryptionLifecycleManager.m
index 3d0589981..3f998c0db 100644
--- a/SmartDeviceLink/SDLEncryptionLifecycleManager.m
+++ b/SmartDeviceLink/SDLEncryptionLifecycleManager.m
@@ -88,8 +88,7 @@ NS_ASSUME_NONNULL_BEGIN
return;
}
- if (![self.currentHMILevel isEqualToEnum:SDLHMILevelNone]
- && (self.requiresEncryption || [self containsAtLeastOneRPCThatRequiresEncryption])) {
+ if (![self.currentHMILevel isEqualToEnum:SDLHMILevelNone] && [self appRequiresEncryption]) {
[self.encryptionStateMachine transitionToState:SDLEncryptionLifecycleManagerStateStarting];
} else {
SDLLogE(@"Encryption Manager is not ready to encrypt.");
@@ -233,6 +232,17 @@ NS_ASSUME_NONNULL_BEGIN
}
}
+- (BOOL)appRequiresEncryption {
+ if (self.requiresEncryption) {
+ return YES;
+ } else {
+ if ([self containsAtLeastOneRPCThatRequiresEncryption]) {
+ return YES;
+ }
+ }
+ return NO;
+}
+
- (BOOL)rpcRequiresEncryption:(__kindof SDLRPCMessage *)rpc {
if (self.permissions[rpc.name].requireEncryption != nil) {
return self.permissions[rpc.name].requireEncryption.boolValue;