From 0d18a560258c7079722b38ef731007705f688d90 Mon Sep 17 00:00:00 2001 From: Frank Elias Date: Wed, 8 Sep 2021 10:30:21 -0400 Subject: SDLSecurityQueryErrorCode fix --- SmartDeviceLink-iOS.xcodeproj/project.pbxproj | 4 +- .../private/SDLSecurityQueryErrorCode.h | 63 ++++++++++++++++++++++ .../private/SDLSecurityQueryErrorCode.m | 48 +++++++++++++++++ SmartDeviceLink/public/SDLSecurityQueryErrorCode.h | 63 ---------------------- SmartDeviceLink/public/SDLSecurityQueryErrorCode.m | 48 ----------------- 5 files changed, 113 insertions(+), 113 deletions(-) create mode 100644 SmartDeviceLink/private/SDLSecurityQueryErrorCode.h create mode 100644 SmartDeviceLink/private/SDLSecurityQueryErrorCode.m delete mode 100644 SmartDeviceLink/public/SDLSecurityQueryErrorCode.h delete mode 100644 SmartDeviceLink/public/SDLSecurityQueryErrorCode.m diff --git a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj index 159e115c6..5aa92c635 100644 --- a/SmartDeviceLink-iOS.xcodeproj/project.pbxproj +++ b/SmartDeviceLink-iOS.xcodeproj/project.pbxproj @@ -3662,8 +3662,8 @@ C9707D2F25E0444D009D00F2 /* SDLMacros.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SDLMacros.m; path = private/SDLMacros.m; sourceTree = ""; }; C975877E257AEFDB0066F271 /* SDLSeekIndicatorTypeSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLSeekIndicatorTypeSpec.m; sourceTree = ""; }; C9758784257F4C570066F271 /* SDLSeekStreamingIndicatorSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLSeekStreamingIndicatorSpec.m; sourceTree = ""; }; - C99BE00726C53E7E00DB0B54 /* SDLSecurityQueryErrorCode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SDLSecurityQueryErrorCode.h; path = public/SDLSecurityQueryErrorCode.h; sourceTree = ""; }; - C99BE00826C53E7E00DB0B54 /* SDLSecurityQueryErrorCode.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SDLSecurityQueryErrorCode.m; path = public/SDLSecurityQueryErrorCode.m; sourceTree = ""; }; + C99BE00726C53E7E00DB0B54 /* SDLSecurityQueryErrorCode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SDLSecurityQueryErrorCode.h; path = private/SDLSecurityQueryErrorCode.h; sourceTree = ""; }; + C99BE00826C53E7E00DB0B54 /* SDLSecurityQueryErrorCode.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SDLSecurityQueryErrorCode.m; path = private/SDLSecurityQueryErrorCode.m; sourceTree = ""; }; C99BE00C26C5B23000DB0B54 /* SDLSecurityQueryPayloadSpec.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SDLSecurityQueryPayloadSpec.m; sourceTree = ""; }; C9DFFE76257ACE0000F7D57A /* SDLSeekStreamingIndicator.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SDLSeekStreamingIndicator.h; path = public/SDLSeekStreamingIndicator.h; sourceTree = ""; }; C9DFFE77257ACE0000F7D57A /* SDLSeekStreamingIndicator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = SDLSeekStreamingIndicator.m; path = public/SDLSeekStreamingIndicator.m; sourceTree = ""; }; diff --git a/SmartDeviceLink/private/SDLSecurityQueryErrorCode.h b/SmartDeviceLink/private/SDLSecurityQueryErrorCode.h new file mode 100644 index 000000000..7f516c7d3 --- /dev/null +++ b/SmartDeviceLink/private/SDLSecurityQueryErrorCode.h @@ -0,0 +1,63 @@ +// +// SDLSecurityQueryErrorCode.h +// SmartDeviceLink +// +// Created by Frank Elias on 8/12/21. +// Copyright © 2021 smartdevicelink. All rights reserved. +// + +#import "SDLEnum.h" + +typedef SDLEnum SDLSecurityQueryErrorCode NS_TYPED_ENUM; + +///Internal Security Manager value +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeSuccess; + +///Wrong size of query data +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidQuerySize; + +///Unknown Query ID +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidQueryID; + +///SDL does not support encryption +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeNotSupported; + +///Received request to protect a service that was protected before +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeServiceAlreadyProtected; + +///Received handshake or encrypted data for not protected service +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeServiceNotProtected; + +///Decryption failed +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeDecryptionFailed; + +///Encryption failed +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeEncryptionFailed; + +///SSL invalid data +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeSSLInvalidData; + +///In case of all other handshake errors +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeHandshakeFailed; + +///Handshake failed because certificate is invalid +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidCertificate; + +///Handshake failed because certificate is expired +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeExpiredCertificate; + +///Internal error +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInternal; + +///Error value for testing +extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeUnknownInternalError; + + +@interface SDLSecurityQueryError : NSObject + +/** + Compare the internal error ID with the App's security query error codes + */ ++ (SDLSecurityQueryErrorCode)convertErrorIdToStringEnum:(NSNumber *)errorId; + +@end diff --git a/SmartDeviceLink/private/SDLSecurityQueryErrorCode.m b/SmartDeviceLink/private/SDLSecurityQueryErrorCode.m new file mode 100644 index 000000000..a1a55ea6c --- /dev/null +++ b/SmartDeviceLink/private/SDLSecurityQueryErrorCode.m @@ -0,0 +1,48 @@ +// +// SDLSecurityQueryErrorCode.m +// SmartDeviceLink +// +// Created by Frank Elias on 8/12/21. +// Copyright © 2021 smartdevicelink. All rights reserved. +// + +#import "SDLSecurityQueryErrorCode.h" + +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeSuccess = @"Success"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidQuerySize = @"Wrong size of query data"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidQueryID = @"Unknown Query ID"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeNotSupported = @"SDL does not support encryption"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeServiceAlreadyProtected = @"Received request to protect a service that was protected before"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeServiceNotProtected = @"Received handshake or encrypted data for not protected service"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeDecryptionFailed = @"Decryption failed"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeEncryptionFailed = @"Encryption failed"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeSSLInvalidData = @"SSL invalid data"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeHandshakeFailed = @"In case of all other handshake errors"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidCertificate = @"Handshake failed because certificate is invalid"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeExpiredCertificate = @"Handshake failed because certificate is expired"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInternal = @"Internal error"; +SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeUnknownInternalError = @"Error value for testing"; + + +@implementation SDLSecurityQueryError + ++ (SDLSecurityQueryErrorCode)convertErrorIdToStringEnum:(NSNumber *)errorId { + switch (errorId.unsignedIntegerValue) { + case 0x00: return SDLSecurityQueryErrorCodeSuccess; + case 0x01: return SDLSecurityQueryErrorCodeInvalidQuerySize; + case 0x02: return SDLSecurityQueryErrorCodeInvalidQueryID; + case 0x03: return SDLSecurityQueryErrorCodeNotSupported; + case 0x04: return SDLSecurityQueryErrorCodeServiceAlreadyProtected; + case 0x05: return SDLSecurityQueryErrorCodeServiceNotProtected; + case 0x06: return SDLSecurityQueryErrorCodeDecryptionFailed; + case 0x07: return SDLSecurityQueryErrorCodeEncryptionFailed; + case 0x08: return SDLSecurityQueryErrorCodeSSLInvalidData; + case 0x09: return SDLSecurityQueryErrorCodeHandshakeFailed; + case 0x0A: return SDLSecurityQueryErrorCodeInvalidCertificate; + case 0x0B: return SDLSecurityQueryErrorCodeExpiredCertificate; + case 0xFF: return SDLSecurityQueryErrorCodeInternal; + default: return SDLSecurityQueryErrorCodeUnknownInternalError; + } +} + +@end diff --git a/SmartDeviceLink/public/SDLSecurityQueryErrorCode.h b/SmartDeviceLink/public/SDLSecurityQueryErrorCode.h deleted file mode 100644 index 7f516c7d3..000000000 --- a/SmartDeviceLink/public/SDLSecurityQueryErrorCode.h +++ /dev/null @@ -1,63 +0,0 @@ -// -// SDLSecurityQueryErrorCode.h -// SmartDeviceLink -// -// Created by Frank Elias on 8/12/21. -// Copyright © 2021 smartdevicelink. All rights reserved. -// - -#import "SDLEnum.h" - -typedef SDLEnum SDLSecurityQueryErrorCode NS_TYPED_ENUM; - -///Internal Security Manager value -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeSuccess; - -///Wrong size of query data -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidQuerySize; - -///Unknown Query ID -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidQueryID; - -///SDL does not support encryption -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeNotSupported; - -///Received request to protect a service that was protected before -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeServiceAlreadyProtected; - -///Received handshake or encrypted data for not protected service -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeServiceNotProtected; - -///Decryption failed -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeDecryptionFailed; - -///Encryption failed -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeEncryptionFailed; - -///SSL invalid data -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeSSLInvalidData; - -///In case of all other handshake errors -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeHandshakeFailed; - -///Handshake failed because certificate is invalid -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidCertificate; - -///Handshake failed because certificate is expired -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeExpiredCertificate; - -///Internal error -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInternal; - -///Error value for testing -extern SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeUnknownInternalError; - - -@interface SDLSecurityQueryError : NSObject - -/** - Compare the internal error ID with the App's security query error codes - */ -+ (SDLSecurityQueryErrorCode)convertErrorIdToStringEnum:(NSNumber *)errorId; - -@end diff --git a/SmartDeviceLink/public/SDLSecurityQueryErrorCode.m b/SmartDeviceLink/public/SDLSecurityQueryErrorCode.m deleted file mode 100644 index a1a55ea6c..000000000 --- a/SmartDeviceLink/public/SDLSecurityQueryErrorCode.m +++ /dev/null @@ -1,48 +0,0 @@ -// -// SDLSecurityQueryErrorCode.m -// SmartDeviceLink -// -// Created by Frank Elias on 8/12/21. -// Copyright © 2021 smartdevicelink. All rights reserved. -// - -#import "SDLSecurityQueryErrorCode.h" - -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeSuccess = @"Success"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidQuerySize = @"Wrong size of query data"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidQueryID = @"Unknown Query ID"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeNotSupported = @"SDL does not support encryption"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeServiceAlreadyProtected = @"Received request to protect a service that was protected before"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeServiceNotProtected = @"Received handshake or encrypted data for not protected service"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeDecryptionFailed = @"Decryption failed"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeEncryptionFailed = @"Encryption failed"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeSSLInvalidData = @"SSL invalid data"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeHandshakeFailed = @"In case of all other handshake errors"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInvalidCertificate = @"Handshake failed because certificate is invalid"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeExpiredCertificate = @"Handshake failed because certificate is expired"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeInternal = @"Internal error"; -SDLSecurityQueryErrorCode const SDLSecurityQueryErrorCodeUnknownInternalError = @"Error value for testing"; - - -@implementation SDLSecurityQueryError - -+ (SDLSecurityQueryErrorCode)convertErrorIdToStringEnum:(NSNumber *)errorId { - switch (errorId.unsignedIntegerValue) { - case 0x00: return SDLSecurityQueryErrorCodeSuccess; - case 0x01: return SDLSecurityQueryErrorCodeInvalidQuerySize; - case 0x02: return SDLSecurityQueryErrorCodeInvalidQueryID; - case 0x03: return SDLSecurityQueryErrorCodeNotSupported; - case 0x04: return SDLSecurityQueryErrorCodeServiceAlreadyProtected; - case 0x05: return SDLSecurityQueryErrorCodeServiceNotProtected; - case 0x06: return SDLSecurityQueryErrorCodeDecryptionFailed; - case 0x07: return SDLSecurityQueryErrorCodeEncryptionFailed; - case 0x08: return SDLSecurityQueryErrorCodeSSLInvalidData; - case 0x09: return SDLSecurityQueryErrorCodeHandshakeFailed; - case 0x0A: return SDLSecurityQueryErrorCodeInvalidCertificate; - case 0x0B: return SDLSecurityQueryErrorCodeExpiredCertificate; - case 0xFF: return SDLSecurityQueryErrorCodeInternal; - default: return SDLSecurityQueryErrorCodeUnknownInternalError; - } -} - -@end -- cgit v1.2.1