elliptic-curve

Shared Secret is Nil when using CC.EC.computeSharedSecret from SwCrypt pod library iOS

不想你离开。 提交于 2020-06-17 09:55:10
问题 How to compute shared secret using EC public key x and y values and private key d value using the below function and I am getting back nil. I tried to decode and i can see the privateD which i am passing returns back nil from importKey method where the value of status is -4302 within the SwCrypt pod. Can you please help what format Data should i be passing into the computeSharedSecret for it to work in this case ? code var publicX = "2_v-MuNZccqwM7PXlakW9oHLP5XyrjMG1UVS8OxYrgA" var publicY =

Derive EC public key from private key string in native Java for curve secp256k1

徘徊边缘 提交于 2020-04-30 07:09:07
问题 I need to derive an EC Public Key from an EC private key string without the "help" of any third party library. The Private key is externally produced and provided and I need to get the Public Key to generate a Bitcoin address. As my project is working "offline" I do not need a library like Bouncy Castle for any other purpose, so I would like to eliminate it. The following program is fully working and shows the (very short) example when working with Bouncy Castle to get a solution. The second

Elliptic Curve Multiplication Function

时光怂恿深爱的人放手 提交于 2020-01-21 10:00:38
问题 I'm trying to make my own library for the elliptic curve. Some things work, but some others don't. To calculate a public key from a private key, you should multiply the Generator Point with the private key, and you get another point: the public key Point (ECPoint = BigInteger * ECPoint). Now, I have a private key, and I multiply it with the Generator Point of the Secp256k1 curve. I get a a key, but it is not the key I should get. This is my JAVA code: import java.math.BigInteger; public class

How to generate ECDSA private and public key for DNSSEC using OpenSSL?

二次信任 提交于 2020-01-13 19:45:07
问题 I am trying to create private and public keys for DNSSEC algorithm 13: #include <stdio.h> #include <stdlib.h> #include <openssl/ec.h> #include <openssl/obj_mac.h> #include <openssl/bn.h> int main() { EC_KEY *eckey = NULL; const EC_POINT *pub_key = NULL; const EC_GROUP *group = NULL; const BIGNUM *res; BN_CTX *ctx; ctx = BN_CTX_new(); eckey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); EC_KEY_generate_key(eckey); res = EC_KEY_get0_private_key(eckey); printf("Private: %s\n", BN_bn2hex(res))

Signing a message using ECDSA in OpenSSL

好久不见. 提交于 2020-01-10 09:22:17
问题 How do I set the private key for signing messages when using ECDSA in OpenSSL programmatically? I have the following code: static int create_signature(unsigned char* hash) { EC_KEY *eckey=NULL; EC_GROUP *ecgroup=NULL; EVP_PKEY *evpkey=NULL; unsigned char *signature=NULL; point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; int signature_size, block_size; unsigned char * block=NULL; ecgroup = get_ec_group_192(); EC_GROUP_set_asn1_flag(ecgroup, OPENSSL_EC_NAMED_CURVE); EC_GROUP_set

Signing a message using ECDSA in OpenSSL

限于喜欢 提交于 2020-01-10 09:21:35
问题 How do I set the private key for signing messages when using ECDSA in OpenSSL programmatically? I have the following code: static int create_signature(unsigned char* hash) { EC_KEY *eckey=NULL; EC_GROUP *ecgroup=NULL; EVP_PKEY *evpkey=NULL; unsigned char *signature=NULL; point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; int signature_size, block_size; unsigned char * block=NULL; ecgroup = get_ec_group_192(); EC_GROUP_set_asn1_flag(ecgroup, OPENSSL_EC_NAMED_CURVE); EC_GROUP_set

ECDSA signature length

天涯浪子 提交于 2020-01-10 00:28:06
问题 What will the signature length for 256 bit EC key in ECDSA algorithm? I wanted to validated signature length for the same. It will be great if some body can help me with one EC key set. 回答1: It depends on how you encode the signature. This is the code segment from OpenSSL that measures the length of ECDSA signature in DER format. /** ECDSA_size * returns the maximum length of the DER encoded signature * \param eckey pointer to a EC_KEY object * \return numbers of bytes required for the DER