elliptic-curve

Using BouncyCastle to encrypt with ECIES in Java

纵然是瞬间 提交于 2019-12-05 03:49:53
问题 I am trying to encrypt some content using ECC algorithm using BouncyCastle in java. But I am getting exception of BouncyCastle library saying cannot cast JCEECPublicKey to IESKey . Which I understood that the public key generated by KeyPairGenerator is JCEECPublicKey which cannot be used in java Cipher.init method. Can someone tell me how can convert it in Public key or X509 spec so that I can use it in encryption. Here is the code which I tried // add instance of provider class Security

Java 7 keytool Elliptic Curve Encryption

本秂侑毒 提交于 2019-12-05 02:06:54
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? Here is the source for the algorithm selection. The allowed values are DSA , RSA and EC . These values are not documented

How Do i compress or encode the Elliptic curve public key and put it over the network?

别等时光非礼了梦想. 提交于 2019-12-04 20:42:53
问题 I am developing Distributed digital signature that signs a document and send it through network to the Application Server.I am using socket programming in java to do it. I think the public key should be encoded or compressed i.e the x and y values are somehow represented as a single binary data and saved in a public registry or network.But i don't know how to do it in java. // I have class like this public class CryptoSystem{ EllipticCurve ec = new EllipticCurve(new P192()); //---------------

How do I feed OpenSSL random data for use in ECDSA signing?

坚强是说给别人听的谎言 提交于 2019-12-04 09:03:47
I want to feed OpenSSL specific data for use as random seed during the signing of data with an EC key. I'm doing this to compare my application with another reference one (closed source). That utility takes the file with private key, file with data to sign and file with random data as parameters. I've got the generation of EC keys, and signing of data down, but can't compare the two applications since I have no common ground. OpenSSL generates random data used in signing the data (probably from /dev/random) and thus gives me a different signature every run. I've tried RAND_clear() in

How do I get an ECDSA public key from just a Bitcoin signature? … SEC1 4.1.6 key recovery for curves over (mod p)-fields

拥有回忆 提交于 2019-12-04 08:55:29
问题 Update: Partial solution available on Git EDIT: A compiled version of this is available at https://github.com/makerofthings7/Bitcoin-MessageSignerVerifier Please note that the message to be verified must have Bitcoin Signed Message:\n as a prefix. Source1 Source2 There is something wrong in the C# implementation that I can probably correct from this Python implementation It seems to have a problem with actually coming up with the correct Base 58 address. I have the following message,

Using BouncyCastle to encrypt with ECIES in Java

一个人想着一个人 提交于 2019-12-03 22:01:48
I am trying to encrypt some content using ECC algorithm using BouncyCastle in java. But I am getting exception of BouncyCastle library saying cannot cast JCEECPublicKey to IESKey . Which I understood that the public key generated by KeyPairGenerator is JCEECPublicKey which cannot be used in java Cipher.init method. Can someone tell me how can convert it in Public key or X509 spec so that I can use it in encryption. Here is the code which I tried // add instance of provider class Security.addProvider(new BouncyCastleProvider()); // initializing parameter specs secp256r1/prime192v1

Generate EC public key from byte array private key in native java (7+)

偶尔善良 提交于 2019-12-03 21:13:31
I'm trying to learn some crypto coding and have generated a 32-byte private key currently held in a byte array ( byte[] privatekey ). I know the public key is generated using the secp256k1 named elliptic curve parameters, and a formula where publickey = G * privatekey , where G is some point on the elliptic curve (ECPoint?), but I am unable to transfer that named parameter spec and formula into actual coding of a public key. I know that since java 7, there are classes included in the java.security.* and java.security.spec.* packages to do this in short code, but I can't find a good example

How Do i compress or encode the Elliptic curve public key and put it over the network?

╄→гoц情女王★ 提交于 2019-12-03 13:00:32
I am developing Distributed digital signature that signs a document and send it through network to the Application Server.I am using socket programming in java to do it. I think the public key should be encoded or compressed i.e the x and y values are somehow represented as a single binary data and saved in a public registry or network.But i don't know how to do it in java. // I have class like this public class CryptoSystem{ EllipticCurve ec = new EllipticCurve(new P192()); //------------------- //-------------------- public ECKeyPair generatekeyPair() { return ECKeyPair(ec); } } // i don't

Points calculated using this elliptic curve point multiplication do not lie on the curve and this class brings Arithmetic exception

孤街浪徒 提交于 2019-12-03 09:04:17
I get stack on my error of point multiplication using standard projective coordinates. I don't know what i missed but the multiplied points do not lie on the curve and some times it outputs something like Arithmetic Exception: integer is not invertible. public class ECPointArthimetic { EllipticCurve ec; private BigInteger x; private BigInteger y; private BigInteger z; private BigInteger zinv; private BigInteger one = BigInteger.ONE; private BigInteger zero = BigInteger.ZERO; private boolean infinity; public ECPointArthimetic(EllipticCurve ec, BigInteger x, BigInteger y, BigInteger z) { this.ec

How does one access the raw ECDH public key, private key and params inside OpenSSL's EVP_PKEY structure?

二次信任 提交于 2019-12-03 07:07:48
问题 I'm using OpenSSL's c library to generate an elliptic curve Diffie-Hellman (ECDH) key pair, following the first code sample here. It glosses over the actual exchange of public keys with this line: peerkey = get_peerkey(pkey); The pkey variable and the return value are both of type EVP * . pkey contains the public key, private key, and params generated earlier, and the return value only contains the peer's public key. So this raises three questions: How would get_peerkey() actually extract