Post

Replies

Boosts

Views

Activity

Creating new keychain for mac os app
I need to create a new keychain for my mac os app. Currently there is a function SecKeychainCreate in Appledocumentation. But this function will be deprecated in mac OS 12.0. Is there another way to create keychain using swift (without using terminal commands)? Or will mac provide new function for this in update? Anybody knows?
7
0
3.2k
Jul ’21
Storing Identity in keychain
I'm trying to add .pfx certificate to keychain which comes with password protection. So i decided to get identity from certificate and store it. I'm using system keychain to store identity.And program will run as root. if let password = CFStringCreateCopy(kCFAllocatorDefault, "something" as CFString) { let p12 = SecPKCS12Import(data as CFData, [kSecImportExportPassphrase as String: password] as CFDictionary, &cfarray) print(cfarray) if let identityArray = cfarray as? NSArray { if let identityDict = identityArray.object(at: 0) as? NSDictionary { let identityKey = String(kSecImportItemIdentity) let identity = identityDict[identityKey] as! SecIdentity let query: [String: Any] = [kSecClass as String: kSecClassIdentity, kSecValueRef as String: identity, kSecAttrLabel as String: "iddata", kSecUseKeychain as String: keychain, kSecImportExportPassphrase as String: password] let status = SecItemAdd(query as CFDictionary, nil) print(status) } } } When executing I'm getting -50 as output for print(status). I also tried with this query dictionary for SecItemAdd let query: [String: Any] = [kSecClass as String: kSecClassIdentity,kSecValueRef as String: identity,kSecAttrLabel as String: "iddata",kSecUseKeychain as String: keychain,kSecImportExportPassphrase as String: password] What is wrong with this? Please help
1
0
773
Jul ’21
LocationManager responds locationUnknown only
My macOS application is trying to fetch location, but everytime LocationManager responds with locationUnknown. Application is granted with permission to access location. Issue is seen in only one device with OSVersion: 14.2.1(23C71), chipset: Apple M1 pro. Other devices with same OS don't have this issue. My application is a background agent, means it has given UIElement in the plist. Issue persists even after restarting device, re-installing application, re-applying location permission. But Google Chrome shows correct location when using Openstreet Map or Google Maps. Is there any troubleshoot/alternative methods here? Any idea why it occurs? Code: if CLLocationManager.locationServicesEnabled() { if #available(OSX 10.14, *) { self.locationManager.requestLocation() } else { // Fallback on earlier versions self.locationManager.startUpdatingLocation() } } I need to get location in certain intervals. So After LocationManager updates I stop location with locationManager.stopUpdatingLocation() and request again after the interval.
0
0
542
Feb ’24
Notarization Failure. HTTP status code: 401
Iam trying to notarize with notarytool command with app-specific password. xcrun notarytool submit <Path> --apple-id <APPLE_ID> --password <APP_SPECIFIC_PASSWORD> --team-id <Team-ID> But it fails with error Error: HTTP status code: 401. Unable to authenticate. Invalid session. Ensure that all authentication arguments are correct. Tried generating new app-specific password, still failing. Tried storing password in keychain with store-credentials option, again failing. --verbose option with store-credentials showing below error This process stores your credentials securely in the Keychain. You reference these credentials later using a profile name. Validating your credentials... [06:05:28.854Z] Info [API] Initialized Notary API with base URL: https://appstoreconnect.apple.com/notary/v2/\ [06:05:28.854Z] Info [API] Preparing GET request to URL: https://appstoreconnect.apple.com/notary/v2/test?, Parameters: [:], Custom Headers: private<Dictionary<String, String>> [06:05:28.855Z] Debug [AUTHENTICATION] Delaying current request to refresh app-specific password token. [06:05:28.855Z] Info [API] Preparing GET request to URL: https://appstoreconnect.apple.com/notary/v2/asp?, Parameters: [:], Custom Headers: private<Dictionary<String, String>> [06:05:28.855Z] Debug [AUTHENTICATION] Authenticating request to '/notary/v2/asp' with Basic Auth. Username: , Password: private, Team ID: [06:05:28.856Z] Debug [TASKMANAGER] Starting Task Manager loop to wait for asynchronous HTTP calls. [06:05:30.194Z] Debug [API] Received response status code: 401, message: unauthorized, URL: https://appstoreconnect.apple.com/notary/v2/asp?, Correlation Key: [06:05:30.195Z] Error [TASKMANAGER] Completed Task with ID 2 has encountered an error. [06:05:30.195Z] Debug [TASKMANAGER]Ending Task Manager loop. Error: HTTP status code: 401. Unable to authenticate. Invalid session. Ensure that all authentication arguments are correct.
8
0
332
Nov ’24