Heimdall
Heimdall copied to clipboard
Creating Heimdall object and Encryption returning null
Hello,
I have been trying to use your library to create and use public keys from another device that is using the X509 protocol. However I was attempting to create a heimdall object with just a tag so that I could ensure that it works, i instantiated like so:
if let heimdall = Heimdall(publicTag: "com.1066203")
however it returns null, I tried different tags and only a few times could I actually create the object (could not decipher which ones worked because they would not work if ran again). However when I did create the object the encryption method also returned false, I tried to regenerate the key as well. implemented like so:
let testString = "This is a test string" heimdall.regenerate(1024)
// Encryption/Decryption
if let encryptedString = heimdall.encrypt(testString) {
print(encryptedString) // "cQzaQCQLhAWqkDyPoHnPrpsVh..."
if let decryptedString = heimdall.decrypt(encryptedString) {
print(decryptedString) // "This is a test string"
} else
{
print("did not decrypt")
}
} else
{
print("did not encrypt")
}
Using breakpoints and the debugger I narrowed it down to the method:
private class func obtainKeyData(tag: String) -> NSData?
always returning nil, and I could not figure out why that is the case. I am relatively new to iOS so hopefully I am just doing something wrong but if not i'd appreciate you taking a look and seeing what could be going wrong. If you would like any other information I will happily give it
@croftt Are you by chance on Xcode 8 Beta? I'm having this issue on Xcode 8 but not 7.
obtainKeyData(...)
returning null
I am not using the beta. But if I am the only one it is not working for I imagine I am doing something wrong so you should consider this low priority
adding Keychain sharing in app capabilities made problem go away (Xcode 8, Swift 3, iOS 10)