Questions tagged [secp256k1]

Secp256k1 is the name of the elliptic curve used by Bitcoin to implement its public key cryptography.

60 questions
1
vote
0 answers

Error: could not find `rng` in `rand` when using Rust Crate `secp256k1`

I am new to rust and encountered the following error when trying to use the secp256k1 crate with the provided example code error[E0432]: unresolved import `secp256k1::rand::rng` --> src/main.rs:1:22 | 1 | use secp256k1::rand::rng::OsRng; | …
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
1
vote
0 answers

The problem that the real device using the ECC encryption library CryptoppECC of the secp256k1 curve cannot run normally on the iOS device

in /Users/ios/Desktop/demo/PodECC/Pods/CryptoppECC/CryptoppECC/CryptoppLibrary/bin/ios/libcryptopp.a(hex.o), building for iOS, but linking in object file…
an An
  • 11
  • 1
1
vote
1 answer

Public key Exceeding Mod P? A Clarification Request On The Discrete Logarithm Problem

I tried to observe / implement the discrete logarithm problem but I noticed something about it; but before I get into it let me give some clarification which is open to correction. a = b^x mod P Where as a = the public key of the address; b = the…
1
vote
1 answer

Javascript. How To Efficiently Store Secp256k1 Private Key for ECIES Scheme

I've been having a really hard time figuring out how to store a Secp256k1 privateKey from multiple libraries (currently on this one for ECIES encryption: https://npm.io/package/@toruslabs/eccrypto). I have tried encoding and decoding with base64,…
user14930609
1
vote
0 answers

Difference between js and dart to generate an address with a private key

I would like to write this function written in js to dart Function in js import {ec as EC} from 'elliptic' import secp256k1 from 'secp256k1' import sha3 from 'js-sha3' const ec = new EC('secp256k1') export function privateKeyToAddress(key) { …
redDwarf
  • 336
  • 1
  • 9
1
vote
1 answer

How to generate various key-pair by using secp256k1 C library?

I am just writing a small test program by using secp256k1 C lib, targeting to generate various random ecdsa key pairs, by using secp256k1-zkp API, simply follow up some example in tests.c. However, a little bit surprised, I find that I can not get…
LeonMSH
  • 11
  • 1
1
vote
3 answers

secp256k1 is not working/supporting in eclipse?

Getting this error: java.security.InvalidAlgorithmParameterException: Unsupported curve: secp256k1 (1.3.132.0.10) is there any kind of method that i can use secp256k1 in eclipse? i cannot found any help. how i can use secp256k1 to generate a…
1
vote
1 answer

Key additions in 25519-dalek?

I have key addition, for curve secp256k1, working: https://crypto.stackexchange.com/a/83733/17505 use rand::Rng; use secp256k1::{Secp256k1, SecretKey, PublicKey}; fn main() { let secp = Secp256k1::new(); let seed_a =…
fadedbee
  • 42,671
  • 44
  • 178
  • 308
1
vote
0 answers

How to get bytes out of a secp256 SecretKey?

I've written some code which works: use rand::Rng; use secp256k1::{Secp256k1, SecretKey, PublicKey}; fn main() { let secp = Secp256k1::new(); let seed_a = rand::thread_rng().gen::<[u8; 32]>(); let mut skey_a =…
fadedbee
  • 42,671
  • 44
  • 178
  • 308
1
vote
2 answers

Why are secp256k1 uncompressed public keys not formatted as expected?

A small bit of Rust code: let secret_key = SecretKey::from_slice(&rand::thread_rng().gen::<[u8; 32]>()).expect("32 bytes, within curve order"); let public_key = PublicKey::from_secret_key(&secp, &secret_key); let pk : [u8; 33] =…
fadedbee
  • 42,671
  • 44
  • 178
  • 308
0
votes
0 answers

Where is the definition of add() located in OpenSSL?

In this link, EC_POINT_add refers to add() function. Can anyone tell me where add() function is defined in this library? I need to understand how OpenSSL performs point addition in Projective coordinates.
0
votes
1 answer

Rust secp256k1 equivalent of NodeJS `crypto::ECDH::computeSecret()`?

I've written this working NodeJS/Javascript function: /* * Calculate the Symmetric Key from the Public and Secret keys from two * different key pairs. * * Note: symmetric_key(publicA, secretB) == symmetric_key(publicB, secretA) */ function…
fadedbee
  • 42,671
  • 44
  • 178
  • 308
0
votes
1 answer

Does Google Cloud Platform KMS support RFC6979 signature generation using secp256k1

We want to use GCP KMS to manage our Ethereum server keys. To do this, we need to be able to support the ability to sign messages the same way ethers.js (v5) wallet.signMessage(...) does. It is my understanding that it uses RFC6979 to produce the…
chrisb
  • 3
  • 1
0
votes
2 answers

Creating a ECDH shared secret from raw public and private keys

I've read the documentation example (below), but the keys there are being generated, rather than imported from raw bytes. const crypto = require('crypto'); const alice = crypto.createECDH('secp256k1'); const bob = crypto.createECDH('secp256k1'); //…
fadedbee
  • 42,671
  • 44
  • 178
  • 308
0
votes
0 answers

In Openssl library, why is retrieving point coordinates of a point on secp256k1 slower than point addition?

I am performing point addition on secp256k1 curve using Openssl library. To improve it's execution speed, i am checking for bottlenecks. Check out the below code. #include #include #include int…