Method: OpenSSL::PKey::EC::Point#to_octet_string
- Defined in:
- ossl_pkey_ec.c
#to_octet_string(conversion_form) ⇒ String
Returns the octet string representation of the elliptic curve point.
conversion_form specifies how the point is converted. Possible values are:
-
:compressed
-
:uncompressed
-
:hybrid
1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 |
# File 'ossl_pkey_ec.c', line 1426
static VALUE
ossl_ec_point_to_octet_string(VALUE self, VALUE conversion_form)
{
EC_POINT *point;
const EC_GROUP *group;
point_conversion_form_t form;
VALUE str;
size_t len;
GetECPoint(self, point);
GetECPointGroup(self, group);
form = parse_point_conversion_form_symbol(conversion_form);
len = EC_POINT_point2oct(group, point, form, NULL, 0, ossl_bn_ctx);
if (!len)
ossl_raise(eEC_POINT, "EC_POINT_point2oct");
str = rb_str_new(NULL, (long)len);
if (!EC_POINT_point2oct(group, point, form,
(unsigned char *)RSTRING_PTR(str), len,
ossl_bn_ctx))
ossl_raise(eEC_POINT, "EC_POINT_point2oct");
return str;
}
|