diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c13ac0e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,22 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.1] - 2020-01 +### Added +- This CHANGELOG.md file. + +### Changed +- The Jamf Certificate SDK now adds an interval to the time specified in the pollingTimeout setting. This enables the SDK to retrieve the Managed App Configuration prior to starting the specified pollingTimeout seconds. +- The Jamf Certificate SDK has been re-licensed under the MIT License. + +### Fixed +- The Jamf Certificate SDK now properly handles network errors and status updates when making requests for a new Managed App Configuration. +- Fixed an issue that prevented the progress of steps from starting at zero and incrementing by one up to the maxNumberOfSteps. +- Fixed an issue that prevented the NSError object from being correctly sent into the certificateRequest:errorOccurred: delegate method. + +## [1.0.0] - 2018-07-24 +### Added +- Initial release. diff --git a/Certificate SDK Sample App.xcodeproj/project.pbxproj b/Certificate SDK Sample App.xcodeproj/project.pbxproj index 16689bf..f10a4ca 100644 --- a/Certificate SDK Sample App.xcodeproj/project.pbxproj +++ b/Certificate SDK Sample App.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + 9712A85B213EED15003A2789 /* .swiftlint.yml */ = {isa = PBXFileReference; lastKnownFileType = text; path = .swiftlint.yml; sourceTree = ""; }; 9797329320B37D7000CF87D8 /* CertificateSDK.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CertificateSDK.framework; sourceTree = ""; }; 97BE792F20AB6FF3009579E5 /* Certificate SDK Sample App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Certificate SDK Sample App.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 97BE793220AB6FF3009579E5 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -68,6 +69,7 @@ 97BE792620AB6FF3009579E5 = { isa = PBXGroup; children = ( + 9712A85B213EED15003A2789 /* .swiftlint.yml */, 97BE793120AB6FF3009579E5 /* Certificate SDK Sample App */, 9797329320B37D7000CF87D8 /* CertificateSDK.framework */, 97BE793020AB6FF3009579E5 /* Products */, @@ -135,6 +137,7 @@ TargetAttributes = { 97BE792E20AB6FF3009579E5 = { CreatedOnToolsVersion = 9.3; + LastSwiftMigration = 1120; SystemCapabilities = { com.apple.BackgroundModes = { enabled = 0; @@ -360,7 +363,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.jamf.certificate-sdk.sample"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/CertificateSDK.framework/Headers/CertificateSDK.h"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Debug; @@ -382,7 +385,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.jamf.certificate-sdk.sample"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "$(PROJECT_DIR)/CertificateSDK.framework/Headers/CertificateSDK.h"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = "1,2"; }; name = Release; diff --git a/Certificate SDK Sample App/ActionLogViewController.swift b/Certificate SDK Sample App/ActionLogViewController.swift index 1027076..4f28e72 100644 --- a/Certificate SDK Sample App/ActionLogViewController.swift +++ b/Certificate SDK Sample App/ActionLogViewController.swift @@ -1,12 +1,13 @@ // // ActionLogViewController.swift // Certificate SDK Sample App +// https://github.com/jamf/CertificateSDK // -// Copyright © 2018 Jamf. All rights reserved. +// Copyright © 2019 Jamf. All rights reserved. // -import UIKit import CertificateSDK +import UIKit class ActionLogViewController: UIViewController { @@ -54,16 +55,16 @@ class ActionLogViewController: UIViewController { // MARK: - + /// Start a new certificate request. func runTest() { - // Start a new certificate request. if let sdkSetup = setup { requestManager?.cancelPendingRequest() requestManager?.startRequest(with: sdkSetup) } } + /// Update the user interface for the detail item. func resetBaseTextView() { - // Update the user interface for the detail item. if let sdkSetup = setup, let textView = actionLogTextView { textView.text = "Setup: \(sdkSetup.description)" @@ -72,7 +73,7 @@ class ActionLogViewController: UIViewController { } func append(_ logText: String) { - DispatchQueue.main.async(execute: { + DispatchQueue.main.async { if let textView = self.actionLogTextView { let existingText = textView.text ?? "" let newText = "\(existingText)\n\(logText)" @@ -82,7 +83,7 @@ class ActionLogViewController: UIViewController { let lastChar = NSRange(location: (newText as NSString).length - 1, length: 1) textView.scrollRangeToVisible(lastChar) } - }) + } } func updateProgress(_ progress: Float) { diff --git a/Certificate SDK Sample App/AppDelegate.swift b/Certificate SDK Sample App/AppDelegate.swift index a03658e..1b8c658 100644 --- a/Certificate SDK Sample App/AppDelegate.swift +++ b/Certificate SDK Sample App/AppDelegate.swift @@ -1,8 +1,9 @@ // // AppDelegate.swift // Certificate SDK Sample App +// https://github.com/jamf/CertificateSDK // -// Copyright © 2018 Jamf. All rights reserved. +// Copyright © 2019 Jamf. All rights reserved. // import UIKit @@ -16,7 +17,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele let requestManager = CertificateRequestManager() func application(_ application: UIApplication, - didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. if let splitViewController = window!.rootViewController as? UISplitViewController { let navigationController = splitViewController.viewControllers[splitViewController.viewControllers.count-1] diff --git a/Certificate SDK Sample App/CertificateRequestManager.swift b/Certificate SDK Sample App/CertificateRequestManager.swift index e8a033d..6205353 100644 --- a/Certificate SDK Sample App/CertificateRequestManager.swift +++ b/Certificate SDK Sample App/CertificateRequestManager.swift @@ -1,8 +1,9 @@ // // CertificateRequestManager.swift // Certificate SDK Sample App +// https://github.com/jamf/CertificateSDK // -// Copyright © 2018 Jamf. All rights reserved. +// Copyright © 2019 Jamf. All rights reserved. // import UIKit @@ -42,6 +43,7 @@ class CertificateRequestManager: NSObject { } certificateRequest = localRequest } + certificateRequest?.startNewCertificateRequest() } @@ -80,8 +82,13 @@ extension CertificateRequestHandler: CertificateRequestDelegate { } func certificateRequest(_ request: CertificateRequestProtocol, isUsingNetwork: Bool) { + self.textOutputHandler?("Using network: \(isUsingNetwork)") DispatchQueue.main.async { UIApplication.shared.isNetworkActivityIndicatorVisible = isUsingNetwork } } + + func certificateRequest(_ request: CertificateRequestProtocol, isWaitingForMAC waitingForMAC: Bool) { + self.textOutputHandler?("Waiting for AppConfig: \(waitingForMAC)") + } } diff --git a/Certificate SDK Sample App/CertificateSDKSetup.swift b/Certificate SDK Sample App/CertificateSDKSetup.swift index be9526a..1b4726c 100644 --- a/Certificate SDK Sample App/CertificateSDKSetup.swift +++ b/Certificate SDK Sample App/CertificateSDKSetup.swift @@ -1,8 +1,9 @@ // // CertificateSDKSetup.swift // Certificate SDK Sample App +// https://github.com/jamf/CertificateSDK // -// Copyright © 2018 Jamf. All rights reserved. +// Copyright © 2019 Jamf. All rights reserved. // /// Contains the selected options for the test run diff --git a/Certificate SDK Sample App/Info.plist b/Certificate SDK Sample App/Info.plist index 513fa52..55eb1a8 100644 --- a/Certificate SDK Sample App/Info.plist +++ b/Certificate SDK Sample App/Info.plist @@ -17,7 +17,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.0 + 1.0.1 CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/Certificate SDK Sample App/KeychainHandler.swift b/Certificate SDK Sample App/KeychainHandler.swift index b174202..733d9de 100644 --- a/Certificate SDK Sample App/KeychainHandler.swift +++ b/Certificate SDK Sample App/KeychainHandler.swift @@ -1,8 +1,9 @@ // // KeychainHandler.swift // Certificate SDK Sample App +// https://github.com/jamf/CertificateSDK // -// Copyright © 2018 Jamf. All rights reserved. +// Copyright © 2019 Jamf. All rights reserved. // import Foundation @@ -22,6 +23,10 @@ struct KeychainHandler { return "Keychain item already exists" case errSecSuccess: return "Keychain item added" + case errSecNotAvailable: + var result = "Keychain item could not be added. Your device probably does not have a passcode." + result += "Set a passcode and try again." + return result default: return "Keychain add resulted in status: \(status)" } @@ -30,10 +35,10 @@ struct KeychainHandler { func clearKeychain() -> String { var resultString = "" let query = [kSecMatchLimit: kSecMatchLimitAll, - kSecReturnAttributes: kCFBooleanTrue, - kSecReturnRef: kCFBooleanTrue, + kSecReturnAttributes: true, + kSecReturnRef: true, kSecClass: kSecClassIdentity] as CFDictionary - var result: CFTypeRef? = nil + var result: CFTypeRef? let resultCode = SecItemCopyMatching(query, &result) if resultCode == errSecSuccess { @@ -66,9 +71,9 @@ struct KeychainHandler { var resultString = "--- Certificates in Keychain ---\n" var outputACert = false let query = [kSecMatchLimit: kSecMatchLimitAll, - kSecReturnRef: kCFBooleanTrue, + kSecReturnRef: true, kSecClass: kSecClassCertificate] as CFDictionary - var result: CFTypeRef? = nil + var result: CFTypeRef? let resultCode = SecItemCopyMatching(query, &result) if resultCode == errSecSuccess { diff --git a/Certificate SDK Sample App/SetupTestViewController.swift b/Certificate SDK Sample App/SetupTestViewController.swift index 2471805..a1f5f3f 100644 --- a/Certificate SDK Sample App/SetupTestViewController.swift +++ b/Certificate SDK Sample App/SetupTestViewController.swift @@ -1,8 +1,9 @@ // // SetupTestViewController.swift // Certificate SDK Sample App +// https://github.com/jamf/CertificateSDK // -// Copyright © 2018 Jamf. All rights reserved. +// Copyright © 2019 Jamf. All rights reserved. // import UIKit diff --git a/CertificateSDK.framework/CertificateSDK b/CertificateSDK.framework/CertificateSDK old mode 100644 new mode 100755 index ba9a162..322be16 Binary files a/CertificateSDK.framework/CertificateSDK and b/CertificateSDK.framework/CertificateSDK differ diff --git a/CertificateSDK.framework/Headers/CertificateRequestBase.h b/CertificateSDK.framework/Headers/CertificateRequestBase.h index 0e407d9..217b488 100644 --- a/CertificateSDK.framework/Headers/CertificateRequestBase.h +++ b/CertificateSDK.framework/Headers/CertificateRequestBase.h @@ -1,28 +1,30 @@ /* - CertificateRequestBase.h - CertificateSDK - - Copyright © 2018 Jamf. All rights reserved. - - This Jamf software is covered by the "Jamf Certificate SDK License". - The first two sections are included here for reference, but please refer - to the complete Jamf Certificate SDK License which is included in the SDK. - - 1. License Grant. Jamf hereby grants Licensee a limited, nonexclusive, nontransferable, - nonsublicensable, royalty free, fully paid up right to use the Jamf Pro software development - kit (“SDK”) solely for integrating Jamf Pro into the Licensee Product; and copy, distribute, - and connect with other software Jamf Pro as integrated into the LIcensee product, which it - may sell or offer to sell, or authorize others to the same, to end users. - - 2. License Restrictions. The SDK is provided under a license, not sold. Except for the rights - expressly granted by Jamf to Licensee above, there are no other licenses granted to Licensee - under this Agreement, express or implied, and Jamf reserves all rights, title, and interest in - and to the SDK. Licensee will not engage, directly or indirectly, in the disassembly, reverse - engineering, decompilation, modification, or translation of the SDK. Licensee will not copy and - sell the SDK as a stand-alone package nor create derivative works of the SDK without the prior - written consent of Jamf. Licensee shall not remove or destroy any proprietary, confidential, - copyright, trademark, or patent markings or notices placed upon the SDK. - */ + CertificateRequestBase.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ #ifndef CertificateRequestBase_h #define CertificateRequestBase_h diff --git a/CertificateSDK.framework/Headers/CertificateRequestDelegate.h b/CertificateSDK.framework/Headers/CertificateRequestDelegate.h index f38e1af..620d4dd 100644 --- a/CertificateSDK.framework/Headers/CertificateRequestDelegate.h +++ b/CertificateSDK.framework/Headers/CertificateRequestDelegate.h @@ -1,28 +1,30 @@ /* - CertificateRequestDelegate.h - CertificateSDK - - Copyright © 2018 Jamf. All rights reserved. - - This Jamf software is covered by the "Jamf Certificate SDK License". - The first two sections are included here for reference, but please refer - to the complete Jamf Certificate SDK License which is included in the SDK. - - 1. License Grant. Jamf hereby grants Licensee a limited, nonexclusive, nontransferable, - nonsublicensable, royalty free, fully paid up right to use the Jamf Pro software development - kit (“SDK”) solely for integrating Jamf Pro into the Licensee Product; and copy, distribute, - and connect with other software Jamf Pro as integrated into the LIcensee product, which it - may sell or offer to sell, or authorize others to the same, to end users. - - 2. License Restrictions. The SDK is provided under a license, not sold. Except for the rights - expressly granted by Jamf to Licensee above, there are no other licenses granted to Licensee - under this Agreement, express or implied, and Jamf reserves all rights, title, and interest in - and to the SDK. Licensee will not engage, directly or indirectly, in the disassembly, reverse - engineering, decompilation, modification, or translation of the SDK. Licensee will not copy and - sell the SDK as a stand-alone package nor create derivative works of the SDK without the prior - written consent of Jamf. Licensee shall not remove or destroy any proprietary, confidential, - copyright, trademark, or patent markings or notices placed upon the SDK. - */ + CertificateRequestDelegate.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ #ifndef CertificateRequestDelegate_h #define CertificateRequestDelegate_h diff --git a/CertificateSDK.framework/Headers/CertificateRequestEmbeddedP12.h b/CertificateSDK.framework/Headers/CertificateRequestEmbeddedP12.h index 8d8b225..8cdde57 100644 --- a/CertificateSDK.framework/Headers/CertificateRequestEmbeddedP12.h +++ b/CertificateSDK.framework/Headers/CertificateRequestEmbeddedP12.h @@ -1,28 +1,30 @@ /* - CertificateRequestEmbeddedP12.h - CertificateSDK - - Copyright © 2018 Jamf. All rights reserved. - - This Jamf software is covered by the "Jamf Certificate SDK License". - The first two sections are included here for reference, but please refer - to the complete Jamf Certificate SDK License which is included in the SDK. - - 1. License Grant. Jamf hereby grants Licensee a limited, nonexclusive, nontransferable, - nonsublicensable, royalty free, fully paid up right to use the Jamf Pro software development - kit (“SDK”) solely for integrating Jamf Pro into the Licensee Product; and copy, distribute, - and connect with other software Jamf Pro as integrated into the LIcensee product, which it - may sell or offer to sell, or authorize others to the same, to end users. - - 2. License Restrictions. The SDK is provided under a license, not sold. Except for the rights - expressly granted by Jamf to Licensee above, there are no other licenses granted to Licensee - under this Agreement, express or implied, and Jamf reserves all rights, title, and interest in - and to the SDK. Licensee will not engage, directly or indirectly, in the disassembly, reverse - engineering, decompilation, modification, or translation of the SDK. Licensee will not copy and - sell the SDK as a stand-alone package nor create derivative works of the SDK without the prior - written consent of Jamf. Licensee shall not remove or destroy any proprietary, confidential, - copyright, trademark, or patent markings or notices placed upon the SDK. - */ + CertificateRequestEmbeddedP12.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ #ifndef CertificateRequestEmbeddedP12_h #define CertificateRequestEmbeddedP12_h diff --git a/CertificateSDK.framework/Headers/CertificateRequestErrorDomain.h b/CertificateSDK.framework/Headers/CertificateRequestErrorDomain.h index 46dc5ad..4dc9789 100644 --- a/CertificateSDK.framework/Headers/CertificateRequestErrorDomain.h +++ b/CertificateSDK.framework/Headers/CertificateRequestErrorDomain.h @@ -1,28 +1,30 @@ /* - CertificateErrorDomain.h - CertificateSDK - - Copyright © 2018 Jamf. All rights reserved. - - This Jamf software is covered by the "Jamf Certificate SDK License". - The first two sections are included here for reference, but please refer - to the complete Jamf Certificate SDK License which is included in the SDK. - - 1. License Grant. Jamf hereby grants Licensee a limited, nonexclusive, nontransferable, - nonsublicensable, royalty free, fully paid up right to use the Jamf Pro software development - kit (“SDK”) solely for integrating Jamf Pro into the Licensee Product; and copy, distribute, - and connect with other software Jamf Pro as integrated into the LIcensee product, which it - may sell or offer to sell, or authorize others to the same, to end users. - - 2. License Restrictions. The SDK is provided under a license, not sold. Except for the rights - expressly granted by Jamf to Licensee above, there are no other licenses granted to Licensee - under this Agreement, express or implied, and Jamf reserves all rights, title, and interest in - and to the SDK. Licensee will not engage, directly or indirectly, in the disassembly, reverse - engineering, decompilation, modification, or translation of the SDK. Licensee will not copy and - sell the SDK as a stand-alone package nor create derivative works of the SDK without the prior - written consent of Jamf. Licensee shall not remove or destroy any proprietary, confidential, - copyright, trademark, or patent markings or notices placed upon the SDK. - */ + CertificateRequestErrorDomain.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ #ifndef CertificateErrorDomain_h #define CertificateErrorDomain_h @@ -40,13 +42,15 @@ extern NSString * const kCertificateRequestErrorDomain; - kErrorCertificateWrongAutomaticPassword: Unlikely to happen. Occurs when the .p12 from the server was encrypted with a different password than the SDK has chosen. - kErrorIncorrectManagedAppConfigData: The Managed App Config info does not contain enough information to contact Jamf Pro. - kErrorInvalidResponseFromJamfProServer: Unlikely to happen. The Jamf Pro server responded with info that the SDK does not understand. + - kErrorTestingP12LoadFailed: Unlikely to happen. When using the testing class CertificateRequestEmbeddedP12 this is a generic error that the p12 failed to load. */ NS_ERROR_ENUM(kCertificateRequestErrorDomain) { kErrorBadInitializationParams = 1, kErrorCertificateMalformed = 2, kErrorCertificateWrongAutomaticPassword = 3, kErrorIncorrectManagedAppConfigData = 4, - kErrorInvalidResponseFromJamfProServer = 5 + kErrorInvalidResponseFromJamfProServer = 5, + kErrorTestingP12LoadFailed = 6 }; #endif /* CertificateErrorDomain_h */ diff --git a/CertificateSDK.framework/Headers/CertificateRequestProtocol.h b/CertificateSDK.framework/Headers/CertificateRequestProtocol.h index 226f84e..d82b998 100644 --- a/CertificateSDK.framework/Headers/CertificateRequestProtocol.h +++ b/CertificateSDK.framework/Headers/CertificateRequestProtocol.h @@ -1,28 +1,30 @@ /* - CertificateRequestProtocol.h - CertificateSDK - - Copyright © 2018 Jamf. All rights reserved. - - This Jamf software is covered by the "Jamf Certificate SDK License". - The first two sections are included here for reference, but please refer - to the complete Jamf Certificate SDK License which is included in the SDK. - - 1. License Grant. Jamf hereby grants Licensee a limited, nonexclusive, nontransferable, - nonsublicensable, royalty free, fully paid up right to use the Jamf Pro software development - kit (“SDK”) solely for integrating Jamf Pro into the Licensee Product; and copy, distribute, - and connect with other software Jamf Pro as integrated into the LIcensee product, which it - may sell or offer to sell, or authorize others to the same, to end users. - - 2. License Restrictions. The SDK is provided under a license, not sold. Except for the rights - expressly granted by Jamf to Licensee above, there are no other licenses granted to Licensee - under this Agreement, express or implied, and Jamf reserves all rights, title, and interest in - and to the SDK. Licensee will not engage, directly or indirectly, in the disassembly, reverse - engineering, decompilation, modification, or translation of the SDK. Licensee will not copy and - sell the SDK as a stand-alone package nor create derivative works of the SDK without the prior - written consent of Jamf. Licensee shall not remove or destroy any proprietary, confidential, - copyright, trademark, or patent markings or notices placed upon the SDK. - */ + CertificateRequestProtocol.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ #ifndef CertificateRequestProtocol_h #define CertificateRequestProtocol_h diff --git a/CertificateSDK.framework/Headers/CertificateRequestWorkflow.h b/CertificateSDK.framework/Headers/CertificateRequestWorkflow.h index 01026cf..0ca3d0d 100644 --- a/CertificateSDK.framework/Headers/CertificateRequestWorkflow.h +++ b/CertificateSDK.framework/Headers/CertificateRequestWorkflow.h @@ -1,28 +1,30 @@ /* - CertificateRequestWorkflow.h - CertificateSDK - - Copyright © 2018 Jamf. All rights reserved. - - This Jamf software is covered by the "Jamf Certificate SDK License". - The first two sections are included here for reference, but please refer - to the complete Jamf Certificate SDK License which is included in the SDK. - - 1. License Grant. Jamf hereby grants Licensee a limited, nonexclusive, nontransferable, - nonsublicensable, royalty free, fully paid up right to use the Jamf Pro software development - kit (“SDK”) solely for integrating Jamf Pro into the Licensee Product; and copy, distribute, - and connect with other software Jamf Pro as integrated into the LIcensee product, which it - may sell or offer to sell, or authorize others to the same, to end users. - - 2. License Restrictions. The SDK is provided under a license, not sold. Except for the rights - expressly granted by Jamf to Licensee above, there are no other licenses granted to Licensee - under this Agreement, express or implied, and Jamf reserves all rights, title, and interest in - and to the SDK. Licensee will not engage, directly or indirectly, in the disassembly, reverse - engineering, decompilation, modification, or translation of the SDK. Licensee will not copy and - sell the SDK as a stand-alone package nor create derivative works of the SDK without the prior - written consent of Jamf. Licensee shall not remove or destroy any proprietary, confidential, - copyright, trademark, or patent markings or notices placed upon the SDK. - */ + CertificateRequestWorkflow.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +*/ #ifndef CertificateRequestWorkflow_h #define CertificateRequestWorkflow_h diff --git a/CertificateSDK.framework/Headers/CertificateSDK.h b/CertificateSDK.framework/Headers/CertificateSDK.h index 247b1f0..06dbb8f 100644 --- a/CertificateSDK.framework/Headers/CertificateSDK.h +++ b/CertificateSDK.framework/Headers/CertificateSDK.h @@ -1,27 +1,29 @@ /* - CertificateSDK.h - CertificateSDK - - Copyright © 2018 Jamf. All rights reserved. - - This Jamf software is covered by the "Jamf Certificate SDK License". - The first two sections are included here for reference, but please refer - to the complete Jamf Certificate SDK License which is included in the SDK. - - 1. License Grant. Jamf hereby grants Licensee a limited, nonexclusive, nontransferable, - nonsublicensable, royalty free, fully paid up right to use the Jamf Pro software development - kit (“SDK”) solely for integrating Jamf Pro into the Licensee Product; and copy, distribute, - and connect with other software Jamf Pro as integrated into the LIcensee product, which it - may sell or offer to sell, or authorize others to the same, to end users. - - 2. License Restrictions. The SDK is provided under a license, not sold. Except for the rights - expressly granted by Jamf to Licensee above, there are no other licenses granted to Licensee - under this Agreement, express or implied, and Jamf reserves all rights, title, and interest in - and to the SDK. Licensee will not engage, directly or indirectly, in the disassembly, reverse - engineering, decompilation, modification, or translation of the SDK. Licensee will not copy and - sell the SDK as a stand-alone package nor create derivative works of the SDK without the prior - written consent of Jamf. Licensee shall not remove or destroy any proprietary, confidential, - copyright, trademark, or patent markings or notices placed upon the SDK. + CertificateSDK.h + + https://github.com/jamf/CertificateSDK + + MIT License + + Copyright (c) 2019 Jamf Open Source Community + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. */ #import diff --git a/CertificateSDK.framework/Info.plist b/CertificateSDK.framework/Info.plist index bbb6cb0..25e853a 100644 Binary files a/CertificateSDK.framework/Info.plist and b/CertificateSDK.framework/Info.plist differ diff --git a/CertificateSDK.framework/_CodeSignature/CodeResources b/CertificateSDK.framework/_CodeSignature/CodeResources new file mode 100644 index 0000000..addd299 --- /dev/null +++ b/CertificateSDK.framework/_CodeSignature/CodeResources @@ -0,0 +1,237 @@ + + + + + files + + Headers/CertificateRequestBase.h + + gAlLQb9Mg9BJDv37B+fcK6iM+R8= + + Headers/CertificateRequestDelegate.h + + t2Lu6hSmoIBisYLkyJnTrAcR00I= + + Headers/CertificateRequestEmbeddedP12.h + + M7Ng9rUqfKfHsQ6eX//YnCTHINo= + + Headers/CertificateRequestErrorDomain.h + + A2josM5GpTK0H4yKjgYtSD6/cc8= + + Headers/CertificateRequestProtocol.h + + HrrEFKkTzdEHw5IhTZ3L/f78kf0= + + Headers/CertificateRequestWorkflow.h + + 63BK/0w8Os5fG5hgXnd82Ejw+9o= + + Headers/CertificateSDK.h + + 4y2AaoAeQ5x/4WXK4Mobh9L4bfU= + + Info.plist + + gqYqAVcVLDt65oytZWWRd1VSvU4= + + Modules/module.modulemap + + Okt3WKgLOeLqLPPyFALrePQEDQs= + + ios-strip-framework.sh + + D/b1s3D5r7ky14btr01FXrFpTTU= + + + files2 + + Headers/CertificateRequestBase.h + + hash + + gAlLQb9Mg9BJDv37B+fcK6iM+R8= + + hash2 + + 9SthsHYJbXH/wFiS5K8Up5+Lj3HDjZAhb330mZWrdaM= + + + Headers/CertificateRequestDelegate.h + + hash + + t2Lu6hSmoIBisYLkyJnTrAcR00I= + + hash2 + + cDkVWcJZElnCD8D/Bcdnm3umMx88rFdLKhcx6dznqjc= + + + Headers/CertificateRequestEmbeddedP12.h + + hash + + M7Ng9rUqfKfHsQ6eX//YnCTHINo= + + hash2 + + AtWaWwISsYMSajZerCPstF4ox8B3jtoC7UHH/fi+sSs= + + + Headers/CertificateRequestErrorDomain.h + + hash + + A2josM5GpTK0H4yKjgYtSD6/cc8= + + hash2 + + pk/xL0cC4O271jkYhuMxWKEeLzPyf1v6uLZwdqEnMxs= + + + Headers/CertificateRequestProtocol.h + + hash + + HrrEFKkTzdEHw5IhTZ3L/f78kf0= + + hash2 + + D25n9//yO1XrrBcXNCBWr9abPdIKbWDAPB1JxhPwSI4= + + + Headers/CertificateRequestWorkflow.h + + hash + + 63BK/0w8Os5fG5hgXnd82Ejw+9o= + + hash2 + + WMpm1qSZ3eeF2InrHQMedBTJAo3pSTloo4WzPKry/4Y= + + + Headers/CertificateSDK.h + + hash + + 4y2AaoAeQ5x/4WXK4Mobh9L4bfU= + + hash2 + + BMnJETQFljB0Y0mlq/pPGHzOiYu/IXMTaAGSfan8vjo= + + + Modules/module.modulemap + + hash + + Okt3WKgLOeLqLPPyFALrePQEDQs= + + hash2 + + +w/0sYILFq3Jg+dPEjILJ4+6ryCSvZYk+XFyMbQKzzM= + + + ios-strip-framework.sh + + hash + + D/b1s3D5r7ky14btr01FXrFpTTU= + + hash2 + + 3rMm1fv/Fls5z7uLWeQqttpRo+vRzRMD3DH2E7Ysxvg= + + + + rules + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^.* + + ^.*\.lproj/ + + optional + + weight + 1000 + + ^.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Base\.lproj/ + + weight + 1010 + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/Integrating the Jamf Certificate SDK into Your iOS App.pdf b/Integrating the Jamf Certificate SDK into Your iOS App.pdf index 68639f7..a88804a 100644 Binary files a/Integrating the Jamf Certificate SDK into Your iOS App.pdf and b/Integrating the Jamf Certificate SDK into Your iOS App.pdf differ diff --git a/README.md b/README.md index 29ab809..6df47b3 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,6 @@ -# CertificateSDK -Get Certificates From Jamf Pro Into Your iOS Apps - ## Jamf Certificate SDK -#### Framework Architectures +###### Framework Architectures The included framework ships with two simulator architectures (i386 and x86_64) and two device architectures (armv7 and arm64). This allows third-party app developers to use the framework both in their own simulators @@ -19,9 +16,12 @@ this. #### Managed App Config Required Settings -To ensure proper use of the SDK, the iOS app is required to be distributed by Jamf Pro. During distribution, an App Configuration can be specified that will let the SDK communicate with Jamf Pro and request the proper certificate. Here is a sample App Configuration that can be used as a basis for your own app. +To ensure proper use of the SDK, the iOS app is required to be distributed by Jamf Pro. During distribution, an App Configuration +can be specified that will let the SDK communicate with Jamf Pro and request the proper certificate. Here is a sample App Configuration +that can be used as a basis for your own app. -####### Note: You can add your own key/value pairs to the App Configuration to configure other parts of your app. Jamf's keys are all prefixed with `com.jamf.config.` so they will not clash with your own naming conventions for keys. +*Note that you can add your own key/value pairs to the App Configuration to configure other parts of your app.* Jamf's keys are all prefixed +with `com.jamf.config.` so they will not clash with your own naming conventions for keys. com.jamf.config.jamfpro.invitation @@ -29,27 +29,26 @@ To ensure proper use of the SDK, the iOS app is required to be distributed by Ja com.jamf.config.device.udid $UDID com.jamf.config.jamfpro.url - https://qpzpaot.kube.jamf.build/ + https://the_jamf_pro_server_url_goes_here/ com.jamf.config.certificate-request.pkiId 1 com.jamf.config.certificate-request.template - blah + User2 com.jamf.config.certificate-request.subject cn=something com.jamf.config.certificate-request.sanType rfc822Name com.jamf.config.certificate-request.sanValue - $EMAIL - com.jamf.config.certificate-request.signature - $JAMF_SIGNATURE_com.jamf.config.certificate-request + somebody@example.com -#### MAC key discussion +###### MAC key discussion com.jamf.config.jamfpro.url: The value should be filled in with your Jamf Pro Server's URL. The keys prefixed with `com.jamf.config.certificate-request` are used during certificate generation. They will -be specific to your organization. You should confer with those responsible for Jamf Pro and your Certificate Authority to ensure the proper settings are configured for your app. +be specific to your organization. You should confer with those responsible for Jamf Pro and your Certificate Authority to ensure +the proper settings are configured for your app. * pkiId: (an integer but typed as string in the MAC) Jamf Pro ID of the PKI Integration/Certificate Authority to be used; find this in the Jamf Pro web UI at Settings > PKI Certificates > Your ADCS CA settings and then look in the URL bar for the number after "id=". You should have a URL something like "adcsSettings.html?id=3" @@ -58,4 +57,5 @@ web UI at Settings > PKI Certificates > Your ADCS CA settings and then look in t * sanType: (string) One of 'rfc822Name', 'dNSName', or 'uniformResourceIdentifier' * sanValue: (string) Subject Alternative Name to include in the certificate signing request -With the subject and sanValue fields, variable substitution is available as discussed under "Payload Variables for Mobile Device Configuration Profiles" at http://docs.jamf.com/jamf-pro/administrator-guide/Mobile_Device_Configuration_Profiles.html +With the subject and sanValue fields, variable substitution is available as discussed under "Payload Variables for Mobile Device Configuration Profiles" at +http://docs.jamf.com/jamf-pro/administrator-guide/Mobile_Device_Configuration_Profiles.html