在Swift中使用secp256k1公钥解析

问题描述 投票:0回答:1

我正在使用绑定here在Swift中执行secp256k1函数。我有以下代码:

        let pubkeyTxt = "036c1495224d8b6245ca35df958127dc3d587ff7e9d8e1e5f964b312dc5ea3aac9"
        let pubArray: [UInt8] = Array(pubkeyTxt.utf8)
        var pubkey = secp256k1_pubkey()
        let pubBool = secp256k1_ec_pubkey_parse(ctx!, &pubkey, pubArray, pubArray.count)
        if pubBool == 0 {
            print("Could not parse the public key")
            return
        }

它保持打印无法解析公钥。我无法弄清楚出了什么问题。我的预感是pubArray.count是函数的错误长度,所以我尝试了其他一些值,但没有运气。

swift cryptography public-key
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.