Cannot build with SPM
Leemur89 opened this issue · 1 comments
Leemur89 commented
Hello,
I'm migrating my project to Swift Package Manager, but there is an issue with SwiftyRSA during the build: it cannot find SecKeyEncrypt, SecKeyRawSign, SecKeyRawVerify and SecKeyDecrypt.
Here is the extract of my Package.swift
:
dependencies: [
.package(
url: "https://github.com/TakeScoop/SwiftyRSA.git",
from: "1.8.0"
)
]
And here is the error I'm getting when I run swift build
:
/Users/***/myProject/.build/checkouts/SwiftyRSA/Source/ClearMessage.swift:83:26: error: cannot find 'SecKeyEncrypt' in scope
let status = SecKeyEncrypt(key.reference, padding, chunkData, chunkData.count, &encryptedDataBuffer, &encryptedDataLength)
^~~~~~~~~~~~~
/Users/***/myProject/.build/checkouts/SwiftyRSA/Source/ClearMessage.swift:123:22: error: cannot find 'SecKeyRawSign' in scope
let status = SecKeyRawSign(key.reference, digestType.padding, digestBytes, digestBytes.count, &signatureBytes, &signatureDataLength)
^~~~~~~~~~~~~
/Users/***/myProject/.build/checkouts/SwiftyRSA/Source/ClearMessage.swift:150:22: error: cannot find 'SecKeyRawVerify' in scope
let status = SecKeyRawVerify(key.reference, digestType.padding, digestBytes, digestBytes.count, signatureBytes, signatureBytes.count)
^~~~~~~~~~~~~~~
/Users/***/myProject/.build/checkouts/SwiftyRSA/Source/EncryptedMessage.swift:46:26: error: cannot find 'SecKeyDecrypt' in scope
let status = SecKeyDecrypt(key.reference, padding, chunkData, idxEnd-idx, &decryptedDataBuffer, &decryptedDataLength)
^~~~~~~~~~~~~
Any help is appreciated
Thanks
Leemur89 commented
Nevermind, I figured it out: I had to perform the build for iOS (default was macOS)
In command line there are a lot of options to set, but from XCode it was pretty straightforward:
Product>Destination>Any iOS Device