I'm writing a task to access the OpenSSL binary. If I copy/paste the command without the single quote, then it works perfectly in terminal.
I keep pasting the quote into the command. Here is the code / error...
let keySizeValue = keySizes[keySizeChoice.indexOfSelectedItem]
task.launchPath = "/usr/bin/openssl"
task.arguments = ["req -new -newkey \(keySizeValue) -out ~/Desktop/Certs/MyNew.csr -keyout ~/Desktop/Certs/\(privateKeyText.stringValue).key -subj \"/C=US/ST=\(stateText.stringValue)/L=\(cityText.stringValue)/O=\(organizationText.stringValue)/OU=\(departmentText.stringValue)/CN=\(commonNameText.stringValue)\"", "\(privateKeyPassword)", "\(passwordVerify)"]
task.launch()
task.waitUntilExit()
I've defined my task and keySizes array above, however the error is
Openssl:Error: req -new -newkey rsa:2048 -out ~/Desktop/Certs/MyNew.csr -keyout ~/Desktop/Certs/a.key -subj "/C=US/ST=a/L=a/O=a/OU=a/CN=a"' is an invalid command
.
It could be that i'm using NSTask improperly, but i feel like this looks right. Anyone got a good suggestion :D