1Crypt::OpenSSL::EC(3) User Contributed Perl DocumentationCrypt::OpenSSL::EC(3)
2
3
4
6 Crypt::OpenSSL::EC - Perl extension for OpenSSL EC (Elliptic Curves)
7 library
8
10 use Crypt::OpenSSL::EC;
11 use Crypt::OpenSSL::Bignum::CTX;
12
13 # Use of $ctx is optional in all calls, here we demonstrate its use.
14 # If it is provided it will increase performance.
15 my $ctx = Crypt::OpenSSL::Bignum::CTX->new();
16
17 my $method = Crypt::OpenSSL::EC::EC_GFp_mont_method();
18 my $group = Crypt::OpenSSL::EC::EC_GROUP::new($method);
19 Crypt::OpenSSL::EC::EC_GROUP::set_curve_GFp($group, $p, $a, $b, $ctx);
20 my $method = Crypt::OpenSSL::EC::EC_GROUP::method_of($group);
21 Crypt::OpenSSL::EC::EC_GROUP::copy($tmp, $group);
22 Crypt::OpenSSL::EC::EC_GROUP::get_curve_GFp($group, $p, $a, $b, $ctx);
23
24 $Crypt::OpenSSL::EC::trace = 1;
25 Crypt::OpenSSL::EC::print_errs();
26 my $P = Crypt::OpenSSL::EC::EC_POINT::new($group);
27
28
29 Crypt::OpenSSL::EC::EC_POINT_set_to_infinity($group, $P);
30 my $bool = Crypt::OpenSSL::EC::EC_POINT::is_at_infinity($group, $P);
31
32 my $buf = Crypt::OpenSSL::EC::EC_POINT::point2oct($group, $Q, &Crypt::OpenSSL::EC::POINT_CONVERSION_COMPRESSED, $ctx);
33 Crypt::OpenSSL::EC::EC_POINT::oct2point($group, $P, $buf, $ctx);
34 Crypt::OpenSSL::EC::EC_POINT::add($group, $P, $P, $Q, $ctx);
35
36 Crypt::OpenSSL::EC::EC_POINT::set_compressed_coordinates_GFp($group, $Q, $x, 1, $ctx));
37 my $bool = Crypt::OpenSSL::EC::EC_POINT::is_on_curve($group, $Q, $ctx));
38 Crypt::OpenSSL::EC::EC_POINT::copy($R, $P);
39 my $result = Crypt::OpenSSL::EC::EC_POINT::cmp($group, $P, $Q, $ctx);
40 Crypt::OpenSSL::EC::EC_POINT::set_affine_coordinates_GFp($group, $P, $x, $y, $ctx);
41 Crypt::OpenSSL::EC::EC_POINT::get_affine_coordinates_GFp($group, $P, $x, $y, $ctx);
42 Crypt::OpenSSL::EC::EC_GROUP::set_generator($group, $P, $z, Crypt::OpenSSL::Bignum->one());
43 my $degree = Crypt::OpenSSL::EC::EC_GROUP::get_degree($group)
44 my $order = Crypt::OpenSSL::EC::EC_GROUP::get_order($group, $order, $ctx);
45 Crypt::OpenSSL::EC::EC_POINT::mul($group, $Q, $order, $P, $n1, $ctx));
46 Crypt::OpenSSL::EC::EC_POINT::free($P);
47 Crypt::OpenSSL::EC::EC_GROUP::free($group);
48
50 This module provides a standard (non-OO) interface to the OpenSSL EC
51 (Elliptic Curve) library. Some OO Calls are supported.
52
53 Most of the functions described in openssl/ec.h are supported.
54
55 It provides the Crypt::OpenSSL::EC class which defines some high level
56 functions and constants. At also provides 4 other classes for managing
57 EC objects:
58
59 Crypt::OpenSSL::EC::EC_GROUP
60 Crypt::OpenSSL::EC::EC_POINT
61 Crypt::OpenSSL::EC::EC_KEY
62 Crypt::OpenSSL::EC::EC_METHOD
63
64 All objects created by these 4 classes are implemented as blessed Perl
65 mortal references. This ensures they will be auto-destroyed when the
66 Perl variable becomes unreferenced. ASlo the approproae EC free
67 function wil be called to free the underlying EC object.
68
69 Further, it means that many of the functions below can be called using
70 O-O methods. If a method's first argument is the same as the class the
71 method is in, then it can be called O-O style. For example the
72 following 2 calls are equivalent:
73
74 my $newgroup = Crypt::OpenSSL::EC::EC_GROUP::dup($group);
75 my $newgroup = $group->dup();
76 Crypt::OpenSSL::EC::EC_GFp_simple_method();
77 Returns the basic GFp ec methods which provides the basis for the
78 optimized methods.
79
80 Crypt::OpenSSL::EC::EC_GFp_mont_method();
81 Returns GFp methods using montgomery multiplication.
82
83 Crypt::OpenSSL::EC::EC_GFp_nist_method();
84 Returns GFp methods using optimized methods for NIST recommended
85 curves
86
87 Crypt::OpenSSL::EC::EC_GF2m_simple_method();
88 Not available if OPENSSL_NO_EC2M is defined in OpenSSL.
89
90 Returns the basic GF2m ec method
91
92 Crypt::OpenSSL::EC::EC_GROUP::new($method);
93 Creates a new EC_GROUP object $method is the method to use
94
95 Crypt::OpenSSL::EC::EC_GROUP::set_curve_GFp($group, $p, $a, $b, $ctx);
96 Sets the parameter of a ec over GFp defined by y^2 = x^3 + a*x + b
97 group EC_GROUP object
98 p BIGNUM with the prime number
99 a BIGNUM with parameter a of the equation
100 b BIGNUM with parameter b of the equation
101 ctx BN_CTX object (optional)
102 return 1 on success and 0 if an error occured
103
104 Crypt::OpenSSL::EC::EC_GROUP::method_of($group);
105 Returns the EC_METHOD of the EC_GROUP object.
106
107 Crypt::OpenSSL::EC::EC_METHOD::get_field_type($method)
108 Returns the field type of the EC_METHOD.
109
110 Crypt::OpenSSL::EC::EC_GROUP::copy($dst, $src);
111 Copies EC_GROUP objects. Note: both EC_GROUPs must use the same
112 EC_METHOD. return newly created EC_GROUP object or NULL in case of
113 an error.
114
115 Crypt::OpenSSL::EC::EC_GROUP::dup($src);
116 Creates a new EC_GROUP object and copies the copies the content
117 form src to the newly created EC_GROUP object. return newly
118 created EC_GROUP object or NULL in case of an error.
119
120 Crypt::OpenSSL::EC::EC_GROUP::get_curve_GFp($group, $p, $a, $b, $ctx);
121 Gets the parameter of the ec over GFp defined by y^2 = x^3 + a*x +
122 b
123 group EC_GROUP object
124 p BIGNUM for the prime number
125 a BIGNUM for parameter a of the equation
126 b BIGNUM for parameter b of the equation
127 ctx BN_CTX object (optional)
128 return 1 on success and 0 if an error occured
129
130 Crypt::OpenSSL::EC::EC_GROUP::set_curve_GF2m($group, $p, $a, $b, $ctx);
131 Not available if OPENSSL_NO_EC2M is defined in OpenSSL.
132
133 Sets the parameter of a ec over GF2m defined by y^2 + x*y = x^3 +
134 a*x^2 + b
135 group EC_GROUP object
136 p BIGNUM with the polynomial defining the underlying field
137 a BIGNUM with parameter a of the equation
138 b BIGNUM with parameter b of the equation
139 ctx BN_CTX object (optional)
140 return 1 on success and 0 if an error occured
141
142 Crypt::OpenSSL::EC::EC_GROUP::get_curve_GF2m($group, $p, $a, $b, $ctx);
143 Not available if OPENSSL_NO_EC2M is defined in OpenSSL.
144
145 Gets the parameter of the ec over GF2m defined by y^2 + x*y = x^3 +
146 a*x^2 + b
147 group EC_GROUP object
148 p BIGNUM for the polynomial defining the underlying field
149 a BIGNUM for parameter a of the equation
150 b BIGNUM for parameter b of the equation
151 ctx BN_CTX object (optional)
152 return 1 on success and 0 if an error occured
153
154 Crypt::OpenSSL::EC::print_errs();
155 Crypt::OpenSSL::EC::EC_POINT::new($group);
156 Creates a new EC_POINT object for the specified EC_GROUP
157 group EC_GROUP the underlying EC_GROUP object
158 return newly created EC_POINT object or NULL if an error occurred
159
160 Crypt::OpenSSL::EC::EC_POINT::free($point);
161 Frees a EC_POINT object
162 point EC_POINT object to be freed This should normally not be
163 called from Perl, since EC_POINT objects created by this library
164 are auto-destroyed when they become unreferenced.
165
166 Crypt::OpenSSL::EC::EC_POINT::clear_free($point);
167 Clears and frees a EC_POINT object
168 point EC_POINT object to be cleared and freed This should
169 normally not be called from Perl, since EC_POINT objects created by
170 this library are auto-destroyed when they become unreferenced.
171
172 Crypt::OpenSSL::EC::EC_POINT::copy($dst, $src);
173 Copies EC_POINT object
174 dst destination EC_POINT object
175 src source EC_POINT object
176 return 1 on success and 0 if an error occured
177
178 Crypt::OpenSSL::EC::EC_POINT::dup($src, $group);
179 Creates a new EC_POINT object and copies the content of the
180 supplied EC_POINT
181 src source EC_POINT object
182 group underlying the EC_GROUP object
183 return newly created EC_POINT object or NULL if an error occurred
184
185 Crypt::OpenSSL::EC::EC_POINT::set_to_infinity($group, $point);
186 Sets a point to infinity (neutral element)
187 group underlying EC_GROUP object
188 point EC_POINT to set to infinity
189 return 1 on success and 0 if an error occured
190
191 Crypt::OpenSSL::EC::EC_POINT::get_Jprojective_coordinates_GFp($group,
192 $p, $x, $y, $z, $ctx);
193 Gets the jacobian projective coordinates of a EC_POINT over GFp
194 group underlying EC_GROUP object
195 p EC_POINT object
196 x BIGNUM for the x-coordinate
197 y BIGNUM for the y-coordinate
198 z BIGNUM for the z-coordinate
199 ctx BN_CTX object (optional)
200 return 1 on success and 0 if an error occured
201
202 Crypt::OpenSSL::EC::EC_POINT::set_affine_coordinates_GFp($group, $p,
203 $x, $y, $ctx);
204 Sets the affine coordinates of a EC_POINT over GFp
205 group underlying EC_GROUP object
206 p EC_POINT object
207 x BIGNUM with the x-coordinate
208 y BIGNUM with the y-coordinate
209 ctx BN_CTX object (optional)
210 return 1 on success and 0 if an error occured
211
212 Crypt::OpenSSL::EC::EC_POINT::get_affine_coordinates_GFp($group, $p,
213 $x, $y, $ctx);
214 Gets the affine coordinates of a EC_POINT over GFp
215 group underlying EC_GROUP object
216 p EC_POINT object
217 x BIGNUM for the x-coordinate
218 y BIGNUM for the y-coordinate
219 ctx BN_CTX object (optional)
220 return 1 on success and 0 if an error occured
221
222 Crypt::OpenSSL::EC::EC_POINT::set_compressed_coordinates_GFp($group,
223 $p, $x, $y_bit, $ctx);
224 Sets the x9.62 compressed coordinates of a EC_POINT over GFp
225 group underlying EC_GROUP object
226 p EC_POINT object
227 x BIGNUM with x-coordinate
228 y_bit integer with the y-Bit (either 0 or 1)
229 ctx BN_CTX object (optional)
230 return 1 on success and 0 if an error occured
231
232 Crypt::OpenSSL::EC::EC_POINT::set_affine_coordinates_GF2m($group, $p,
233 $x, $y, $ctx);
234 Not available if OPENSSL_NO_EC2M is defined in OpenSSL.
235
236 Sets the affine coordinates of a EC_POINT over GF2m
237 group underlying EC_GROUP object
238 p EC_POINT object
239 x BIGNUM with the x-coordinate
240 y BIGNUM with the y-coordinate
241 ctx BN_CTX object (optional)
242 return 1 on success and 0 if an error occured
243
244 Crypt::OpenSSL::EC::EC_POINT::get_affine_coordinates_GF2m($group, $p,
245 $x, $y, $ctx);
246 Not available if OPENSSL_NO_EC2M is defined in OpenSSL.
247
248 Gets the affine coordinates of a EC_POINT over GF2m
249 group underlying EC_GROUP object
250 p EC_POINT object
251 x BIGNUM for the x-coordinate
252 y BIGNUM for the y-coordinate
253 ctx BN_CTX object (optional)
254 return 1 on success and 0 if an error occured
255
256 Crypt::OpenSSL::EC::EC_POINT::set_compressed_coordinates_GF2m($group,
257 $p, $x, $y_bit, $ctx);
258 Not available if OPENSSL_NO_EC2M is defined in OpenSSL.
259
260 Sets the x9.62 compressed coordinates of a EC_POINT over GF2m
261 group underlying EC_GROUP object
262 p EC_POINT object
263 x BIGNUM with x-coordinate
264 y_bit integer with the y-Bit (either 0 or 1)
265 ctx BN_CTX object (optional)
266 \return 1 on success and 0 if an error occured
267
268 Crypt::OpenSSL::EC::EC_POINT::is_at_infinity($group, $p);
269 Checks whether the point is the neutral element of the group
270 group the underlying EC_GROUP object
271 p EC_POINT object
272 return 1 if the point is the neutral element and 0 otherwise
273
274 Crypt::OpenSSL::EC::EC_POINT::point2oct($group, $p, $form, $ctx);
275 Encodes a EC_POINT object to a octet string
276 group underlying EC_GROUP object
277 p EC_POINT object
278 form point conversion form
279 ctx BN_CTX object (optional)
280 return the encoded EC point
281
282 Crypt::OpenSSL::EC::EC_POINT::oct2point($group, $p, $buf, $ctx);
283 Decodes a EC_POINT from a octet string
284 group underlying EC_GROUP object
285 p EC_POINT object
286 buf buffer with the encoded ec point
287 ctx BN_CTX object (optional)
288 return 1 on success and 0 if an error occured
289
290 Crypt::OpenSSL::EC::EC_POINT::point2bn($group, $p, $form, $bn, $ctx);
291 Crypt::OpenSSL::EC::EC_POINT::bn2point($group, $bn, $p, $ctx);
292 Crypt::OpenSSL::EC::EC_POINT::point2hex($group, $p, $form, $bn, $ctx);
293 Crypt::OpenSSL::EC::EC_POINT::hex2point($group, $bn, $p, $ctx);
294 Crypt::OpenSSL::EC::EC_POINT::add($group, $r, $a, $b, $ctx);
295 Computes the sum of two EC_POINT
296 group underlying EC_GROUP object
297 r EC_POINT object for the result (r = a + b)
298 a EC_POINT object with the first summand
299 b EC_POINT object with the second summand
300 ctx BN_CTX object (optional)
301 return 1 on success and 0 if an error occured
302
303 Crypt::OpenSSL::EC::EC_POINT::dbl($group, $r, $a, $ctx);
304 Computes the double of a EC_POINT
305 group underlying EC_GROUP object
306 r EC_POINT object for the result (r = 2 * a)
307 a EC_POINT object
308 ctx BN_CTX object (optional)
309 return 1 on success and 0 if an error occured
310
311 Crypt::OpenSSL::EC::EC_POINT::invert($group, $a, $ctx);
312 Computes the inverse of a EC_POINT
313 group underlying EC_GROUP object
314 a EC_POINT object to be inverted (it's used for the result
315 as well)
316 ctx BN_CTX object (optional)
317 return 1 on success and 0 if an error occured
318
319 Crypt::OpenSSL::EC::EC_POINT::is_on_curve($group, $point, $ctx));
320 Checks whether the point is on the curve
321 group underlying EC_GROUP object
322 point EC_POINT object to check
323 ctx BN_CTX object (optional)
324 return 1 if point if on the curve and 0 otherwise
325
326 Crypt::OpenSSL::EC::EC_POINT::cmp($group, $a, $b, $ctx);
327 Compares two EC_POINTs
328 group underlying EC_GROUP object
329 a first EC_POINT object
330 b second EC_POINT object
331 ctx BN_CTX object (optional)
332 return 0 if both points are equal and a value != 0 otherwise
333
334 Crypt::OpenSSL::EC::EC_POINT::make_affine($group, $point, $ct);
335 Crypt::OpenSSL::EC::EC_POINTs::make_affine
336 Not Implemented
337
338 Crypt::OpenSSL::EC::EC_POINTs::mul
339 Not Implemented
340
341 Crypt::OpenSSL::EC::EC_GROUP::set_generator($group, $generator, $order,
342 $cofactor);
343 Sets the generator and it's order/cofactor of a EC_GROUP object.
344 group EC_GROUP object
345 generator EC_POINT object with the generator.
346 order the order of the group generated by the generator.
347 cofactor the index of the sub-group generated by the generator
348 in the group of all points on the elliptic curve.
349 return 1 on success and 0 if an error occured
350
351 Crypt::OpenSSL::EC::EC_GROUP::get0_generator($group);
352 Returns the generator of a EC_GROUP object.
353
354 group EC_GROUP object
355
356 return the currently used generator (possibly NULL).
357
358 Crypt::OpenSSL::EC::EC_GROUP::get_degree($group)
359 Returns the number of bits needed to represent a field element
360 group EC_GROUP object
361 return number of bits needed to represent a field element
362
363 Crypt::OpenSSL::EC::EC_GROUP::check($group, $ctx);
364 Checks whether the parameter in the EC_GROUP define a valid ec
365 group
366 group EC_GROUP object
367 ctx BN_CTX object (optional)
368 return 1 if group is a valid ec group and 0 otherwise
369
370 Crypt::OpenSSL::EC::EC_GROUP::check_discriminant($group, $ctx);
371 Checks whether the discriminant of the elliptic curve is zero or
372 not
373 group EC_GROUP object
374 ctx BN_CTX object (optional)
375 return 1 if the discriminant is not zero and 0 otherwise
376
377 Crypt::OpenSSL::EC:: EC_GROUP::cmp($a, $b, $ctx);
378 Compares two EC_GROUP objects
379 a first EC_GROUP object
380 b second EC_GROUP object
381 ctx BN_CTX object (optional)
382 return 0 if both groups are equal and 1 otherwise
383
384 Crypt::OpenSSL::EC::EC::EC_GROUP::new_curve_GFp($p, $a, $b, $ctx);
385 Creates a new EC_GROUP object with the specified parameters defined
386 over GFp (defined by the equation y^2 = x^3 + a*x + b)
387 p BIGNUM with the prime number
388 a BIGNUM with the parameter a of the equation
389 b BIGNUM with the parameter b of the equation
390 ctx BN_CTX object (optional)
391 return newly created EC_GROUP object with the specified
392 parameters
393
394 Crypt::OpenSSL::EC::EC_GROUP::new_curve_GF2m($p, $a, $b, $ctx);
395 Not available if OPENSSL_NO_EC2M is defined in OpenSSL.
396
397 Creates a new EC_GROUP object with the specified parameters defined
398 over GF2m (defined by the equation y^2 + x*y = x^3 + a*x^2 + b)
399 p BIGNUM with the polynomial defining the underlying field
400 a BIGNUM with the parameter a of the equation
401 b BIGNUM with the parameter b of the equation
402 ctx BN_CTX object (optional)
403 return newly created EC_GROUP object with the specified
404 parameters
405
406 Crypt::OpenSSL::EC::EC_GROUP::new_by_curve_name($nid);
407 Creates a EC_GROUP object with a curve specified by a NID
408 nid NID of the OID of the curve name
409 return newly created EC_GROUP object with specified curve or NULL
410 if an error occurred
411
412 Crypt::OpenSSL::EC::EC_get_builtin_curves($r, $nitems);
413 EC_builtin_curves(EC_builtin_curve *r, size_t size) returns number
414 of all available curves or zero if a error occurred. In case r ist
415 not zero nitems EC_builtin_curve structures are filled with the
416 data of the first nitems internal groups
417
418 Crypt::OpenSSL::EC::EC_GROUP::get_order($group, $order, $ctx);
419 Gets the order of a EC_GROUP
420
421 group EC_GROUP object
422 order BIGNUM to which the order is copied
423 ctx BN_CTX object (optional)
424 return 1 on success and 0 if an error occured
425
426 Crypt::OpenSSL::EC::EC_GROUP::get_cofactor($group, $cofactopr, $ctx)
427 Gets the cofactor of a EC_GROUP
428
429 group EC_GROUP object
430 cofactor BIGNUM to which the cofactor is copied
431 ctx BN_CTX object (optional)
432 return 1 on success and 0 if an error occured
433
434 Crypt::OpenSSL::EC::EC_GROUP::set_curve_name($group, $nid);
435 Sets the name of a EC_GROUP object
436 group EC_GROUP object
437 nid NID of the curve name OID
438
439 Crypt::OpenSSL::EC::EC_GROUP::get_curve_name($group);
440 Returns the curve name of a EC_GROUP object
441 group EC_GROUP object
442 return NID of the curve name OID or 0 if not set.
443
444 Crypt::OpenSSL::EC::EC_GROUP::set_asn1_flag($group, $flag);
445 Sets the ASN flag for the group
446
447 Crypt::OpenSSL::EC::EC_GROUP::get_asn1_flag($group);
448 Returns the ASN flag for the group
449
450 Crypt::OpenSSL::EC::EC_GROUP::set_point_conversion_form($group, $form);
451 Sets the point conversion form.
452
453 Crypt::OpenSSL::EC::EC_GROUP::get_point_conversion_form($group);
454 Retuns the point conversion for for the group
455
456 Crypt::OpenSSL::EC::EC_GROUP::get0_seed($group);
457 Returns the 0 seed
458
459 Crypt::OpenSSL::EC::EC_GROUP::get_seed_len($group);
460 Returns the seed length
461
462 Crypt::OpenSSL::EC::EC_GROUP::set_seed($group, $seed);
463 Sets the group seed
464
465 Crypt::OpenSSL::EC::EC_POINT::mul($group, $r, $n, $q, $m, $ctx));
466 Computes r = generator * n + q * m
467 group underlying EC_GROUP object
468 r EC_POINT object for the result
469 n BIGNUM with the multiplier for the group generator
470 (optional)
471 q EC_POINT object with the first factor of the second
472 summand
473 m BIGNUM with the second factor of the second summand
474 ctx BN_CTX object (optional)
475 return 1 on success and 0 if an error occured
476
477 Crypt::OpenSSL::EC::EC_GROUP::precompute_mult($group, $ctx);
478 Stores multiples of generator for faster point multiplication
479 group EC_GROUP object
480 ctx BN_CTX object (optional)
481 return 1 on success and 0 if an error occured
482
483 Crypt::OpenSSL::EC::EC_GROUP::have_precompute_mult($group);
484 Reports whether a precomputation has been done
485 group EC_GROUP object
486 return 1 if a pre-computation has been done and 0 otherwise
487
488 Crypt::OpenSSL::EC::EC_GROUP::get_basis_type($group);
489 EC_GROUP_get_basis_type() returns the NID of the basis type used to
490 represent the field elements
491
492 Crypt::OpenSSL::EC::EC_GROUP::get_trinomial_basis($group, $k);
493 Not available if OPENSSL_NO_EC2M is defined in OpenSSL.
494
495 Crypt::OpenSSL::EC:: EC_GROUP::get_pentanomial_basis($group, $k1, $k2,
496 $k3);
497 Not available if OPENSSL_NO_EC2M is defined in OpenSSL.
498
499 Crypt::OpenSSL::EC::EC_GROUP::free($group);
500 Frees a EC_GROUP object. This should normally not be called from
501 Perl, since EC_GROUP objects created by this library are auto-
502 destroyed when they become unreferenced.
503
504 Crypt::OpenSSL::EC::EC_GROUP::clear_free($group);
505 Clears and frees a EC_GROUP object This should normally not be
506 called from Perl, since EC_GROUP objects created by this library
507 are auto-destroyed when they become unreferenced.
508
509 Crypt::OpenSSL::EC::EC_KEY::new(); Creates a new EC_KEY object. return
510 EC_KEY object or NULL if an error occurred.
511 Crypt::OpenSSL::EC::EC_KEY::new_by_curve_name($nid);
512 Creates a new EC_KEY object using a named curve as underlying
513 EC_GROUP object.
514 nid NID of the named curve.
515 return EC_KEY object or NULL if an error occurred.
516
517 Crypt::OpenSSL::EC::EC_KEY::free($key);
518 Frees a EC_KEY object.
519 key EC_KEY object to be freed. This should normally not be
520 called from Perl, since EC_KEY objects created by this library are
521 auto-destroyed when they become unreferenced.
522
523 Crypt::OpenSSL::EC::EC_KEY::copy($dst, $src);
524 Copies a EC_KEY object.
525 dst destination EC_KEY object
526 src src EC_KEY object
527 return dst or NULL if an error occurred.
528
529 Crypt::OpenSSL::EC::EC_KEY::dup($src);
530 Creates a new EC_KEY object and copies the content from src to it.
531 src the source EC_KEY object
532 return newly created EC_KEY object or NULL if an error occurred.
533
534 Crypt::OpenSSL::EC::EC_KEY::up_ref($key);
535 Increases the internal reference count of a EC_KEY object.
536 key EC_KEY object
537 return 1 on success and 0 if an error occurred.
538
539 Crypt::OpenSSL::EC::EC_KEY::get0_group($key);
540 Returns the EC_GROUP object of a EC_KEY object
541 key EC_KEY object
542 \return the EC_GROUP object (possibly NULL).
543
544 Crypt::OpenSSL::EC::EC_KEY::set_group($key, $group);
545 Sets the EC_GROUP of a EC_KEY object.
546 key EC_KEY object
547 group EC_GROUP to use in the EC_KEY object (note: the EC_KEY
548 object will use an own copy of the EC_GROUP).
549 return 1 on success and 0 if an error occurred.
550
551 Crypt::OpenSSL::EC::EC_KEY::set_private_key($key, $prv);
552 Sets the private key of a EC_KEY object.
553 key EC_KEY object
554 prv BIGNUM with the private key (note: the EC_KEY object
555 will use an own copy of the BIGNUM).
556 return 1 on success and 0 if an error occurred.
557
558 Crypt::OpenSSL::EC::EC_KEY::get0_public_key($key);
559 Returns the public key of a EC_KEY object.
560 key the EC_KEY object
561 return a EC_POINT object with the public key (possibly NULL)
562
563 Crypt::OpenSSL::EC::EC_KEY::set_public_key($key, $pub);
564 Sets the public key of a EC_KEY object.
565 key EC_KEY object
566 pub EC_POINT object with the public key (note: the EC_KEY object
567 will use an own copy of the EC_POINT object).
568 return 1 on success and 0 if an error occurred.
569
570 Crypt::OpenSSL::EC::EC_KEY::get_enc_flags($key);
571 Crypt::OpenSSL::EC::EC_KEY::set_enc_flags($key, $flags);
572 Crypt::OpenSSL::EC::EC_KEY::get_conv_form($key)
573 Crypt::OpenSSL::EC::EC_KEY::set_conv_form($key, $form);
574 Crypt::OpenSSL::EC::EC_KEY::get_key_method_data
575 Not Implemented
576
577 Crypt::OpenSSL::EC::EC_KEY::insert_key_method_data
578 Not Implemented
579
580 Crypt::OpenSSL::EC::EC_KEY::set_asn1_flag($key, $flag);
581 Crypt::OpenSSL::EC::EC_KEY::precompute_mult($key, $ctx);
582 Creates a table of pre-computed multiples of the generator to
583 further EC_KEY operations.
584 key EC_KEY object
585 ctx BN_CTX object (optional)
586 return 1 on success and 0 if an error occurred.
587
588 Crypt::OpenSSL::EC::EC_KEY::generate_key($key);
589 Creates a new ec private (and optional a new public) key.
590 key EC_KEY object
591 return 1 on success and 0 if an error occurred.
592
593 Crypt::OpenSSL::EC::EC_KEY::check_key($key);
594 Verifies that a private and/or public key is valid.
595 key the EC_KEY object
596 return 1 on success and 0 otherwise.
597
598 EXPORT
599 None by default.
600
601 Exportable constants
602 EC_F_COMPUTE_WNAF
603 EC_F_D2I_ECPARAMETERS
604 EC_F_D2I_ECPKPARAMETERS
605 EC_F_D2I_ECPRIVATEKEY
606 EC_F_DO_EC_KEY_PRINT
607 EC_F_ECKEY_PARAM2TYPE
608 EC_F_ECKEY_PARAM_DECODE
609 EC_F_ECKEY_PRIV_DECODE
610 EC_F_ECKEY_PRIV_ENCODE
611 EC_F_ECKEY_PUB_DECODE
612 EC_F_ECKEY_PUB_ENCODE
613 EC_F_ECKEY_TYPE2PARAM
614 EC_F_ECPARAMETERS_PRINT
615 EC_F_ECPARAMETERS_PRINT_FP
616 EC_F_ECPKPARAMETERS_PRINT
617 EC_F_ECPKPARAMETERS_PRINT_FP
618 EC_F_ECP_NIST_MOD_192
619 EC_F_ECP_NIST_MOD_224
620 EC_F_ECP_NIST_MOD_256
621 EC_F_ECP_NIST_MOD_521
622 EC_F_EC_ASN1_GROUP2CURVE
623 EC_F_EC_ASN1_GROUP2FIELDID
624 EC_F_EC_ASN1_GROUP2PARAMETERS
625 EC_F_EC_ASN1_GROUP2PKPARAMETERS
626 EC_F_EC_ASN1_PARAMETERS2GROUP
627 EC_F_EC_ASN1_PKPARAMETERS2GROUP
628 EC_F_EC_EX_DATA_SET_DATA
629 EC_F_EC_GF2M_MONTGOMERY_POINT_MULTIPLY
630 EC_F_EC_GF2M_SIMPLE_GROUP_CHECK_DISCRIMINANT
631 EC_F_EC_GF2M_SIMPLE_GROUP_SET_CURVE
632 EC_F_EC_GF2M_SIMPLE_OCT2POINT
633 EC_F_EC_GF2M_SIMPLE_POINT2OCT
634 EC_F_EC_GF2M_SIMPLE_POINT_GET_AFFINE_COORDINATES
635 EC_F_EC_GF2M_SIMPLE_POINT_SET_AFFINE_COORDINATES
636 EC_F_EC_GF2M_SIMPLE_SET_COMPRESSED_COORDINATES
637 EC_F_EC_GFP_MONT_FIELD_DECODE
638 EC_F_EC_GFP_MONT_FIELD_ENCODE
639 EC_F_EC_GFP_MONT_FIELD_MUL
640 EC_F_EC_GFP_MONT_FIELD_SET_TO_ONE
641 EC_F_EC_GFP_MONT_FIELD_SQR
642 EC_F_EC_GFP_MONT_GROUP_SET_CURVE
643 EC_F_EC_GFP_MONT_GROUP_SET_CURVE_GFP
644 EC_F_EC_GFP_NIST_FIELD_MUL
645 EC_F_EC_GFP_NIST_FIELD_SQR
646 EC_F_EC_GFP_NIST_GROUP_SET_CURVE
647 EC_F_EC_GFP_SIMPLE_GROUP_CHECK_DISCRIMINANT
648 EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE
649 EC_F_EC_GFP_SIMPLE_GROUP_SET_CURVE_GFP
650 EC_F_EC_GFP_SIMPLE_GROUP_SET_GENERATOR
651 EC_F_EC_GFP_SIMPLE_MAKE_AFFINE
652 EC_F_EC_GFP_SIMPLE_OCT2POINT
653 EC_F_EC_GFP_SIMPLE_POINT2OCT
654 EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE
655 EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES
656 EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES_GFP
657 EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES
658 EC_F_EC_GFP_SIMPLE_POINT_SET_AFFINE_COORDINATES_GFP
659 EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES
660 EC_F_EC_GFP_SIMPLE_SET_COMPRESSED_COORDINATES_GFP
661 EC_F_EC_GROUP_CHECK
662 EC_F_EC_GROUP_CHECK_DISCRIMINANT
663 EC_F_EC_GROUP_COPY
664 EC_F_EC_GROUP_GET0_GENERATOR
665 EC_F_EC_GROUP_GET_COFACTOR
666 EC_F_EC_GROUP_GET_CURVE_GF2M
667 EC_F_EC_GROUP_GET_CURVE_GFP
668 EC_F_EC_GROUP_GET_DEGREE
669 EC_F_EC_GROUP_GET_ORDER
670 EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS
671 EC_F_EC_GROUP_GET_TRINOMIAL_BASIS
672 EC_F_EC_GROUP_NEW
673 EC_F_EC_GROUP_NEW_BY_CURVE_NAME
674 EC_F_EC_GROUP_NEW_FROM_DATA
675 EC_F_EC_GROUP_PRECOMPUTE_MULT
676 EC_F_EC_GROUP_SET_CURVE_GF2M
677 EC_F_EC_GROUP_SET_CURVE_GFP
678 EC_F_EC_GROUP_SET_EXTRA_DATA
679 EC_F_EC_GROUP_SET_GENERATOR
680 EC_F_EC_KEY_CHECK_KEY
681 EC_F_EC_KEY_COPY
682 EC_F_EC_KEY_GENERATE_KEY
683 EC_F_EC_KEY_NEW
684 EC_F_EC_KEY_PRINT
685 EC_F_EC_KEY_PRINT_FP
686 EC_F_EC_POINTS_MAKE_AFFINE
687 EC_F_EC_POINT_ADD
688 EC_F_EC_POINT_CMP
689 EC_F_EC_POINT_COPY
690 EC_F_EC_POINT_DBL
691 EC_F_EC_POINT_GET_AFFINE_COORDINATES_GF2Mg
692 EC_F_EC_POINT_GET_AFFINE_COORDINATES_GFP
693 EC_F_EC_POINT_GET_JPROJECTIVE_COORDINATES_GFP
694 EC_F_EC_POINT_INVERT
695 EC_F_EC_POINT_IS_AT_INFINITY
696 EC_F_EC_POINT_IS_ON_CURVE
697 EC_F_EC_POINT_MAKE_AFFINE
698 EC_F_EC_POINT_MUL
699 EC_F_EC_POINT_NEW
700 EC_F_EC_POINT_OCT2POINT
701 EC_F_EC_POINT_POINT2OCT
702 EC_F_EC_POINT_SET_AFFINE_COORDINATES_GF2M
703 EC_F_EC_POINT_SET_AFFINE_COORDINATES_GFP
704 EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GF2M
705 EC_F_EC_POINT_SET_COMPRESSED_COORDINATES_GFP
706 EC_F_EC_POINT_SET_JPROJECTIVE_COORDINATES_GFP
707 EC_F_EC_POINT_SET_TO_INFINITY
708 EC_F_EC_PRE_COMP_DUP
709 EC_F_EC_PRE_COMP_NEW
710 EC_F_EC_WNAF_MUL
711 EC_F_EC_WNAF_PRECOMPUTE_MULT
712 EC_F_I2D_ECPARAMETERS
713 EC_F_I2D_ECPKPARAMETERS
714 EC_F_I2D_ECPRIVATEKEY
715 EC_F_I2O_ECPUBLICKEY
716 EC_F_O2I_ECPUBLICKEY
717 EC_F_OLD_EC_PRIV_DECODE
718 EC_F_PKEY_EC_CTRL
719 EC_F_PKEY_EC_CTRL_STR
720 EC_F_PKEY_EC_DERIVE
721 EC_F_PKEY_EC_KEYGEN
722 EC_F_PKEY_EC_PARAMGEN
723 EC_F_PKEY_EC_SIGN
724 EC_PKEY_NO_PARAMETERS
725 EC_PKEY_NO_PUBKEY
726 EC_R_ASN1_ERROR
727 EC_R_ASN1_UNKNOWN_FIELD
728 EC_R_BUFFER_TOO_SMALL
729 EC_R_D2I_ECPKPARAMETERS_FAILURE
730 EC_R_DECODE_ERROR
731 EC_R_DISCRIMINANT_IS_ZERO
732 EC_R_EC_GROUP_NEW_BY_NAME_FAILURE
733 EC_R_FIELD_TOO_LARGE
734 EC_R_GROUP2PKPARAMETERS_FAILURE
735 EC_R_I2D_ECPKPARAMETERS_FAILURE
736 EC_R_INCOMPATIBLE_OBJECTS
737 EC_R_INVALID_ARGUMENT
738 EC_R_INVALID_COMPRESSED_POINT
739 EC_R_INVALID_COMPRESSION_BIT
740 EC_R_INVALID_CURVE
741 EC_R_INVALID_DIGEST_TYPE
742 EC_R_INVALID_ENCODING
743 EC_R_INVALID_FIELD
744 EC_R_INVALID_FORM
745 EC_R_INVALID_GROUP_ORDER
746 EC_R_INVALID_PENTANOMIAL_BASIS
747 EC_R_INVALID_PRIVATE_KEY
748 EC_R_INVALID_TRINOMIAL_BASIS
749 EC_R_KEYS_NOT_SET
750 EC_R_MISSING_PARAMETERS
751 EC_R_MISSING_PRIVATE_KEY
752 EC_R_NOT_A_NIST_PRIME
753 EC_R_NOT_A_SUPPORTED_NIST_PRIME
754 EC_R_NOT_IMPLEMENTED
755 EC_R_NOT_INITIALIZED
756 EC_R_NO_FIELD_MOD
757 EC_R_NO_PARAMETERS_SET
758 EC_R_PASSED_NULL_PARAMETER
759 EC_R_PKPARAMETERS2GROUP_FAILURE
760 EC_R_POINT_AT_INFINITY
761 EC_R_POINT_IS_NOT_ON_CURVE
762 EC_R_SLOT_FULL
763 EC_R_UNDEFINED_GENERATOR
764 EC_R_UNDEFINED_ORDER
765 EC_R_UNKNOWN_GROUP
766 EC_R_UNKNOWN_ORDER
767 EC_R_UNSUPPORTED_FIELD
768 EC_R_WRONG_ORDER
769 EVP_PKEY_CTRL_EC_PARAMGEN_CURVE_NID
770 OPENSSL_ECC_MAX_FIELD_BITS
771 OPENSSL_EC_NAMED_CURVE
772 POINT_CONVERSION_COMPRESSED
773 POINT_CONVERSION_HYBRID
774 POINT_CONVERSION_UNCOMPRESSED
775
777 Crypt::OpenSSL::Bignum
778
779 OpenSSL
780
782 Mike McCauley, <mikem@airspayce.com>
783
785 Copyright (C) 2012 by Mike McCauley
786
787 This library is free software; you can redistribute it and/or modify it
788 under the same terms as Perl itself, either Perl version 5.14.2 or, at
789 your option, any later version of Perl 5 you may have available.
790
791
792
793perl v5.30.0 2019-07-26 Crypt::OpenSSL::EC(3)