elliptic-curve

Unable to sign a file with nodejs crypto

二次信任 提交于 2019-11-28 05:46:11
问题 I've created a private Key with nodejs crypto and want to sign a file with this key. My code is following: var ecdh = crypto.createECDH('brainpoolP512t1'); ecdh.generateKeys(); var key = ecdh.getPrivateKey('buffer'); var data= fs.readFileSync(req.file.path); var sign = crypto.createSign('sha512'); sign.update(data); var signature = sign.sign(key, 'hex'); But I get the error: Error: error:0906D06C:PEM routines:PEM_read_bio:no start line at Error (native) at Sign.sign (crypto.js:283:26) at /...

Does ECDiffieHellmanCng in .NET have a key derivation function that implements NIST SP 800-56A, section 5.8.1

a 夏天 提交于 2019-11-27 23:42:19
I have a task at hand that requires deriving key material using the key derivation function described in NIST SP 800-56A, section 5.8.1. I'm not an expert in Cryptography so please excuse me if the question is naive. Here's what I've done so far: I have the other party's public key and my private key Now I try to generate the shared secret using ECDH 1.3.132.1.12 using C# (.NET 4) ECDiffieHellmanCng class like so: // The GetCngKey method reads the private key from a certificate in my Personal certificate store CngKey cngPrivateKey = GetCngKey(); ECDiffieHellmanCng ecDiffieHellmanCng = new

How do I obtain the public key from an ECDSA private key in OpenSSL?

谁都会走 提交于 2019-11-27 22:34:51
I am providing this sample application to show my problem #include <stdio.h> #include <stdlib.h> #include <openssl/ec.h> #include <openssl/bn.h> int main() { EC_KEY *pkey = NULL; EC_POINT *pub_key = NULL; const EC_GROUP *group = NULL; BIGNUM start; BIGNUM *res; BN_CTX *ctx; BN_init(&start); ctx = BN_CTX_new(); res = &start; BN_hex2bn(&res,"3D79F601620A6D05DB7FED883AB8BCD08A9101B166BC60166869DA5FC08D936E"); pkey = EC_KEY_new_by_curve_name(NID_secp256k1); group = EC_KEY_get0_group(pkey); pub_key = EC_POINT_new(group); EC_KEY_set_private_key(pkey, res); assert(EC_POINT_bn2point(group,res, pub_key

Scalar Multiplication of Point over elliptic Curve

大憨熊 提交于 2019-11-27 06:18:32
问题 I am implementing Elliptic Curve Point arithmetic operation on NIST specified curve "p192". For testing purpose I have taken example points shown in NIST Routine document for the curve p192. I am getting correct answer for addition of point and doubling of point but for scalar multiplication my answers are not correct. Due to this reason I am unable to reach whether $ k^{-1}(kP) = P $ where $ k^{-1}.k = 1 mod p $ Please help me to understand where I am making mistakes. package a; import java

How does one convert a public EC code point and curve name into a PublicKey?

时光总嘲笑我的痴心妄想 提交于 2019-11-27 03:34:58
问题 I have two 32 byte long byte arrays representing the X and Y values for an EC Public Key. I know that the curve is the named curve "prime256v1". How can I turn that into a Java PublicKey object? The JCE appears to provide no facilities whatsoever to use named curves. Bouncycastle's example code does not appear to compile with any version of bouncycastle I can find. WTF? 回答1: I don't see any way in JCE to use a named curve directly for a key, but it can be used for key generation, and the

Does ECDiffieHellmanCng in .NET have a key derivation function that implements NIST SP 800-56A, section 5.8.1

江枫思渺然 提交于 2019-11-26 21:34:14
问题 I have a task at hand that requires deriving key material using the key derivation function described in NIST SP 800-56A, section 5.8.1. I'm not an expert in Cryptography so please excuse me if the question is naive. Here's what I've done so far: I have the other party's public key and my private key Now I try to generate the shared secret using ECDH 1.3.132.1.12 using C# (.NET 4) ECDiffieHellmanCng class like so: // The GetCngKey method reads the private key from a certificate in my Personal

SSLHandshakeException: Handshake failed on Android N/7.0

我是研究僧i 提交于 2019-11-26 15:50:54
I'm working on an app for which the (power)users have to set up their own server (i.e. nginx) to run the backend application. The corresponding domain needs to be configured in the app so it can connect. I've been testing primarily on my own phone (sony z3c) and started developing for 5.1. Later I received an update for 6.0 but still maintained a working 5.1 inside the emulator. Not too long ago, I started to work on an AVD with an image for 7.0 and to my suprise it won't connect to my server, telling me the ssl handshake failed. My nginx configuration is pretty strict, but it works for both 5

SSLHandshakeException: Handshake failed on Android N/7.0

こ雲淡風輕ζ 提交于 2019-11-26 05:58:00
问题 I\'m working on an app for which the (power)users have to set up their own server (i.e. nginx) to run the backend application. The corresponding domain needs to be configured in the app so it can connect. I\'ve been testing primarily on my own phone (sony z3c) and started developing for 5.1. Later I received an update for 6.0 but still maintained a working 5.1 inside the emulator. Not too long ago, I started to work on an AVD with an image for 7.0 and to my suprise it won\'t connect to my