├── .gitignore ├── CocoaFob ├── CFUtil.swift ├── CocoaFobError.swift ├── CocoaFobLicGenerator.swift ├── CocoaFobLicVerifier.swift └── CocoaFobStringExt.swift ├── DropPy License Manager.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── DropPy License Manager ├── AppDelegate.swift ├── Assets.xcassets │ └── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── icon_rect_1024x1024@1x.png │ │ ├── icon_rect_128x128@1x.png │ │ ├── icon_rect_16x16@1x.png │ │ ├── icon_rect_256x256@1x-1.png │ │ ├── icon_rect_256x256@1x.png │ │ ├── icon_rect_32x32@1x-1.png │ │ ├── icon_rect_32x32@1x.png │ │ ├── icon_rect_512x512@1x-1.png │ │ ├── icon_rect_512x512@1x.png │ │ └── icon_rect_64x64@1x.png ├── Base.lproj │ └── Main.storyboard ├── DropPy_License_Manager.entitlements ├── Info.plist └── ViewController.swift ├── Images ├── icon_rect.psd └── logo_error.psd ├── Keys ├── dsaparam.pem ├── privkey.pem └── pubkey.pem ├── LICENSE ├── README.md ├── Resources └── cocoafob-master.zip └── screenshot.png /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData/ 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata/ 19 | 20 | ## Other 21 | *.moved-aside 22 | *.xccheckout 23 | *.xcscmblueprint 24 | 25 | ## Obj-C/Swift specific 26 | *.hmap 27 | *.ipa 28 | *.dSYM.zip 29 | *.dSYM 30 | 31 | ## Playgrounds 32 | timeline.xctimeline 33 | playground.xcworkspace 34 | 35 | # Swift Package Manager 36 | # 37 | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. 38 | # Packages/ 39 | # Package.pins 40 | # Package.resolved 41 | .build/ 42 | 43 | # CocoaPods 44 | # 45 | # We recommend against adding the Pods directory to your .gitignore. However 46 | # you should judge for yourself, the pros and cons are mentioned at: 47 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 48 | # 49 | # Pods/ 50 | 51 | # Carthage 52 | # 53 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 54 | # Carthage/Checkouts 55 | 56 | Carthage/Build 57 | 58 | # fastlane 59 | # 60 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 61 | # screenshots whenever they are needed. 62 | # For more information about the recommended setup visit: 63 | # https://docs.fastlane.tools/best-practices/source-control/#source-control 64 | 65 | fastlane/report.xml 66 | fastlane/Preview.html 67 | fastlane/screenshots/**/*.png 68 | fastlane/test_output 69 | -------------------------------------------------------------------------------- /CocoaFob/CFUtil.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CFUtil.swift 3 | // CocoaFob 4 | // 5 | // Created by Gleb Dolgich on 12/07/2015. 6 | // Copyright © 2015 PixelEspresso. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | func cfTry(_ err: CocoaFobError, cfBlock: (UnsafeMutablePointer?>) -> DarwinBoolean) throws { 12 | var cferr: Unmanaged? = nil 13 | if !cfBlock(&cferr).boolValue { 14 | if let cferr = cferr?.takeRetainedValue() { 15 | throw cferr 16 | } else { 17 | throw err 18 | } 19 | } 20 | } 21 | 22 | func cfTry(_ err: CocoaFobError, cfBlock: (UnsafeMutablePointer?>) -> T?) throws -> T { 23 | var cferr: Unmanaged? = nil 24 | if let result = cfBlock(&cferr) { 25 | return result 26 | } 27 | if let cferr = cferr?.takeRetainedValue() { 28 | throw cferr 29 | } else { 30 | throw err 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /CocoaFob/CocoaFobError.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaFobError.swift 3 | // CocoaFob 4 | // 5 | // Created by Gleb Dolgich on 05/07/2015. 6 | // Copyright © 2015 PixelEspresso. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | /** 12 | Custom error type: 13 | - Error: Unspecified error 14 | */ 15 | enum CocoaFobError: Error { 16 | case error 17 | } 18 | -------------------------------------------------------------------------------- /CocoaFob/CocoaFobLicGenerator.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaFobLicGenerator.swift 3 | // CocoaFob 4 | // 5 | // Created by Gleb Dolgich on 05/07/2015. 6 | // Copyright © 2015 PixelEspresso. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | @available(*, deprecated: 1.0, renamed: "LicenseGenerator") 12 | typealias CocoaFobLicGenerator = LicenseGenerator 13 | 14 | /** 15 | Generates CocoaFob registration keys 16 | */ 17 | public struct LicenseGenerator { 18 | 19 | var privKey: SecKey 20 | 21 | // MARK: - Initialization 22 | 23 | /** 24 | Initializes key generator with a private key in PEM format 25 | 26 | - parameter privateKeyPEM: String containing PEM representation of the private key 27 | */ 28 | public init?(privateKeyPEM: String) { 29 | let emptyString = "" as NSString 30 | let password = Unmanaged.passUnretained(emptyString as AnyObject) 31 | var params = SecItemImportExportKeyParameters( 32 | version: UInt32(bitPattern: SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION), 33 | flags: SecKeyImportExportFlags.importOnlyOne, 34 | passphrase: password, 35 | alertTitle: Unmanaged.passUnretained(emptyString), 36 | alertPrompt: Unmanaged.passUnretained(emptyString), 37 | accessRef: nil, 38 | keyUsage: nil, 39 | keyAttributes: nil) 40 | var keyFormat = SecExternalFormat.formatPEMSequence 41 | var keyType = SecExternalItemType.itemTypePrivateKey 42 | if let keyData = privateKeyPEM.data(using: String.Encoding.utf8) { 43 | // I fixed the following line using Xcode's recommendation: 44 | // Original: let keyBytes = unsafeBitCast((keyData as NSData).bytes, to: UnsafePointer.self) 45 | let keyBytes = (keyData as NSData).bytes.assumingMemoryBound(to: UInt8.self) 46 | let keyDataCF = CFDataCreate(nil, keyBytes, keyData.count)! 47 | var importArray: CFArray? = nil 48 | let osStatus = withUnsafeMutablePointer(to: &keyFormat, {pKeyFormat -> OSStatus in 49 | withUnsafeMutablePointer(to: &keyType, {pKeyType in 50 | SecItemImport(keyDataCF, nil, pKeyFormat, pKeyType, SecItemImportExportFlags(rawValue: 0), ¶ms, nil, &importArray) 51 | }) 52 | }) 53 | if osStatus != errSecSuccess || importArray == nil { 54 | return nil 55 | } 56 | let items = importArray! as NSArray 57 | if items.count >= 1 { 58 | self.privKey = items[0] as! SecKey 59 | } else { 60 | return nil 61 | } 62 | } else { 63 | return nil 64 | } 65 | } 66 | 67 | // MARK: - Key generation 68 | 69 | /** 70 | Generates registration key for a user name 71 | 72 | - parameter userName: User name for which to generate a registration key 73 | - returns: Registration key 74 | */ 75 | public func generate(_ name: String) throws -> String { 76 | guard name != "" else { throw CocoaFobError.error } 77 | if let nameData = getNameData(name), let signer = getSigner(nameData), let encoder = getEncoder(), let group = connectTransforms(signer, encoder: encoder) { 78 | let regData = try cfTry(CocoaFobError.error) { return SecTransformExecute(group, $0) } 79 | if let reg = NSString(data: regData as! Data, encoding: String.Encoding.utf8.rawValue) { 80 | return String(reg).cocoaFobToReadableKey() 81 | } else { 82 | throw CocoaFobError.error 83 | } 84 | } 85 | throw CocoaFobError.error 86 | } 87 | 88 | // MARK: - Utility functions 89 | 90 | fileprivate func connectTransforms(_ signer: SecTransform, encoder: SecTransform) -> SecGroupTransform? { 91 | if let groupTransform = getGroupTransform() { 92 | return SecTransformConnectTransforms(signer, kSecTransformOutputAttributeName, encoder, kSecTransformInputAttributeName, groupTransform, nil) 93 | } 94 | return nil 95 | } 96 | 97 | fileprivate func getGroupTransform() -> SecGroupTransform? { 98 | return SecTransformCreateGroupTransform() 99 | } 100 | 101 | func getNameData(_ name: String) -> Data? { 102 | return name.data(using: String.Encoding.utf8) 103 | } 104 | 105 | func getSigner(_ nameData: Data) -> SecTransform? { 106 | do { 107 | let signer = try cfTry(.error) { return SecSignTransformCreate(self.privKey, $0) } 108 | let _ = try cfTry(.error) { return SecTransformSetAttribute(signer, kSecTransformInputAttributeName, nameData as CFTypeRef, $0) } 109 | let _ = try cfTry(.error) { return SecTransformSetAttribute(signer, kSecDigestTypeAttribute, kSecDigestSHA1, $0) } 110 | return signer 111 | } catch { 112 | return nil 113 | } 114 | } 115 | 116 | fileprivate func getEncoder() -> SecTransform? { 117 | do { 118 | let encoder = try cfTry(.error) { return SecEncodeTransformCreate(kSecBase32Encoding, $0) } 119 | return encoder 120 | } catch { 121 | return nil 122 | } 123 | } 124 | 125 | } 126 | -------------------------------------------------------------------------------- /CocoaFob/CocoaFobLicVerifier.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaFobLicVerifier.swift 3 | // CocoaFob 4 | // 5 | // Created by Gleb Dolgich on 12/07/2015. 6 | // Copyright © 2015 PixelEspresso. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | @available(*, deprecated: 1.0, renamed: "LicenseVerifier") 12 | typealias CocoaFobLicVerifier = LicenseVerifier 13 | 14 | /** 15 | Verifies CocoaFob registration keys 16 | */ 17 | public struct LicenseVerifier { 18 | 19 | var pubKey: SecKey 20 | 21 | // MARK: - Initialization 22 | 23 | /** 24 | Initializes key verifier with a public key in PEM format 25 | 26 | - parameter publicKeyPEM: String containing PEM representation of the public key 27 | */ 28 | public init?(publicKeyPEM: String) { 29 | let emptyString = "" as NSString 30 | let password = Unmanaged.passUnretained(emptyString as AnyObject) 31 | var params = SecItemImportExportKeyParameters( 32 | version: UInt32(bitPattern: SEC_KEY_IMPORT_EXPORT_PARAMS_VERSION), 33 | flags: SecKeyImportExportFlags.importOnlyOne, 34 | passphrase: password, 35 | alertTitle: Unmanaged.passUnretained(emptyString), 36 | alertPrompt: Unmanaged.passUnretained(emptyString), 37 | accessRef: nil, 38 | keyUsage: nil, 39 | keyAttributes: nil) 40 | var keyFormat = SecExternalFormat.formatPEMSequence 41 | var keyType = SecExternalItemType.itemTypePublicKey 42 | if let keyData = publicKeyPEM.data(using: String.Encoding.utf8) { 43 | // I fixed the following line using Xcode's recommendation: 44 | // Original: let keyBytes = unsafeBitCast((keyData as NSData).bytes, to: UnsafePointer.self) 45 | let keyBytes = (keyData as NSData).bytes.assumingMemoryBound(to: UInt8.self) 46 | let keyDataCF = CFDataCreate(nil, keyBytes, keyData.count)! 47 | var importArray: CFArray? = nil 48 | let osStatus = withUnsafeMutablePointer(to: &keyFormat) {pKeyFormat in 49 | withUnsafeMutablePointer(to: &keyType, {pKeyType in 50 | SecItemImport(keyDataCF, nil, pKeyFormat, pKeyType, SecItemImportExportFlags(rawValue: 0), ¶ms, nil, &importArray) 51 | }) 52 | } 53 | if osStatus != errSecSuccess || importArray == nil { 54 | return nil 55 | } 56 | let items = importArray! as NSArray 57 | if items.count >= 1 { 58 | self.pubKey = items[0] as! SecKey 59 | } else { 60 | return nil 61 | } 62 | } else { 63 | return nil 64 | } 65 | } 66 | 67 | /** 68 | Verifies registration key against registered name. Doesn't throw since you are most likely not interested in the reason registration verification failed. 69 | 70 | - parameter regKey: Registration key string 71 | - parameter name: Registered name string 72 | - returns: `true` if the registration key is valid for the given name, `false` if not 73 | */ 74 | public func verify(_ regKey: String, forName name: String) -> Bool { 75 | do { 76 | if let keyData = regKey.cocoaFobFromReadableKey().data(using: String.Encoding.utf8), let nameData = name.data(using: String.Encoding.utf8) { 77 | let decoder = try getDecoder(keyData) 78 | let signature = try cfTry(.error) { SecTransformExecute(decoder, $0) } 79 | let verifier = try getVerifier(self.pubKey, signature: signature as! Data, nameData: nameData) 80 | let result = try cfTry(.error) { SecTransformExecute(verifier, $0) } 81 | let boolResult = result as! CFBoolean 82 | // I fixed the following line using Xcode's recommendation: 83 | // Original: return Bool(boolResult) 84 | return Bool(truncating: boolResult) 85 | } else { 86 | return false 87 | } 88 | } catch { 89 | return false 90 | } 91 | } 92 | 93 | // MARK: - Helper functions 94 | 95 | fileprivate func getDecoder(_ keyData: Data) throws -> SecTransform { 96 | let decoder = try cfTry(.error) { return SecDecodeTransformCreate(kSecBase32Encoding, $0) } 97 | let _ = try cfTry(.error) { return SecTransformSetAttribute(decoder, kSecTransformInputAttributeName, keyData as CFTypeRef, $0) } 98 | return decoder 99 | } 100 | 101 | fileprivate func getVerifier(_ publicKey: SecKey, signature: Data, nameData: Data) throws -> SecTransform { 102 | let verifier = try cfTry(.error) { return SecVerifyTransformCreate(publicKey, signature as CFData?, $0) } 103 | let _ = try cfTry(.error) { return SecTransformSetAttribute(verifier, kSecTransformInputAttributeName, nameData as CFTypeRef, $0) } 104 | let _ = try cfTry(.error) { return SecTransformSetAttribute(verifier, kSecDigestTypeAttribute, kSecDigestSHA1, $0) } 105 | return verifier 106 | } 107 | 108 | } 109 | -------------------------------------------------------------------------------- /CocoaFob/CocoaFobStringExt.swift: -------------------------------------------------------------------------------- 1 | // 2 | // CocoaFobStringExt.swift 3 | // CocoaFob 4 | // 5 | // Created by Gleb Dolgich on 12/07/2015. 6 | // Copyright © 2015 PixelEspresso. All rights reserved. 7 | // 8 | 9 | import Foundation 10 | 11 | extension String { 12 | 13 | /** 14 | Converts generated CocoaFob key to its human-readable form: 15 | - replaces Os with 8s and Is with 9s 16 | - trims padding characters at the end 17 | - inserts dashes every 5 characters 18 | 19 | - returns: Human-readable registration key 20 | */ 21 | func cocoaFobToReadableKey() -> String { 22 | let replacedOwith8 = self.replacingOccurrences(of: "O", with: "8") 23 | let replacedIwith9 = replacedOwith8.replacingOccurrences(of: "I", with: "9") 24 | var key = replacedIwith9.replacingOccurrences(of: "=", with: "") 25 | 26 | var index = 5 27 | while index < key.utf8.count { 28 | key.insert(contentsOf: ["-"], at: key.index(key.startIndex, offsetBy: index)) 29 | index += 6 30 | } 31 | 32 | return key 33 | } 34 | 35 | /** 36 | Reverses readability changes to a supplied key: 37 | - removes dashes 38 | - replaces 9s with Is and 8s with Os 39 | 40 | - returns: Compacted key ready for verification 41 | */ 42 | func cocoaFobFromReadableKey() -> String { 43 | let replaced9withI = self.replacingOccurrences(of: "9", with: "I") 44 | let replaced8withO = replaced9withI.replacingOccurrences(of: "8", with: "O") 45 | let key = replaced8withO.replacingOccurrences(of: "-", with: "") 46 | return key 47 | } 48 | 49 | } 50 | -------------------------------------------------------------------------------- /DropPy License Manager.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | A49EBAB71F738C410028DDAD /* CFUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B9C5371F73880000B990A7 /* CFUtil.swift */; }; 11 | A49EBAB81F738C410028DDAD /* CocoaFobError.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B9C5381F73880000B990A7 /* CocoaFobError.swift */; }; 12 | A49EBAB91F738C410028DDAD /* CocoaFobLicGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B9C5361F73880000B990A7 /* CocoaFobLicGenerator.swift */; }; 13 | A49EBABA1F738C410028DDAD /* CocoaFobLicVerifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B9C53A1F73880000B990A7 /* CocoaFobLicVerifier.swift */; }; 14 | A49EBABB1F738C410028DDAD /* CocoaFobStringExt.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B9C5391F73880000B990A7 /* CocoaFobStringExt.swift */; }; 15 | A4B9C5261F7384F000B990A7 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B9C5251F7384F000B990A7 /* AppDelegate.swift */; }; 16 | A4B9C5281F7384F000B990A7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A4B9C5271F7384F000B990A7 /* ViewController.swift */; }; 17 | A4B9C52A1F7384F000B990A7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = A4B9C5291F7384F000B990A7 /* Assets.xcassets */; }; 18 | A4B9C52D1F7384F000B990A7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A4B9C52B1F7384F000B990A7 /* Main.storyboard */; }; 19 | /* End PBXBuildFile section */ 20 | 21 | /* Begin PBXFileReference section */ 22 | A4B9C5221F7384F000B990A7 /* DropPy License Manager.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "DropPy License Manager.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 23 | A4B9C5251F7384F000B990A7 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 24 | A4B9C5271F7384F000B990A7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 25 | A4B9C5291F7384F000B990A7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | A4B9C52C1F7384F000B990A7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 27 | A4B9C52E1F7384F000B990A7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | A4B9C52F1F7384F000B990A7 /* DropPy_License_Manager.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DropPy_License_Manager.entitlements; sourceTree = ""; }; 29 | A4B9C5361F73880000B990A7 /* CocoaFobLicGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CocoaFobLicGenerator.swift; sourceTree = ""; }; 30 | A4B9C5371F73880000B990A7 /* CFUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CFUtil.swift; sourceTree = ""; }; 31 | A4B9C5381F73880000B990A7 /* CocoaFobError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CocoaFobError.swift; sourceTree = ""; }; 32 | A4B9C5391F73880000B990A7 /* CocoaFobStringExt.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CocoaFobStringExt.swift; sourceTree = ""; }; 33 | A4B9C53A1F73880000B990A7 /* CocoaFobLicVerifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CocoaFobLicVerifier.swift; sourceTree = ""; }; 34 | /* End PBXFileReference section */ 35 | 36 | /* Begin PBXFrameworksBuildPhase section */ 37 | A4B9C51F1F7384F000B990A7 /* Frameworks */ = { 38 | isa = PBXFrameworksBuildPhase; 39 | buildActionMask = 2147483647; 40 | files = ( 41 | ); 42 | runOnlyForDeploymentPostprocessing = 0; 43 | }; 44 | /* End PBXFrameworksBuildPhase section */ 45 | 46 | /* Begin PBXGroup section */ 47 | A4B9C5191F7384F000B990A7 = { 48 | isa = PBXGroup; 49 | children = ( 50 | A4B9C5241F7384F000B990A7 /* DropPy License Manager */, 51 | A4B9C5351F73857A00B990A7 /* CocoaFob */, 52 | A4B9C5231F7384F000B990A7 /* Products */, 53 | ); 54 | sourceTree = ""; 55 | }; 56 | A4B9C5231F7384F000B990A7 /* Products */ = { 57 | isa = PBXGroup; 58 | children = ( 59 | A4B9C5221F7384F000B990A7 /* DropPy License Manager.app */, 60 | ); 61 | name = Products; 62 | sourceTree = ""; 63 | }; 64 | A4B9C5241F7384F000B990A7 /* DropPy License Manager */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | A4B9C5251F7384F000B990A7 /* AppDelegate.swift */, 68 | A4B9C5271F7384F000B990A7 /* ViewController.swift */, 69 | A4B9C5291F7384F000B990A7 /* Assets.xcassets */, 70 | A4B9C52B1F7384F000B990A7 /* Main.storyboard */, 71 | A4B9C52E1F7384F000B990A7 /* Info.plist */, 72 | A4B9C52F1F7384F000B990A7 /* DropPy_License_Manager.entitlements */, 73 | ); 74 | path = "DropPy License Manager"; 75 | sourceTree = ""; 76 | }; 77 | A4B9C5351F73857A00B990A7 /* CocoaFob */ = { 78 | isa = PBXGroup; 79 | children = ( 80 | A4B9C5371F73880000B990A7 /* CFUtil.swift */, 81 | A4B9C5381F73880000B990A7 /* CocoaFobError.swift */, 82 | A4B9C5361F73880000B990A7 /* CocoaFobLicGenerator.swift */, 83 | A4B9C53A1F73880000B990A7 /* CocoaFobLicVerifier.swift */, 84 | A4B9C5391F73880000B990A7 /* CocoaFobStringExt.swift */, 85 | ); 86 | path = CocoaFob; 87 | sourceTree = ""; 88 | }; 89 | /* End PBXGroup section */ 90 | 91 | /* Begin PBXNativeTarget section */ 92 | A4B9C5211F7384F000B990A7 /* DropPy License Manager */ = { 93 | isa = PBXNativeTarget; 94 | buildConfigurationList = A4B9C5321F7384F000B990A7 /* Build configuration list for PBXNativeTarget "DropPy License Manager" */; 95 | buildPhases = ( 96 | A4B9C51E1F7384F000B990A7 /* Sources */, 97 | A4B9C51F1F7384F000B990A7 /* Frameworks */, 98 | A4B9C5201F7384F000B990A7 /* Resources */, 99 | ); 100 | buildRules = ( 101 | ); 102 | dependencies = ( 103 | ); 104 | name = "DropPy License Manager"; 105 | productName = "DropPy License Manager"; 106 | productReference = A4B9C5221F7384F000B990A7 /* DropPy License Manager.app */; 107 | productType = "com.apple.product-type.application"; 108 | }; 109 | /* End PBXNativeTarget section */ 110 | 111 | /* Begin PBXProject section */ 112 | A4B9C51A1F7384F000B990A7 /* Project object */ = { 113 | isa = PBXProject; 114 | attributes = { 115 | LastSwiftUpdateCheck = 0900; 116 | LastUpgradeCheck = 0930; 117 | ORGANIZATIONNAME = "Günther Eberl"; 118 | TargetAttributes = { 119 | A4B9C5211F7384F000B990A7 = { 120 | CreatedOnToolsVersion = 9.0; 121 | ProvisioningStyle = Automatic; 122 | SystemCapabilities = { 123 | com.apple.Sandbox = { 124 | enabled = 0; 125 | }; 126 | }; 127 | }; 128 | }; 129 | }; 130 | buildConfigurationList = A4B9C51D1F7384F000B990A7 /* Build configuration list for PBXProject "DropPy License Manager" */; 131 | compatibilityVersion = "Xcode 8.0"; 132 | developmentRegion = en; 133 | hasScannedForEncodings = 0; 134 | knownRegions = ( 135 | en, 136 | Base, 137 | ); 138 | mainGroup = A4B9C5191F7384F000B990A7; 139 | productRefGroup = A4B9C5231F7384F000B990A7 /* Products */; 140 | projectDirPath = ""; 141 | projectRoot = ""; 142 | targets = ( 143 | A4B9C5211F7384F000B990A7 /* DropPy License Manager */, 144 | ); 145 | }; 146 | /* End PBXProject section */ 147 | 148 | /* Begin PBXResourcesBuildPhase section */ 149 | A4B9C5201F7384F000B990A7 /* Resources */ = { 150 | isa = PBXResourcesBuildPhase; 151 | buildActionMask = 2147483647; 152 | files = ( 153 | A4B9C52A1F7384F000B990A7 /* Assets.xcassets in Resources */, 154 | A4B9C52D1F7384F000B990A7 /* Main.storyboard in Resources */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXResourcesBuildPhase section */ 159 | 160 | /* Begin PBXSourcesBuildPhase section */ 161 | A4B9C51E1F7384F000B990A7 /* Sources */ = { 162 | isa = PBXSourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | A49EBAB71F738C410028DDAD /* CFUtil.swift in Sources */, 166 | A49EBAB81F738C410028DDAD /* CocoaFobError.swift in Sources */, 167 | A49EBAB91F738C410028DDAD /* CocoaFobLicGenerator.swift in Sources */, 168 | A49EBABA1F738C410028DDAD /* CocoaFobLicVerifier.swift in Sources */, 169 | A49EBABB1F738C410028DDAD /* CocoaFobStringExt.swift in Sources */, 170 | A4B9C5281F7384F000B990A7 /* ViewController.swift in Sources */, 171 | A4B9C5261F7384F000B990A7 /* AppDelegate.swift in Sources */, 172 | ); 173 | runOnlyForDeploymentPostprocessing = 0; 174 | }; 175 | /* End PBXSourcesBuildPhase section */ 176 | 177 | /* Begin PBXVariantGroup section */ 178 | A4B9C52B1F7384F000B990A7 /* Main.storyboard */ = { 179 | isa = PBXVariantGroup; 180 | children = ( 181 | A4B9C52C1F7384F000B990A7 /* Base */, 182 | ); 183 | name = Main.storyboard; 184 | sourceTree = ""; 185 | }; 186 | /* End PBXVariantGroup section */ 187 | 188 | /* Begin XCBuildConfiguration section */ 189 | A4B9C5301F7384F000B990A7 /* Debug */ = { 190 | isa = XCBuildConfiguration; 191 | buildSettings = { 192 | ALWAYS_SEARCH_USER_PATHS = NO; 193 | CLANG_ANALYZER_NONNULL = YES; 194 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 195 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 196 | CLANG_CXX_LIBRARY = "libc++"; 197 | CLANG_ENABLE_MODULES = YES; 198 | CLANG_ENABLE_OBJC_ARC = YES; 199 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 200 | CLANG_WARN_BOOL_CONVERSION = YES; 201 | CLANG_WARN_COMMA = YES; 202 | CLANG_WARN_CONSTANT_CONVERSION = YES; 203 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 204 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 205 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 206 | CLANG_WARN_EMPTY_BODY = YES; 207 | CLANG_WARN_ENUM_CONVERSION = YES; 208 | CLANG_WARN_INFINITE_RECURSION = YES; 209 | CLANG_WARN_INT_CONVERSION = YES; 210 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 211 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 212 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 213 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 214 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 215 | CLANG_WARN_STRICT_PROTOTYPES = YES; 216 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 217 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 218 | CLANG_WARN_UNREACHABLE_CODE = YES; 219 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 220 | CODE_SIGN_IDENTITY = "Mac Developer"; 221 | COPY_PHASE_STRIP = NO; 222 | DEBUG_INFORMATION_FORMAT = dwarf; 223 | ENABLE_STRICT_OBJC_MSGSEND = YES; 224 | ENABLE_TESTABILITY = YES; 225 | GCC_C_LANGUAGE_STANDARD = gnu11; 226 | GCC_DYNAMIC_NO_PIC = NO; 227 | GCC_NO_COMMON_BLOCKS = YES; 228 | GCC_OPTIMIZATION_LEVEL = 0; 229 | GCC_PREPROCESSOR_DEFINITIONS = ( 230 | "DEBUG=1", 231 | "$(inherited)", 232 | ); 233 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 234 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 235 | GCC_WARN_UNDECLARED_SELECTOR = YES; 236 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 237 | GCC_WARN_UNUSED_FUNCTION = YES; 238 | GCC_WARN_UNUSED_VARIABLE = YES; 239 | MACOSX_DEPLOYMENT_TARGET = 10.12; 240 | MTL_ENABLE_DEBUG_INFO = YES; 241 | ONLY_ACTIVE_ARCH = YES; 242 | SDKROOT = macosx; 243 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 244 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 245 | }; 246 | name = Debug; 247 | }; 248 | A4B9C5311F7384F000B990A7 /* Release */ = { 249 | isa = XCBuildConfiguration; 250 | buildSettings = { 251 | ALWAYS_SEARCH_USER_PATHS = NO; 252 | CLANG_ANALYZER_NONNULL = YES; 253 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 254 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 255 | CLANG_CXX_LIBRARY = "libc++"; 256 | CLANG_ENABLE_MODULES = YES; 257 | CLANG_ENABLE_OBJC_ARC = YES; 258 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 259 | CLANG_WARN_BOOL_CONVERSION = YES; 260 | CLANG_WARN_COMMA = YES; 261 | CLANG_WARN_CONSTANT_CONVERSION = YES; 262 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 263 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 264 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 265 | CLANG_WARN_EMPTY_BODY = YES; 266 | CLANG_WARN_ENUM_CONVERSION = YES; 267 | CLANG_WARN_INFINITE_RECURSION = YES; 268 | CLANG_WARN_INT_CONVERSION = YES; 269 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 270 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 271 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 272 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 273 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 274 | CLANG_WARN_STRICT_PROTOTYPES = YES; 275 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 276 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 277 | CLANG_WARN_UNREACHABLE_CODE = YES; 278 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 279 | CODE_SIGN_IDENTITY = "Mac Developer"; 280 | COPY_PHASE_STRIP = NO; 281 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 282 | ENABLE_NS_ASSERTIONS = NO; 283 | ENABLE_STRICT_OBJC_MSGSEND = YES; 284 | GCC_C_LANGUAGE_STANDARD = gnu11; 285 | GCC_NO_COMMON_BLOCKS = YES; 286 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 287 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 288 | GCC_WARN_UNDECLARED_SELECTOR = YES; 289 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 290 | GCC_WARN_UNUSED_FUNCTION = YES; 291 | GCC_WARN_UNUSED_VARIABLE = YES; 292 | MACOSX_DEPLOYMENT_TARGET = 10.12; 293 | MTL_ENABLE_DEBUG_INFO = NO; 294 | SDKROOT = macosx; 295 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 296 | }; 297 | name = Release; 298 | }; 299 | A4B9C5331F7384F000B990A7 /* Debug */ = { 300 | isa = XCBuildConfiguration; 301 | buildSettings = { 302 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 303 | CODE_SIGN_STYLE = Automatic; 304 | COMBINE_HIDPI_IMAGES = YES; 305 | DEVELOPMENT_TEAM = QEZ83PUW72; 306 | INFOPLIST_FILE = "DropPy License Manager/Info.plist"; 307 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 308 | MACOSX_DEPLOYMENT_TARGET = 10.12; 309 | PRODUCT_BUNDLE_IDENTIFIER = "com.eberl.DropPy-License-Manager"; 310 | PRODUCT_NAME = "$(TARGET_NAME)"; 311 | SWIFT_VERSION = 4.0; 312 | }; 313 | name = Debug; 314 | }; 315 | A4B9C5341F7384F000B990A7 /* Release */ = { 316 | isa = XCBuildConfiguration; 317 | buildSettings = { 318 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 319 | CODE_SIGN_STYLE = Automatic; 320 | COMBINE_HIDPI_IMAGES = YES; 321 | DEVELOPMENT_TEAM = QEZ83PUW72; 322 | INFOPLIST_FILE = "DropPy License Manager/Info.plist"; 323 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 324 | MACOSX_DEPLOYMENT_TARGET = 10.12; 325 | PRODUCT_BUNDLE_IDENTIFIER = "com.eberl.DropPy-License-Manager"; 326 | PRODUCT_NAME = "$(TARGET_NAME)"; 327 | SWIFT_VERSION = 4.0; 328 | }; 329 | name = Release; 330 | }; 331 | /* End XCBuildConfiguration section */ 332 | 333 | /* Begin XCConfigurationList section */ 334 | A4B9C51D1F7384F000B990A7 /* Build configuration list for PBXProject "DropPy License Manager" */ = { 335 | isa = XCConfigurationList; 336 | buildConfigurations = ( 337 | A4B9C5301F7384F000B990A7 /* Debug */, 338 | A4B9C5311F7384F000B990A7 /* Release */, 339 | ); 340 | defaultConfigurationIsVisible = 0; 341 | defaultConfigurationName = Release; 342 | }; 343 | A4B9C5321F7384F000B990A7 /* Build configuration list for PBXNativeTarget "DropPy License Manager" */ = { 344 | isa = XCConfigurationList; 345 | buildConfigurations = ( 346 | A4B9C5331F7384F000B990A7 /* Debug */, 347 | A4B9C5341F7384F000B990A7 /* Release */, 348 | ); 349 | defaultConfigurationIsVisible = 0; 350 | defaultConfigurationName = Release; 351 | }; 352 | /* End XCConfigurationList section */ 353 | }; 354 | rootObject = A4B9C51A1F7384F000B990A7 /* Project object */; 355 | } 356 | -------------------------------------------------------------------------------- /DropPy License Manager.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DropPy License Manager.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /DropPy License Manager/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.swift 3 | // DropPy License Manager 4 | // 5 | // Created by Günther Eberl on 21.09.17. 6 | // Copyright © 2017 Günther Eberl. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | @NSApplicationMain 12 | class AppDelegate: NSObject, NSApplicationDelegate { 13 | func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool { 14 | return true 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /DropPy License Manager/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "16x16", 5 | "idiom" : "mac", 6 | "filename" : "icon_rect_16x16@1x.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "16x16", 11 | "idiom" : "mac", 12 | "filename" : "icon_rect_32x32@1x.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "32x32", 17 | "idiom" : "mac", 18 | "filename" : "icon_rect_32x32@1x-1.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "32x32", 23 | "idiom" : "mac", 24 | "filename" : "icon_rect_64x64@1x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "128x128", 29 | "idiom" : "mac", 30 | "filename" : "icon_rect_128x128@1x.png", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "size" : "128x128", 35 | "idiom" : "mac", 36 | "filename" : "icon_rect_256x256@1x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "256x256", 41 | "idiom" : "mac", 42 | "filename" : "icon_rect_256x256@1x-1.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "256x256", 47 | "idiom" : "mac", 48 | "filename" : "icon_rect_512x512@1x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "512x512", 53 | "idiom" : "mac", 54 | "filename" : "icon_rect_512x512@1x-1.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "512x512", 59 | "idiom" : "mac", 60 | "filename" : "icon_rect_1024x1024@1x.png", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_1024x1024@1x.png -------------------------------------------------------------------------------- /DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_128x128@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_128x128@1x.png -------------------------------------------------------------------------------- /DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_16x16@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_16x16@1x.png -------------------------------------------------------------------------------- /DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_256x256@1x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_256x256@1x-1.png -------------------------------------------------------------------------------- /DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_256x256@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_256x256@1x.png -------------------------------------------------------------------------------- /DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_32x32@1x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_32x32@1x-1.png -------------------------------------------------------------------------------- /DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_32x32@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_32x32@1x.png -------------------------------------------------------------------------------- /DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_512x512@1x-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_512x512@1x-1.png -------------------------------------------------------------------------------- /DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_512x512@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_512x512@1x.png -------------------------------------------------------------------------------- /DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_64x64@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/DropPy License Manager/Assets.xcassets/AppIcon.appiconset/icon_rect_64x64@1x.png -------------------------------------------------------------------------------- /DropPy License Manager/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 459 | 460 | 461 | 462 | 463 | 464 | 465 | 466 | 467 | 468 | 469 | 470 | 471 | 472 | 473 | 474 | 475 | 476 | 477 | 478 | 479 | 480 | 481 | 482 | 483 | 484 | 485 | 486 | 487 | 488 | 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 | 499 | 500 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 509 | 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 | 522 | 523 | 524 | 525 | 526 | 527 | 528 | 529 | 530 | Default 531 | 532 | 533 | 534 | 535 | 536 | 537 | Left to Right 538 | 539 | 540 | 541 | 542 | 543 | 544 | Right to Left 545 | 546 | 547 | 548 | 549 | 550 | 551 | 552 | 553 | 554 | 555 | Default 556 | 557 | 558 | 559 | 560 | 561 | 562 | Left to Right 563 | 564 | 565 | 566 | 567 | 568 | 569 | Right to Left 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | 583 | 584 | 585 | 586 | 587 | 588 | 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 | 603 | 604 | 605 | 606 | 607 | 608 | 609 | 610 | 611 | 612 | 613 | 614 | 615 | 616 | 617 | 618 | 619 | 620 | 621 | 622 | 623 | 624 | 625 | 626 | 627 | 628 | 629 | 630 | 631 | 632 | 633 | 634 | 635 | 636 | 637 | 638 | 639 | 640 | 641 | 642 | 643 | 644 | 645 | 646 | 647 | 648 | 649 | 650 | 651 | 652 | 653 | 654 | 655 | 656 | 657 | 658 | 659 | 660 | 661 | 662 | 663 | 664 | 665 | 666 | 667 | 668 | 669 | 670 | 671 | 672 | 673 | 674 | 675 | 676 | 677 | 678 | 679 | 680 | 681 | 682 | 683 | 684 | 685 | 686 | 687 | 688 | 689 | 690 | 691 | 692 | 693 | 694 | 695 | 696 | 697 | 698 | 699 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 725 | 726 | 727 | 728 | 729 | 730 | 731 | 732 | 733 | 734 | 735 | 736 | 737 | 738 | 739 | 740 | 741 | 742 | 743 | 744 | 745 | 746 | 747 | 748 | 749 | 750 | 751 | 752 | 753 | 754 | 755 | 756 | 757 | 758 | 759 | 760 | 761 | 762 | 763 | 764 | 765 | 766 | 767 | 768 | 769 | 770 | 771 | 772 | 773 | 774 | 775 | 776 | 777 | 778 | 779 | 780 | 781 | 782 | 783 | 784 | 785 | 786 | 787 | 788 | 789 | 790 | 791 | 792 | 793 | 794 | 795 | 796 | 797 | 798 | 799 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 823 | 834 | 835 | 836 | 837 | 838 | 839 | 840 | 841 | 842 | 843 | 844 | 845 | 846 | 847 | 848 | 849 | 850 | 851 | 852 | 853 | 854 | 855 | 856 | 857 | 858 | 859 | 860 | 861 | 862 | 863 | 864 | 865 | 866 | 867 | 868 | 869 | 870 | -------------------------------------------------------------------------------- /DropPy License Manager/DropPy_License_Manager.entitlements: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | com.apple.security.app-sandbox 6 | 7 | com.apple.security.files.user-selected.read-only 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /DropPy License Manager/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleVersion 22 | 1.0 23 | LSApplicationCategoryType 24 | public.app-category.developer-tools 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSHumanReadableCopyright 28 | Copyright © 2018 Günther Eberl. All rights reserved. 29 | NSMainStoryboardFile 30 | Main 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /DropPy License Manager/ViewController.swift: -------------------------------------------------------------------------------- 1 | // 2 | // ViewController.swift 3 | // DropPy License Manager 4 | // 5 | // Created by Günther Eberl on 21.09.17. 6 | // Copyright © 2017 Günther Eberl. All rights reserved. 7 | // 8 | 9 | import Cocoa 10 | 11 | class ViewController: NSViewController { 12 | 13 | @IBOutlet weak var productTextField: NSTextField! 14 | @IBOutlet weak var nameTextField: NSTextField! 15 | @IBOutlet weak var companyTextField: NSTextField! 16 | @IBOutlet weak var emailTextField: NSTextField! 17 | @IBOutlet weak var licenseCodeTextField: NSTextField! 18 | @IBOutlet weak var regNameTextField: NSTextField! 19 | @IBOutlet weak var statusTextField: NSTextField! 20 | 21 | @IBAction func onGenerateButton(_ sender: NSButton) { 22 | let privateKey: String = self.privateKey() 23 | let regName: String = self.getRegName() 24 | var licenseCode: String? = nil 25 | 26 | if let generator = generatorWithPrivateKey(privateKey) { 27 | do { 28 | try licenseCode = generator.generate(regName) 29 | licenseCodeTextField.stringValue = licenseCode! 30 | statusTextField.stringValue = "License Code generated" 31 | } catch { 32 | statusTextField.stringValue = "Error: Unable to generating license code." 33 | } 34 | } else { 35 | statusTextField.stringValue = "Error: LicenseGenerator could not be constructed." 36 | } 37 | } 38 | 39 | @IBAction func onValidateButton(_ sender: NSButton) { 40 | let publicKey: String = self.publicKey() 41 | let regName: String = self.getRegName() 42 | let licenseCode: String = self.licenseCodeTextField.stringValue 43 | var validLicense: Bool = false 44 | 45 | if let verifier = verifierWithPublicKey(publicKey) { 46 | validLicense = verifier.verify(licenseCode, forName: regName) 47 | } else { 48 | statusTextField.stringValue = "Error: LicenseVerifier could not be constructed." 49 | } 50 | 51 | if validLicense { 52 | statusTextField.stringValue = "License Code VALID" 53 | } else { 54 | statusTextField.stringValue = "License Code INVALID" 55 | } 56 | } 57 | 58 | func getRegName() -> String { 59 | let product: String = self.productTextField.stringValue // needed so a user doesn't get a license code that works on all your product when he buys one 60 | let name: String = self.nameTextField.stringValue 61 | let email: String = self.emailTextField.stringValue 62 | let company: String = self.companyTextField.stringValue 63 | let regName = product + "|" + name + "|" + email + "|" + company 64 | self.regNameTextField.stringValue = regName 65 | return regName 66 | } 67 | 68 | fileprivate func publicKey() -> String { 69 | var parts = [String]() 70 | parts.append("-----BEGIN PUBLIC KEY-----\n") 71 | parts.append("MIHwMIGoBgcqhkjOOAQBMIGcAkEA0na+2HrZFpHgSuPt3URJHdi1ZdYV\n") 72 | parts.append("LmynsU6hlJCc6ls1SEMAfvreHI2wjPLYsp/uGdry80fAfzJzc6sbAWAS\n") 73 | parts.append("WwIVAM8C9fTNlz2UG0s7cxBhwvZ/YQ2TAkAEq2QWgNT3PmjOBni47BF9\n") 74 | parts.append("z1BvfDihZgXapbTS/VoX2IRGPAqJD5z3n63DcP2/HR85OpAnh5EoJ2+A\n") 75 | parts.append("1KP+7PmPA0MAAkB6EewxQwgHzP57HuC2h1we7VxcsqoyiXofL9ADxSPf\n") 76 | parts.append("9CMfYDJVFgjiWGMEIui9a4GaPYl1EHPxilgYfDHJ0HtT\n") 77 | parts.append("-----END PUBLIC KEY-----\n") 78 | return parts.joined(separator: "") 79 | } 80 | 81 | fileprivate func privateKey() -> String { 82 | var parts = [String]() 83 | parts.append("-----BEGIN DSA PRIVATE KEY-----\n") 84 | parts.append("MIH4AgEAAkEA0na+2HrZFpHgSuPt3URJHdi1ZdYVLmynsU6hlJCc6ls1\n") 85 | parts.append("SEMAfvreHI2wjPLYsp/uGdry80fAfzJzc6sbAWASWwIVAM8C9fTNlz2U\n") 86 | parts.append("G0s7cxBhwvZ/YQ2TAkAEq2QWgNT3PmjOBni47BF9z1BvfDihZgXapbTS\n") 87 | parts.append("/VoX2IRGPAqJD5z3n63DcP2/HR85OpAnh5EoJ2+A1KP+7PmPAkB6Eewx\n") 88 | parts.append("QwgHzP57HuC2h1we7VxcsqoyiXofL9ADxSPf9CMfYDJVFgjiWGMEIui9\n") 89 | parts.append("a4GaPYl1EHPxilgYfDHJ0HtTAhUAsWZBduv3aFnYiRBii/R2CXQhoTg=\n") 90 | parts.append("-----END DSA PRIVATE KEY-----\n") 91 | return parts.joined(separator: "") 92 | } 93 | 94 | fileprivate func verifierWithPublicKey(_ publicKey: String) -> LicenseVerifier? { 95 | return LicenseVerifier(publicKeyPEM: publicKey) 96 | } 97 | 98 | fileprivate func generatorWithPrivateKey(_ privateKey: String) -> LicenseGenerator? { 99 | return LicenseGenerator(privateKeyPEM: privateKey) 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /Images/icon_rect.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/Images/icon_rect.psd -------------------------------------------------------------------------------- /Images/logo_error.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/Images/logo_error.psd -------------------------------------------------------------------------------- /Keys/dsaparam.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PARAMETERS----- 2 | MIGcAkEA0na+2HrZFpHgSuPt3URJHdi1ZdYVLmynsU6hlJCc6ls1SEMAfvreHI2w 3 | jPLYsp/uGdry80fAfzJzc6sbAWASWwIVAM8C9fTNlz2UG0s7cxBhwvZ/YQ2TAkAE 4 | q2QWgNT3PmjOBni47BF9z1BvfDihZgXapbTS/VoX2IRGPAqJD5z3n63DcP2/HR85 5 | OpAnh5EoJ2+A1KP+7PmP 6 | -----END DSA PARAMETERS----- 7 | -------------------------------------------------------------------------------- /Keys/privkey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN DSA PRIVATE KEY----- 2 | MIH4AgEAAkEA0na+2HrZFpHgSuPt3URJHdi1ZdYVLmynsU6hlJCc6ls1SEMAfvre 3 | HI2wjPLYsp/uGdry80fAfzJzc6sbAWASWwIVAM8C9fTNlz2UG0s7cxBhwvZ/YQ2T 4 | AkAEq2QWgNT3PmjOBni47BF9z1BvfDihZgXapbTS/VoX2IRGPAqJD5z3n63DcP2/ 5 | HR85OpAnh5EoJ2+A1KP+7PmPAkB6EewxQwgHzP57HuC2h1we7VxcsqoyiXofL9AD 6 | xSPf9CMfYDJVFgjiWGMEIui9a4GaPYl1EHPxilgYfDHJ0HtTAhUAsWZBduv3aFnY 7 | iRBii/R2CXQhoTg= 8 | -----END DSA PRIVATE KEY----- 9 | -------------------------------------------------------------------------------- /Keys/pubkey.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PUBLIC KEY----- 2 | MIHwMIGoBgcqhkjOOAQBMIGcAkEA0na+2HrZFpHgSuPt3URJHdi1ZdYVLmynsU6h 3 | lJCc6ls1SEMAfvreHI2wjPLYsp/uGdry80fAfzJzc6sbAWASWwIVAM8C9fTNlz2U 4 | G0s7cxBhwvZ/YQ2TAkAEq2QWgNT3PmjOBni47BF9z1BvfDihZgXapbTS/VoX2IRG 5 | PAqJD5z3n63DcP2/HR85OpAnh5EoJ2+A1KP+7PmPA0MAAkB6EewxQwgHzP57HuC2 6 | h1we7VxcsqoyiXofL9ADxSPf9CMfYDJVFgjiWGMEIui9a4GaPYl1EHPxilgYfDHJ 7 | 0HtT 8 | -----END PUBLIC KEY----- 9 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Günther Eberl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # License Manager 2 | 3 | *Generate and validate license keys.* 4 | 5 | ![screenshot](https://raw.githubusercontent.com/geberl/swift-license-manager/master/screenshot.png) 6 | 7 | ## Note 8 | 9 | This was originally written while [DropPy](https://github.com/geberl/swift-droppy) was a commercial app and [Fastspring](https://fastspring.com/) was used to purchase licenses. 10 | 11 | Now the app open source, so I don't need this any more. Feel free to use, probably generate your own DSA keys though. 12 | 13 | ## Generating DSA keys 14 | 15 | Info: 16 | 17 | - OpenSSL is already installed on macOS 18 | - These are 512bit DSA keys 19 | 20 | Ran the following commands in this order: 21 | 22 | - `openssl dsaparam -out dsaparam.pem 512` 23 | - `openssl gendsa -out privkey.pem dsaparam.pem` 24 | - `openssl dsa -in privkey.pem -pubout -out pubkey.pem` 25 | 26 | Documentation: 27 | 28 | - [https://github.com/glebd/cocoafob/readme.md]() 29 | - Section "Generating Keys" 30 | 31 | Came out with those three files: 32 | 33 | - dsaparam.pem 34 | - privkey.pem 35 | - pubkey.pem 36 | 37 | ## CocoaFob 38 | 39 | ### Version 40 | 41 | - Cloned the repo at [https://github.com/glebd/cocoafob]() on 2017-09-20 42 | - Not very active, the last commit was 2 years ago 43 | - Used the files from there (subfolder "swift3/CocoaFob") 44 | - A zip of the repo at that point in time is stored in "Resources" 45 | 46 | ### cocoafob-keygen 47 | 48 | - I could not get this to run on my machine (macOS 10.12, Xcode 9) 49 | - So I built my own version 50 | -------------------------------------------------------------------------------- /Resources/cocoafob-master.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/Resources/cocoafob-master.zip -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/geberl/swift-license-manager/34144277f516d3a3a97db2dab87fc1ec4237b96c/screenshot.png --------------------------------------------------------------------------------