以下是我目前的情况:
let finalTask = Process()
var certArguments: [String]
certArguments = (["args"])
for i in CertificateInfo.intPaths {
certArguments.append(i)
}
certArguments += (["-argflag", "args"])
finalTask.launchPath = "/usr/bin/openssl"
finalTask.arguments = certArguments
let errorPipe = Pipe()
finalTask.standardError = errorPipe
finalTask.launch()
let data = errorPipe.fileHandleForReading.readDataToEndOfFile()
print("\(data) this is the data")
let error = NSString(data: data, encoding: String.Encoding.utf8.rawValue)
print("\(error!) this is the output")
finalTask.waitUntilExit()
finalTask.terminate()
到目前为止,我在数据调试行中获得了字节返回,但是当我尝试打印输出时没有返回任何内容。我得到了
382 bytes this is the data
unable to load private key
33962:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/evp/evp_enc.c:330:
33962:error:0906A065:PEM routines:PEM_do_header:bad decrypt:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-64.50.6/src/crypto/pem/pem_lib.c:428:
this is the output
任何人都知道为什么输出没有正确显示?任何帮助将不胜感激!