elliptic-curve

Elliptic Curve Crypto in iOS

喜你入骨 提交于 2019-11-30 11:02:20
I'm trying to incorporate ECC into an iPhone app that is being used for secure communications but I'm having a hard time finding a proper library / tutorial on how to do this in objective-c. I read this post: How to use ECC in iOS But it was posted almost a year ago and there weren't any responses. Any tips / advice would be greatly appreciated Thanks! Unfortunately, the Security Transforms [1] (the iOS built-in framework one should go to and the one the post mentioned above uses) does not seem to have support for elliptic curves built in. You'll have to rely on a non-apple implementation of

Is there a standardized fixed-length encoding for EC public keys?

非 Y 不嫁゛ 提交于 2019-11-30 08:04:35
问题 I was wondering if there was (and I hope there is) a standard for public key size for ECDH (Elliptic Curve Diffie-Hellman) and ECDSA (Elliptic Curve Digital Signature Algorithm) for every curve type over prime fields (192, 224, 256, 384 and 521). 回答1: If you use one of the "named curves" then the public key size is fixed and dependent on the "field size" of your underlying curve. Compressed vs. uncompressed representation Public key sizes further depend on whether the "uncompressed"

Signing a message using ECDSA in OpenSSL

心已入冬 提交于 2019-11-30 04:07:00
How do I set the private key for signing messages when using ECDSA in OpenSSL programmatically? I have the following code: static int create_signature(unsigned char* hash) { EC_KEY *eckey=NULL; EC_GROUP *ecgroup=NULL; EVP_PKEY *evpkey=NULL; unsigned char *signature=NULL; point_conversion_form_t form = POINT_CONVERSION_UNCOMPRESSED; int signature_size, block_size; unsigned char * block=NULL; ecgroup = get_ec_group_192(); EC_GROUP_set_asn1_flag(ecgroup, OPENSSL_EC_NAMED_CURVE); EC_GROUP_set_point_conversion_form(ecgroup, form); eckey=EC_KEY_new(); EC_KEY_set_group(eckey,ecgroup); EC_KEY_generate

Is there a difference between ECDH and ECDSA keys?

社会主义新天地 提交于 2019-11-30 02:38:12
问题 I'm building a network application that uses BouncyCastle as a cryptography provider. Let's say you have this to generate a keypair: ECParameterSpec ecSpec = ECNamedCurveTable.getParameterSpec("prime192v1"); KeyPairGenerator g = KeyPairGenerator.getInstance("ECDSA", "BC"); g.initialize(ecSpec, new SecureRandom()); KeyPair pair = g.generateKeyPair(); I'm confused as to why you're getting an instance of an ECDSA KeyPairGenerator. Why doesn't it just say EC ? I know that there's an ECDH Key type

Elliptic Curve Crypto in iOS

谁都会走 提交于 2019-11-29 16:31:32
问题 I'm trying to incorporate ECC into an iPhone app that is being used for secure communications but I'm having a hard time finding a proper library / tutorial on how to do this in objective-c. I read this post: How to use ECC in iOS But it was posted almost a year ago and there weren't any responses. Any tips / advice would be greatly appreciated Thanks! 回答1: Unfortunately, the Security Transforms [1] (the iOS built-in framework one should go to and the one the post mentioned above uses) does

Number of points on elliptic curve

馋奶兔 提交于 2019-11-29 07:20:47
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? There are some links here: Implementations of portions of the P1363 draft . Have you heard of Sage ? Sage includes Pari, which is an open source package for number theory. Pari has

Is there a standardized fixed-length encoding for EC public keys?

元气小坏坏 提交于 2019-11-29 05:38:50
I was wondering if there was (and I hope there is) a standard for public key size for ECDH (Elliptic Curve Diffie-Hellman) and ECDSA (Elliptic Curve Digital Signature Algorithm) for every curve type over prime fields (192, 224, 256, 384 and 521). emboss If you use one of the "named curves" then the public key size is fixed and dependent on the "field size" of your underlying curve. Compressed vs. uncompressed representation Public key sizes further depend on whether the "uncompressed" representation or the "compressed" representation is used. In the uncompressed form, the public key size is

ECDSA signature length

梦想的初衷 提交于 2019-11-29 02:44:35
What will the signature length for 256 bit EC key in ECDSA algorithm? I wanted to validated signature length for the same. It will be great if some body can help me with one EC key set. It depends on how you encode the signature. This is the code segment from OpenSSL that measures the length of ECDSA signature in DER format. /** ECDSA_size * returns the maximum length of the DER encoded signature * \param eckey pointer to a EC_KEY object * \return numbers of bytes required for the DER encoded signature */ int ECDSA_size(const EC_KEY *r) { int ret,i; ASN1_INTEGER bs; BIGNUM *order=NULL;

Scalar Multiplication of Point over elliptic Curve

旧城冷巷雨未停 提交于 2019-11-28 11:35:44
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.math.BigInteger; import java.security.spec.ECPoint; public class ScalarMultiply { private static final

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

末鹿安然 提交于 2019-11-28 10:30:32
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? 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 parameters can then be extracted from that key: // generate bogus keypair(!) with named-curve params