Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Heimdall object and Encryption returning null #46

Open
croftt opened this issue Aug 29, 2016 · 3 comments
Open

Creating Heimdall object and Encryption returning null #46

croftt opened this issue Aug 29, 2016 · 3 comments

Comments

@croftt
Copy link

croftt commented Aug 29, 2016

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

@jorystiefel
Copy link
Collaborator

jorystiefel commented Aug 30, 2016

@croftt Are you by chance on Xcode 8 Beta? I'm having this issue on Xcode 8 but not 7.

obtainKeyData(...) returning null

@tcsdeveloperssc
Copy link

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

@hools
Copy link

hools commented Oct 19, 2016

adding Keychain sharing in app capabilities made problem go away (Xcode 8, Swift 3, iOS 10)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants