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

the version 1.1.6 couldn't from password and keystore to get the privateKey #32

Closed
Li-Qun opened this issue Sep 13, 2018 · 4 comments
Closed

Comments

@Li-Qun
Copy link

Li-Qun commented Sep 13, 2018

1 month ago I downloaded the framework . It worked good. But these days I pod update, I find that the version 1.1.6 couldn't from password and keystore to get the privateKey and I don't know how to find the last version. I find the code is different in the file "CryptoExtensions.swift" from the old one.

Dear lovely writer, I am hearing from you!!!!

PS: I find the useful version 1.1.1 ,you can judge that use my func testPrivateKey, I promise that 1.1.6 need to solve the problem

func testPrivateKey() {
        let key = Data.init(base64Encoded: "eyJhZGRyZXNzIjoiMHgwYzI2OTgzZjUyODA2MWM0ZDQzYzY4MWE5ZTkxMzA0NTA2NjAwMWRiIiwiaWQiOiI1NGZkZWJjMi1iMjBjLTQ2YjktYmMzYy0zOTg1MWZiYzkzYjkiLCJ2ZXJzaW9uIjozLCJjcnlwdG8iOnsiY2lwaGVyIjoiYWVzLTEyOC1jdHIiLCJjaXBoZXJ0ZXh0IjoiOWU4OGE4YTI4MzA0ZmUyNTdkNjU1YjZjZWJlYjk4NmI2NmFhNWYwMTA0ZmYwYjBiMDQ2ZmQxMWUzNTJjNjg3MiIsImNpcGhlcnBhcmFtcyI6eyJpdiI6IjM5Nzk1Yzg2ZDc1NGE4ZTQzNTNiYjdlZTJkNmZkOWY2In0sImtkZiI6InNjcnlwdCIsImtkZnBhcmFtcyI6eyJka2xlbiI6MzIsIm4iOjQwOTYsInAiOjYsInIiOjgsInNhbHQiOiJkMjE0ZTU0MTczNjUwNmIzOTk2NTcwMjE5NzFkMzJiNjdhZDYxMGM5NTcwMWY0MWM5YTA0MTYxY2VlNTUwZjc2In0sIm1hYyI6ImViODlkMzAzMWNlODBiYjY1YTMyM2FlNzA4Y2E1NzYzZTU5MDM2NmRkMDM4Yzc4OTEyMWU2NTIxZjlmMzU2YzIifX0=")
        let password = "111111"
        let keystore = EthereumKeystoreV3.init(key!)
        let account = keystore!.addresses![0]
        let privateKey = try! keystore!.UNSAFE_getPrivateKeyData(password: password, account: account)
        let str = privateKey.toHexString()
        print(str)
    }
@shamatar
Copy link
Contributor

Hey @Li-Qun

Your password on creation of the keystore mismatches one when you try to get a private key!

func testPrivateKey() {
        let key = Data.init(base64Encoded: "eyJhZGRyZXNzIjoiMHgwYzI2OTgzZjUyODA2MWM0ZDQzYzY4MWE5ZTkxMzA0NTA2NjAwMWRiIiwiaWQiOiI1NGZkZWJjMi1iMjBjLTQ2YjktYmMzYy0zOTg1MWZiYzkzYjkiLCJ2ZXJzaW9uIjozLCJjcnlwdG8iOnsiY2lwaGVyIjoiYWVzLTEyOC1jdHIiLCJjaXBoZXJ0ZXh0IjoiOWU4OGE4YTI4MzA0ZmUyNTdkNjU1YjZjZWJlYjk4NmI2NmFhNWYwMTA0ZmYwYjBiMDQ2ZmQxMWUzNTJjNjg3MiIsImNpcGhlcnBhcmFtcyI6eyJpdiI6IjM5Nzk1Yzg2ZDc1NGE4ZTQzNTNiYjdlZTJkNmZkOWY2In0sImtkZiI6InNjcnlwdCIsImtkZnBhcmFtcyI6eyJka2xlbiI6MzIsIm4iOjQwOTYsInAiOjYsInIiOjgsInNhbHQiOiJkMjE0ZTU0MTczNjUwNmIzOTk2NTcwMjE5NzFkMzJiNjdhZDYxMGM5NTcwMWY0MWM5YTA0MTYxY2VlNTUwZjc2In0sIm1hYyI6ImViODlkMzAzMWNlODBiYjY1YTMyM2FlNzA4Y2E1NzYzZTU5MDM2NmRkMDM4Yzc4OTEyMWU2NTIxZjlmMzU2YzIifX0=")
        let password = "111111"
        let keystore = EthereumKeystoreV3.init(key!, password: password) !!! Here
        let account = keystore!.addresses![0]
        let privateKey = try! keystore!.UNSAFE_getPrivateKeyData(password: password, account: account)
        let str = privateKey.toHexString()
        print(str)
    }

@Li-Qun
Copy link
Author

Li-Qun commented Sep 13, 2018

@shamatar @shamatar
Dear lovely writer: I discovered the nature of the problem!!!

You use scrypt instead of libsodium!!!!
But my project still need libsolidum to do so many encryption and decryption function!!!!
And the scrypt and libsolidum has the same func name "escrypt_kdf_nosse"
(the scrypt --> Cimpl.c the libsolidum -->pwhash_scryptsala....... .c)
That lead to a confiction and so that the new func Cimpl.c doesn't work . and the the libsolidum execute method get the trouble answer!!!

I will still use the very important framework libsodium to do some encryption and decryption. So I have to use the old web3swift (Cocoapods ).
But I hope I can use the lastest web3swift version. I think it must be stronger.

Do you have some good advice ? Or tell me what should I do can solve that problem?
I am hearing from you!!!! Please call me back.🆙 ❤️

PS: very handsome writer ,there is no func below, but I knew what do you mean.
EthereumKeystoreV3.init(key!, password: password) !!! Here

@shamatar
Copy link
Contributor

I've also updated the Scrypt library to have another function name, you should be fine after the pod update

@Li-Qun
Copy link
Author

Li-Qun commented Sep 14, 2018

well done! thanks a lot.

@Li-Qun Li-Qun closed this as completed Sep 14, 2018
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

2 participants