elliptic-curve

Java byte array to ECCPrivateKey - InvalidKeySpecException: encoded key spec not recognised

非 Y 不嫁゛ 提交于 2019-12-08 02:14:54
问题 When I try to make ECC private key from byte array, I get exception mentioned below. I have public/private keys and out signed output from C library micro-ecc/uECC.h. C used secp192r1 curve. I am trying to verify data with C generated keys in Java. How to convert byte array to private/public key? Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); byte[] kb = new byte[]{(byte)0x24, (byte)0xF4, (byte)0x36, (byte)0x16, (byte)0xD0, (byte)0x96, (byte)0x12, (byte)0x63,

Are ECDSA and ECDH available for mono?

怎甘沉沦 提交于 2019-12-07 17:53:51
问题 The question pretty much sums it up. Are ECDSA and ECDH available for mono? If they are not, will they be? 回答1: No they are not available inside Mono BCL, nor Xamarin.iOS or Xamarin.Android. There's a bug report for each of them, ECDSA and ECDH, so you might want to add yourself on c.c. to know when this will change. Right now there's no time table to include them. 回答2: Microsoft .NET supports both, http://msdn.microsoft.com/en-us/library/system.security.cryptography.ecdsacng.aspx http://msdn

Fixed length 64 Bytes EC P-256 Signature with JCE

◇◆丶佛笑我妖孽 提交于 2019-12-07 06:35:00
问题 I need a fixed length 64 Byte ECDSA signature with the NIST P-256 Curve. The implementation hast to use JCE. The following code sample can generate a signature and verify it. Provider provSign = new SunEC(); Provider provVerify = new SunEC(); // generate EC key KeyPairGenerator kg = KeyPairGenerator.getInstance("EC", provSign); ECGenParameterSpec ecParam = new ECGenParameterSpec("secp256r1"); kg.initialize(ecParam); KeyPair keyPair = kg.generateKeyPair(); PrivateKey privateKey = keyPair

Export EC private key from BouncyCastle and import into CngKey or ECDsaCng?

荒凉一梦 提交于 2019-12-06 13:35:09
I have created key pairs for elliptic curve DSA signatures using BouncyCastle and managed to import the public key into ECDsaCng using an XMLString accoding to RFC4050 . Now I want to also move the private key and have not managed to find a solution. The closest I have got is using CngKey.Import. CngKey.Import supports PKCS#8 format so if you can get your keys into valid pkcs8 then it should work. Unfortunately the following code does not quite work. var privatekey = (ECPrivateKeyParameters) keyPair.Private; var pkinfo = PrivateKeyInfoFactory.CreatePrivateKeyInfo(privatekey); byte[] pkcs8Blob

Java byte array to ECCPrivateKey - InvalidKeySpecException: encoded key spec not recognised

一世执手 提交于 2019-12-06 09:05:32
When I try to make ECC private key from byte array, I get exception mentioned below. I have public/private keys and out signed output from C library micro-ecc/uECC.h. C used secp192r1 curve. I am trying to verify data with C generated keys in Java. How to convert byte array to private/public key? Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); byte[] kb = new byte[]{(byte)0x24, (byte)0xF4, (byte)0x36, (byte)0x16, (byte)0xD0, (byte)0x96, (byte)0x12, (byte)0x63, (byte)0x90, (byte)0x2E, (byte)0x51, (byte)0xF6, (byte)0x87, (byte)0x55, (byte)0xAB, (byte)0xCB, (byte

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

丶灬走出姿态 提交于 2019-12-06 06:04:37
问题 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

Number of points on elliptic curve

南楼画角 提交于 2019-12-06 01:56:54
问题 If you have an elliptic curve in the form of: y^2 = x^3 + a*x + b (mod p) Is there a good program to calculate the number of points on this curve? I have read about Schoof's and Schoof-Elkies-Atkin (SEA) algorithm, but I'm looking for open source implementations. Does anyone know a good program that can do this? Also if a is 1 and b is 0, the SEA algorithm can't be used because the j-invariant is 0. Is this correct? 回答1: There are some links here: Implementations of portions of the P1363

Are ECDSA and ECDH available for mono?

混江龙づ霸主 提交于 2019-12-06 00:30:23
The question pretty much sums it up. Are ECDSA and ECDH available for mono? If they are not, will they be? No they are not available inside Mono BCL, nor Xamarin.iOS or Xamarin.Android. There's a bug report for each of them, ECDSA and ECDH , so you might want to add yourself on c.c. to know when this will change. Right now there's no time table to include them. Microsoft .NET supports both, http://msdn.microsoft.com/en-us/library/system.security.cryptography.ecdsacng.aspx http://msdn.microsoft.com/en-us/library/system.security.cryptography.ecdiffiehellmancng.aspx From both Mono source code and

Generate EC Diffie-Hellman public and private key pair

半世苍凉 提交于 2019-12-05 19:26:13
I need to generate an EC Diffie Hellman key pair. I am using the secp256r1 named curve, and OpenSSL. This is what I have with me so far: unsigned char *ecdh(size_t *secret_len) { EVP_PKEY_CTX *pctx, *kctx; EVP_PKEY_CTX *ctx; unsigned char *secret; EVP_PKEY *pkey = NULL, *peerkey, *params = NULL; /* NB: assumes pkey, peerkey have been already set up */ /* Create the context for parameter generation */ if(NULL == (pctx = EVP_PKEY_CTX_new_id(EVP_PKEY_EC, NULL))) printf("Error in EC key generation\n"); /* Initialise the parameter generation */ if(1 != EVP_PKEY_paramgen_init(pctx)) printf("Error in

Fixed length 64 Bytes EC P-256 Signature with JCE

末鹿安然 提交于 2019-12-05 11:12:25
I need a fixed length 64 Byte ECDSA signature with the NIST P-256 Curve. The implementation hast to use JCE. The following code sample can generate a signature and verify it. Provider provSign = new SunEC(); Provider provVerify = new SunEC(); // generate EC key KeyPairGenerator kg = KeyPairGenerator.getInstance("EC", provSign); ECGenParameterSpec ecParam = new ECGenParameterSpec("secp256r1"); kg.initialize(ecParam); KeyPair keyPair = kg.generateKeyPair(); PrivateKey privateKey = keyPair.getPrivate(); PublicKey publicKey = keyPair.getPublic(); try { // export public key KeyFactory kf =