d2i_ECPKParameters.pod 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. =pod
  2. =head1 NAME
  3. d2i_ECPKParameters, i2d_ECPKParameters, d2i_ECPKParameters_bio, i2d_ECPKParameters_bio, d2i_ECPKParameters_fp, i2d_ECPKParameters_fp, ECPKParameters_print, ECPKParameters_print_fp - Functions for decoding and encoding ASN1 representations of elliptic curve entities
  4. =head1 SYNOPSIS
  5. #include <openssl/ec.h>
  6. EC_GROUP *d2i_ECPKParameters(EC_GROUP **px, const unsigned char **in, long len);
  7. int i2d_ECPKParameters(const EC_GROUP *x, unsigned char **out);
  8. #define d2i_ECPKParameters_bio(bp,x) ASN1_d2i_bio_of(EC_GROUP,NULL,d2i_ECPKParameters,bp,x)
  9. #define i2d_ECPKParameters_bio(bp,x) ASN1_i2d_bio_of_const(EC_GROUP,i2d_ECPKParameters,bp,x)
  10. #define d2i_ECPKParameters_fp(fp,x) (EC_GROUP *)ASN1_d2i_fp(NULL, \
  11. (char *(*)())d2i_ECPKParameters,(fp),(unsigned char **)(x))
  12. #define i2d_ECPKParameters_fp(fp,x) ASN1_i2d_fp(i2d_ECPKParameters,(fp), \
  13. (unsigned char *)(x))
  14. int ECPKParameters_print(BIO *bp, const EC_GROUP *x, int off);
  15. int ECPKParameters_print_fp(FILE *fp, const EC_GROUP *x, int off);
  16. =head1 DESCRIPTION
  17. The ECPKParameters encode and decode routines encode and parse the public parameters for an
  18. B<EC_GROUP> structure, which represents a curve.
  19. d2i_ECPKParameters() attempts to decode B<len> bytes at B<*in>. If
  20. successful a pointer to the B<EC_GROUP> structure is returned. If an error
  21. occurred then B<NULL> is returned. If B<px> is not B<NULL> then the
  22. returned structure is written to B<*px>. If B<*px> is not B<NULL>
  23. then it is assumed that B<*px> contains a valid B<EC_GROUP>
  24. structure and an attempt is made to reuse it. If the call is
  25. successful B<*in> is incremented to the byte following the
  26. parsed data.
  27. i2d_ECPKParameters() encodes the structure pointed to by B<x> into DER format.
  28. If B<out> is not B<NULL> is writes the DER encoded data to the buffer
  29. at B<*out>, and increments it to point after the data just written.
  30. If the return value is negative an error occurred, otherwise it
  31. returns the length of the encoded data.
  32. If B<*out> is B<NULL> memory will be allocated for a buffer and the encoded
  33. data written to it. In this case B<*out> is not incremented and it points to
  34. the start of the data just written.
  35. d2i_ECPKParameters_bio() is similar to d2i_ECPKParameters() except it attempts
  36. to parse data from BIO B<bp>.
  37. d2i_ECPKParameters_fp() is similar to d2i_ECPKParameters() except it attempts
  38. to parse data from FILE pointer B<fp>.
  39. i2d_ECPKParameters_bio() is similar to i2d_ECPKParameters() except it writes
  40. the encoding of the structure B<x> to BIO B<bp> and it
  41. returns 1 for success and 0 for failure.
  42. i2d_ECPKParameters_fp() is similar to i2d_ECPKParameters() except it writes
  43. the encoding of the structure B<x> to BIO B<bp> and it
  44. returns 1 for success and 0 for failure.
  45. These functions are very similar to the X509 functions described in L<d2i_X509(3)|d2i_X509(3)>,
  46. where further notes and examples are available.
  47. The ECPKParameters_print and ECPKParameters_print_fp functions print a human-readable output
  48. of the public parameters of the EC_GROUP to B<bp> or B<fp>. The output lines are indented by B<off> spaces.
  49. =head1 RETURN VALUES
  50. d2i_ECPKParameters(), d2i_ECPKParameters_bio() and d2i_ECPKParameters_fp() return a valid B<EC_GROUP> structure
  51. or B<NULL> if an error occurs.
  52. i2d_ECPKParameters() returns the number of bytes successfully encoded or a negative
  53. value if an error occurs.
  54. i2d_ECPKParameters_bio(), i2d_ECPKParameters_fp(), ECPKParameters_print and ECPKParameters_print_fp
  55. return 1 for success and 0 if an error occurs.
  56. =head1 SEE ALSO
  57. L<crypto(3)|crypto(3)>, L<ec(3)|ec(3)>, L<EC_GROUP_new(3)|EC_GROUP_new(3)>, L<EC_GROUP_copy(3)|EC_GROUP_copy(3)>,
  58. L<EC_POINT_new(3)|EC_POINT_new(3)>, L<EC_POINT_add(3)|EC_POINT_add(3)>, L<EC_KEY_new(3)|EC_KEY_new(3)>,
  59. L<EC_GFp_simple_method(3)|EC_GFp_simple_method(3)>, L<d2i_X509(3)|d2i_X509(3)>
  60. =cut