elliptic-curve

How to generate PublicKey for PrivateKey in X25519?

匆匆过客 提交于 2020-01-05 06:27:16
问题 I'm working with X25519-keys based encryption at the moment. My question is, basically, how to derive PublicKey from existing X25519 PrivateKey ? I have found the code in the XDHKeyPairGenerator : BigInteger publicKey = ops.computePublic(privateKey.clone()); But this package is platform-specific, thus not accessible. And I can't find a method to do it through publicly-accessible interfaces. 回答1: You must scalar multiply the private key (which is just a big number) by the 25519 curve generator

PHP openssl_sign() ecparam key type not supported in this PHP build

给你一囗甜甜゛ 提交于 2020-01-03 18:16:11
问题 openssl_sign is returning the signature string but printing this error. I am using elliptic curve key Warning: openssl_sign() [function.openssl-sign]: key type not supported in this PHP build! in 回答1: An issue has been filed in the php issue tracker for this: https://bugs.php.net/bug.php?id=66501 来源: https://stackoverflow.com/questions/10411450/php-openssl-sign-ecparam-key-type-not-supported-in-this-php-build

PHP openssl_sign() ecparam key type not supported in this PHP build

99封情书 提交于 2020-01-03 18:16:08
问题 openssl_sign is returning the signature string but printing this error. I am using elliptic curve key Warning: openssl_sign() [function.openssl-sign]: key type not supported in this PHP build! in 回答1: An issue has been filed in the php issue tracker for this: https://bugs.php.net/bug.php?id=66501 来源: https://stackoverflow.com/questions/10411450/php-openssl-sign-ecparam-key-type-not-supported-in-this-php-build

How can I encrypt data using a public key from ECC X509 certificate in .net framework on windows?

人盡茶涼 提交于 2020-01-03 05:30:28
问题 I am using: Windows 10 (Version 1709, OS Build 17025.1000) .net framework 4.7 VS 2017 (version: 15.3.5) Here is what I did: Got a self signed ECC certificate using OpenSSL and steps outlined in the script at https://gist.github.com/sidshetye/4759690 with modifications: a) Used NIST/P-256 curve over a 256 bit prime field b) Used SHA-256 Load the certificate from file (generated in previous step) into X509Certificate2 object Imported the PFX file into windows trust store (for testing). This is

ECDSA signing file with key from store C#.Net CNG

岁酱吖の 提交于 2020-01-01 07:30:31
问题 I'm trying to sign a file with ECDSA using the CNG API and a certificate from the Microsoft Certificate Store. I've read through a lot of documentation and and near done but I get hung up on importing the private key from the certificate. I've done this very same thing with RSA but it appears to be done very differently. Here's the code I have so far: static void signFile() { X509Certificate2 myCert = selectCert(StoreName.My, StoreLocation.CurrentUser, "Select a Certificate", "Please select a

Is it possible to use elliptic curve cryptography for encrypting data?

偶尔善良 提交于 2020-01-01 05:10:08
问题 So far I have only seen it used in digital signatures and key agreement protocols. Can it be used like RSA to actually encrypt data? Are there any libraries for this? Edited: I need something like RSA. Encrypt the data with the recievers public key so later he can decyrpt it with his private key. I know ECDH can be used to send a secret value to someone but you don't decide what data is sent. Unlike the "regular" DH with ECDH the resulting secret value is always the same since it only depends

How can I generate a valid ECDSA EC key pair?

半世苍凉 提交于 2019-12-31 02:45:29
问题 I am trying to generate ECDSA key pair using SpongyCastle in Android. This is the code: static { Security.insertProviderAt(new org.spongycastle.jce.provider.BouncyCastleProvider(), 1); } public static KeyPair generate() { ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("prime256v1"); KeyPairGenerator generator = KeyPairGenerator.getInstance("ECDSA", "SC"); generator.initialize(ecSpec, new SecureRandom()); KeyPair keyPair = g.generateKeyPair(); Log.i(TAG, "EC Pub Key generated: " +

How do I get ECDH keypair in Android 9.0 pie?

房东的猫 提交于 2019-12-24 20:45:50
问题 I want to get ECDH keypair (Public key and Private key). This method is not working in Android 9.0 pie, because Security provider "BC" , "SC" is removed from this version. I tried below method KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EC", "BC"); SecureRandom random = SecureRandom.getInstance("SHA1PRNG"); keyGen.initialize(256, random); KeyFactory kaif = KeyFactory.getInstance("EC", "BC"); KeyPair pair = keyGen.generateKeyPair(); PrivateKey privateKey = pair.getPrivate();

Elliptic curve addition in Jacobian coordinates

╄→尐↘猪︶ㄣ 提交于 2019-12-23 20:24:53
问题 I try to add two points on an elliptic curve over a prime field, converting these points from affine/to-affine coordinates, but do not manage to get a correct result (the curve I am testing has a=0). Anyone can see what's wrong? // From Affine BigInteger X1=P.x; BigInteger Y1=P.y; BigInteger Z1=BigInteger.ONE; BigInteger X2=Q.x; BigInteger Y2=Q.y; BigInteger Z2=BigInteger.ONE; // Point addition in Jacobian coordinates for a=0 // see http://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian-0

Generate elliptic curve KeyPair via KeyStore on API Level <23

让人想犯罪 __ 提交于 2019-12-23 05:15:48
问题 I need to generate an elliptic key pair in Android and store it to KeyStore to protect a private key from extraction. I was able to generate a key pair using Spongycastle library, but I cannot import the key pair in the KeyStore. Firstly, because I do not have a certificate and secondly, even if I tried to create one, it did not import the key either. I though of generating a key pair using KeyGenParameterSpec , but it's not accessible in APIs below version 23. To sum up my question, is there