Post

Replies

Boosts

Views

Activity

Reply to how to set an identity and get a certificate CN from a pkcs12 file
Similarly, I try to use SecItemImport, passing in my data (as pkcs12Data parameter, same as in my post above) var inputFormat: SecExternalFormat = .formatPKCS12; var items : CFArray? let flags: SecItemImportExportFlags = SecItemImportExportFlags(rawValue: 0) var parameters = SecItemImportExportKeyParameters() parameters.accessRef = nil var itemType: SecExternalItemType = .itemTypeCertificate // Set import options let status = SecItemImport(pkcs12Data as CFData, nil, &inputFormat, &itemType, flags, &parameters, nil, // importKeychain &items) While this gives me proper errSecSuccess status, the items returned is empty, so I don't get any keychain items back.
Dec ’23
Reply to how to set an identity and get a certificate CN from a pkcs12 file
Hi Quinn, thanks so much for replying. I find the Apple documentation on all of this lacking, especially in regards to actual examples, and updates to reflect Swift. But I've seen a number of posts / responses from you, which are always quite helpful, so I'm glad that this post caught your eye. Yes, this is all on macOS (we will be working on iOS later). First, I'll say that I got around my issues by using OpenSSL. I'd prefer to not bring in a 3rd-party library, but I was stuck, so I used OpenSSL to convert the x509 string to a .der, and then I used SecIdentityCreateWithCertificate to create a certificate, and SecIdentityCreateWithCertificate to create my identity. That being said, I plan to get back to trying to get it working without OpenSSL, though I'm probably sidelining that for now (as I have other work to do :). So I will try various things you mention, but it might not be for a while. Regarding the macOS I'm testing on, I'm developing and testing on macOS 14.2.1 (but our minimum target is macOS 13), so I suppose if you think it's the bug you mentioned, it is still not fixed. Take care, David
Dec ’23
Reply to Can I access system logs from Swift (I want logs for previous runs of my application)
Thanks @eskimo - when you're talking about a reference to a bug, I assume you're referring to this comment you made: iOS has very limited facilities for reading the system log. Currently, an iOS app can only read entries created by that specific process, using .currentProcessIdentifier scope. This is annoying if, say, the app crashed and you want to know what it was doing before the crash. What you need is a way to get all log entries written by your app (r. 57880434) You mention iOS - I'm working on a mac app - I assume it's the same. Can you tell me where I can see the details of r. 57880434, so I can see what was mentioned (and if there are updates or suggestions)? Unfortunately I don't see any way to get access to older logs for my app. My app talks with a server, and the server can request logs for a specific date/time range ("give me logs from yesterday between 2 and 4pm"). David
Jan ’24
Reply to How to customize the selected row's color in a Table in SwiftUI
Thanks @sha921 . It's unfortunate that apple doesn't let you modify this color through code. One oddity that I am having is that the colors (light and dark) that I set in Xcode for the accent color are not the colors displayed. I set the accent color for light to #aec9f1, and for dark to #373c55. But when i run the app and select a row in my table, in light mode it is #95aed4, and in dark mode it is #1d2138 - totally not the colors I picked. I don't have any opacity set anywhere, so I can't figure out why the actual colors aren't what I specified. (If I don't have the AccentColor, I confirm that the selection goes back to the system blue). Any suggestions on what to check?
Mar ’24