elliptic-curve

How can I recover compressed y value from sender?

半城伤御伤魂 提交于 2019-12-11 07:19:34
问题 I am working on following scenario: Generate private and public key Generate compressed public key with: PublicKey.AccessGroupParameters().SetPointCompression(true) Sign some data and send to other end with compressed public key. [At other end] verify signature using public key For step 4, I need recover y value. Is there some API I can use among Crypto++? 回答1: For step 4, I need recover y value. Is there some API I can use among Crypto++? During verification, you will load the persisted or

How do I load an Elliptic Curve PEM encoded Private Key? [duplicate]

吃可爱长大的小学妹 提交于 2019-12-10 22:18:20
问题 This question already has answers here : Reading elliptic curve private key from file with BouncyCastle (3 answers) Closed 2 years ago . I've generated an elliptic curve private/public key pair using OpenSSL. The private and public keys are PEM encoded. I've figured out how to load the public key thanks to this. However, I can't figure out how to load the private key, as the above message just ends up with an InvalidKeySpecException: key spec not recognized. I then found this, but it also

How to pass EC named curve list used by SSL_CTX?

匆匆过客 提交于 2019-12-10 19:37:06
问题 I need to pass the selected EC named curve list to server. What is the OpenSSL API to achieve the same while generating the SSL_CTX . 回答1: I need to pass the selected EC named curve list to server. What is the OpenSSL API to achieve the same while generating the SSL_CTX . Its not possible in OpenSSL 1.0.1 and below. You have to hack the source code. For OpenSSL 1.0.2 and above, use SSL_CTX_set1_curves. If you are hacking the source code for OpenSSL 1.0.0 and 1.0.1, then modify pref_list from

Restricted elliptic curves in Java Card

给你一囗甜甜゛ 提交于 2019-12-10 13:58:45
问题 I am trying to implement cryptographic algorithms on elliptic curve in Java Card. First, I implemented it on 256bits elliptic curve (the NIST one) and it worked well. Now I want to test it on a 512bits curve (and not 521 like the NIST one). My card support this size and I found a database of elliptic curves (well defined for cryptography) of this size. But I am encountering a strange problem... When I try to initialize my key: ECPublicKey pubKey = (ECPublicKey) KeyBuilder.buildKey( KeyBuilder

Java 7 keytool Elliptic Curve Encryption

狂风中的少年 提交于 2019-12-10 02:48:48
问题 I'm trying to create a keystore using keytool with a keyalg ECC. This should be possible according to Oracle. I quote: Area: Tools Synopsis: The keytool and jarsigner tools now support the ECC algorithm in keypair generation and jar signing. RFE: 6870812 I'm using the 32-bit version 1.7.0_07, and I've tried keytool with -keyalg ECC, ECIES, ECDSA,... but I always get Cannot derive signature algorithm . Am I using the wrong Java version? Am I using the wrong name for ECC? 回答1: Here is the

Elliptic curve point addition over a finite field in Python

為{幸葍}努か 提交于 2019-12-09 18:22:40
问题 In short, Im trying to add two points on an elliptic curve y^2 = x^3 + ax + b over a finite field Fp. I already have a working implementation over R, but do not know how to alter the general formulas Ive found in order for them to sustain addition over Fp. When P does not equal Q, and Z is the sum of P and Q: dydx = (Q.y - P.y)/(Q.x - P.x) Z.x = dydx**2 - P.x - Q.x Z.y = dydx * (Z.x - P.x) + P.y When P equals Q, again with Z as the sum: dydx = (3 * (P.x)**2 + self.a)/(2 * P.y) Z.x = dydx**2 -

How to encrypt image with ecc in java

假如想象 提交于 2019-12-08 09:33:31
问题 I have to encrypt a bmp image with ECC, but I found it very difficult especially when the pixels will be mapped on the elliptic curve, I didn't understand it at all. So I researched other options and found ECIES. I tried to implement it in java using bouncycastle, it works but the problem is that my code encrypt the image as a file ,but i went to encrypt the pixels of the image and get a new encrypted image so I can calculate the PSNR between the encrypted and the unencrypted images. I tried

Javascript elliptical point multiplication algorithm

故事扮演 提交于 2019-12-08 08:09:46
问题 The following is an implementation of elliptical curve Point Multiplication, but it's not working as expected (using recent Chrome / Node with BigInt for illustration): const bi0 = BigInt(0) const bi1 = BigInt(1) const bi2 = BigInt(2) const bi3 = BigInt(3) const absMod = (n, p) => n < bi0 ? (n % p) + p : n % p export function pointAdd (xp, yp, xq, yq, p) { const lambda = (yq - yp) / (xq - xp) const x = absMod(lambda ** bi2 - xp - xq, p) const y = absMod(lambda * (xp - x) - yp, p) return { x,

openssl CMS with ECDH EnvelopedData

怎甘沉沦 提交于 2019-12-08 07:27:28
I am playing with openssl 1.0.2a - specifically CMS support for ECC. As a test I am doing a simple encrypt and decrypt. I gave an RSA example as a known good working example / sanity test. The ECC example fails. Any ideas? TIA. ./openssl version OpenSSL 1.0.2a 19 Mar 2015 echo -n 12345678123456781234567812345678 > sess.txt # 32 byte plaintext #RSA works ./openssl genrsa -out rsa.key 2048 ./openssl req -x509 -new -key rsa.key -out rsa.crt ./openssl cms -encrypt -in sess.txt -out rsaencsess.bin -outform PEM rsa.crt ./openssl cms -decrypt -in rsaencsess.bin -out rsadecsess.txt -inform PEM -inkey

openssl CMS with ECDH EnvelopedData

安稳与你 提交于 2019-12-08 04:46:32
问题 I am playing with openssl 1.0.2a - specifically CMS support for ECC. As a test I am doing a simple encrypt and decrypt. I gave an RSA example as a known good working example / sanity test. The ECC example fails. Any ideas? TIA. ./openssl version OpenSSL 1.0.2a 19 Mar 2015 echo -n 12345678123456781234567812345678 > sess.txt # 32 byte plaintext #RSA works ./openssl genrsa -out rsa.key 2048 ./openssl req -x509 -new -key rsa.key -out rsa.crt ./openssl cms -encrypt -in sess.txt -out rsaencsess.bin