问题标签 [secp256k1]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
104 浏览

javascript - Eccrypto ECIES Decrypt Scheme, JavaScript

This will probably need some sort of background in https://www.npmjs.com/package/eccrypto . I am trying to decrypt a message that was retrieved from an api with the ECIES scheme but it keeps telling me that the public key is "bad".

error:

I am pretty sure the decrypt parameter where you pass in the message object contains the public key in it. And if I am wrong then it gets derived from the private key parameter but I don't believe this is, since the private key seems to be fine, and deriving the public key from the private when decrypting is counter intuitive to what ECIES decrypting does, encrypting is another deal.

Below you will see the decrypting function and functions used in it:

This is how the message object gets encrypted before it gets sent to the API for later retrieval:

I am not sure what is wrong since I did provide the decrypt message function with a valid private key, and as far as I know, I did encrypt the message correctly in the first place which is what I eventually passed into decrypt message function. What am I not doing right? Any help and closure will be of great usage for me. Thank you.

0 投票
0 回答
15 浏览

ios - 使用secp256k1曲线的ECC加密库CryptopECC的真机在iOS设备上无法正常运行的问题

错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

0 投票
1 回答
325 浏览

rust - 如何反转十六进制字符串?

给定一个十六进制字符串,例如"d59c168e05df4757",我怎样才能反转这个字符串的字节,以便读取[57, 47, df, 05, 8e, 16, 9c, d5]

使用该as_bytes()方法将每个单独的字符转换为一个字节值,而不是两个字符的十六进制表示。

从字节表示我尝试了以下但没有成功:

0 投票
0 回答
52 浏览

python - python和EDSA secp256k1签名错误

我的数据示例:

哈希 r+s 公钥

这是哈希:5d8af9d26031cb6dce39db29d46a00976714c8ae8d0d7005490ea17339c2ac85

r+s:42a34b08716a098e8d36d2adb800a3fe940bf19a6c2e42130a3e0f18289ba7184f0fa8ceb7d67d0043b356dd3635ed8d91122f5a3a78709036d452078f800b7

公钥:8e349786c8e4ef43858b1371b06e85b9b7b3d7f76c0cc6c4a09c1112e45691722826516069e0ca02a08f767ed9e5fff109e4779f2a46f1d0c6d8f71d22738b4

我得到一个错误:

请看屏幕:

https://ibb.co/vmkbMkb

https://ibb.co/GCN1CNY

但有了这些数据,一切正常:

哈希:223d18d3700d0b7d7775a16896b34497fed4f09ce620984975f83c976bec605f

r+s: f45825d9599e609c85fa69e81521ec50de51e596940b2c3ba7d99f2abfce1832538b4fe1e1c596ee49f06e0d6b06fee4a6633c77106a32a0e7a525bebe7209b3

公钥:308cbd43c28357bd288c1a75d98a35597466697668a34582a193163eb8c66793f759cd81133dc0e238e192eddc17874994873bbcbae8ba3bab714d74f6939072

我的数据有什么问题????

请帮帮我。非常感谢 !!!

0 投票
0 回答
354 浏览

rust - 错误:使用 Rust Crate `secp256k1` 时在 `rand` 中找不到 `rng`

我是 rust 新手,在尝试将secp256k1crate 与提供的示例代码一起使用时遇到以下错误

我的代码真的很简单

Cargo.toml包含

我们是否缺少一些东西来使它正常工作?

我尝试使用rustc 1.22.1 (b01adbbc3 2020-07-08)然后rustc 1.51.0 (2fd73fabe 2021-03-23)

0 投票
1 回答
107 浏览

security - 如何将 ECDSA secp256k1 PEM 格式的私钥转换为二进制?

我正在尝试将我的 secp256k1 私钥导入 AWS KMS。我的密钥是 PEM 格式的,AWS KMS 说'The key material must be in binary format'。如何将我的 ECDSA secp256k1 PEM 格式的私钥转换为二进制?

0 投票
1 回答
633 浏览

haskell - 'libsecp256k1' 是必需的,但找不到

我已经尝试了看似无穷无尽的方法来stack build引用图书馆secp256k1-haskell,但无济于事。

这是我的.cabal文件-

我在 Windows 环境中,并设法libsecp256k1.dll.netNuget 包中获取了一个版本。我尝试将以下行添加到我的.cabal文件中也无济于事 -

希望得到一些帮助。谢谢 - 我今晚花了很多时间试图让它发挥作用。

这是构建输出 -

0 投票
0 回答
106 浏览

node.js - 将 secp256k1 与 ECDSA 算法一起使用时,grpc 节点相互身份验证失败

我一直在使用自生成的RSA证书颁发机构来签署我的服务器和客户端证书,到目前为止grpc 节点相互身份验证工作正常。

出于同样的原因,我尝试将 secp256k1 与 ECDSA 算法一起使用,假设BTCETH的密钥将直接用于 grpc 身份验证。不幸的是,我无法获得正确的输出。这里有详细信息。

  • 操作系统:Ubuntu 18.04 64bit
  • 语言:节点
  • 身份验证:SSL/TLS
  • 签名算法:ecdsa-withsha256
  • 密钥生成类型:secp256k1
  • 源代码:来自 grpc 节点示例的 dynamic_codegen

以下所有内容和步骤都可以从存储库中找到

  1. 使用 gen.sh 生成服务器和客户端的 EC secp256k1私钥和 TLS 证书。
  1. 在greeter_server.js中实现服务器端 Auth
  1. 在greeter_client.js中实现客户端身份验证
  1. 试试看!
  1. 输出

使用RSA Certificate的 grpc 相互身份验证成功,但使用secp256k1失败。所以我的问题:

  1. 如何显示 grpc TLS 握手信息,如 openssl 调试?
  2. 有什么线索可以解决这个问题吗?

谢谢

0 投票
0 回答
43 浏览

bitcoin - 安装 libbitcoin-system 库时遇到问题

我正在尝试遵循 Andreas Antonopolus(掌握比特币)的书,我想做书中的所有内容,所以我坚持这样做:

尝试安装比特币资源管理器命令行工具时,我意识到我需要安装libbitcoin-client 库,这让我意识到我必须安装libbitcoin-protocol 库,这让我意识到我必须安装libbitcoin -system 库,然后需要 Boost(一些 c++ 库)和libbitcoin/secp256k1 库……长话短说……我一直在安装 libbitcoin-system 库,因为当我输入以下命令时:

经过一长串一切正常后,我得到了这个:

谁能帮我看看如何告诉配置命令找到 secp256k1 库?我正在从 ubuntu 电脑上运行所有东西……我确定我使用自动工具正确安装了 secp256k1 库……但我一直坚持这个……</p>

0 投票
0 回答
102 浏览

python - 如何在python中的secp256k1曲线上确定性地签署sha256哈希

我的主要目标是生成仅提供两个输入的签名:

这个确切的功能已经在这个库中作为一个 npm 模块实现,但我需要在 python 中使用它。

我试图找到这个功能的一个端口,但没有运气。

之后,我尝试使用 python 中提供的签名工具。

我当前的代码:

由于 js 库总是提供相同的结果,我假设签名必须几乎相同。

我对密码学和签名数据非常陌生,所以我可能遗漏了一些非常关键的东西并且无法弄清楚。

我最后的手段是使用某种胶带并在 python 中使用那个 js 库,但谁真的想去那里。