Class: OpenSSL::PKey::EC::Point
Defined Under Namespace
Classes: Error
Instance Method Summary (collapse)
- - (Object) ==(point2)
- - (Object) infinity?
-
- (Object) initialize
constructor
See the OpenSSL documentation for EC_POINT_*.
- - (Point) invert!
- - (Point) make_affine!
- - (Object) on_curve?
- - (Point) set_to_infinity!
-
- (Object) to_bn
See the OpenSSL documentation for EC_POINT_point2bn().
Constructor Details
- (Object) OpenSSL::PKey::EC::Point.new(point) - (Object) OpenSSL::PKey::EC::Point.new(group) - (Object) OpenSSL::PKey::EC::Point.new(group, bn)
See the OpenSSL documentation for EC_POINT_*
|
|
# File 'ext/openssl/ossl_pkey_ec.c'
static VALUE ossl_ec_point_initialize(int argc, VALUE *argv, VALUE self)
{
ossl_ec_point *ec_point;
EC_POINT *point = NULL;
VALUE arg1, arg2;
VALUE group_v = Qnil;
const EC_GROUP *group = NULL;
Data_Get_Struct(self, ossl_ec_point, ec_point);
if (ec_point->point)
rb_raise(eEC_POINT, "EC_POINT already initialized");
switch (rb_scan_args(argc, argv, "11", &arg1, &arg2)) {
case 1:
if (rb_obj_is_kind_of(arg1, cEC_POINT)) {
const EC_POINT *arg_point;
group_v = rb_iv_get(arg1, "@group");
SafeRequire_EC_GROUP(group_v, group);
SafeRequire_EC_POINT(arg1, arg_point);
point = EC_POINT_dup(arg_point, group);
}
|
Instance Method Details
- (Object) ==(point2)
|
|
# File 'ext/openssl/ossl_pkey_ec.c'
static VALUE ossl_ec_point_eql(VALUE a, VALUE b)
{
EC_POINT *point1, *point2;
VALUE group_v1 = rb_iv_get(a, "@group");
VALUE group_v2 = rb_iv_get(b, "@group");
const EC_GROUP *group;
if (ossl_ec_group_eql(group_v1, group_v2) == Qfalse)
return Qfalse;
Require_EC_POINT(a, point1);
SafeRequire_EC_POINT(b, point2);
SafeRequire_EC_GROUP(group_v1, group);
if (EC_POINT_cmp(group, point1, point2, ossl_bn_ctx) == 1)
return Qfalse;
return Qtrue;
}
|
- (Object) infinity?
|
|
# File 'ext/openssl/ossl_pkey_ec.c'
static VALUE ossl_ec_point_is_at_infinity(VALUE self)
{
EC_POINT *point;
VALUE group_v = rb_iv_get(self, "@group");
const EC_GROUP *group;
Require_EC_POINT(self, point);
SafeRequire_EC_GROUP(group_v, group);
switch (EC_POINT_is_at_infinity(group, point)) {
case 1: return Qtrue;
case 0: return Qfalse;
default: ossl_raise(cEC_POINT, "EC_POINT_is_at_infinity");
}
|
- (Point) invert!
|
|
# File 'ext/openssl/ossl_pkey_ec.c'
static VALUE ossl_ec_point_invert(VALUE self)
{
EC_POINT *point;
VALUE group_v = rb_iv_get(self, "@group");
const EC_GROUP *group;
Require_EC_POINT(self, point);
SafeRequire_EC_GROUP(group_v, group);
if (EC_POINT_invert(group, point, ossl_bn_ctx) != 1)
ossl_raise(cEC_POINT, "EC_POINT_invert");
return self;
}
|
- (Point) make_affine!
|
|
# File 'ext/openssl/ossl_pkey_ec.c'
static VALUE ossl_ec_point_make_affine(VALUE self)
{
EC_POINT *point;
VALUE group_v = rb_iv_get(self, "@group");
const EC_GROUP *group;
Require_EC_POINT(self, point);
SafeRequire_EC_GROUP(group_v, group);
if (EC_POINT_make_affine(group, point, ossl_bn_ctx) != 1)
ossl_raise(cEC_POINT, "EC_POINT_make_affine");
return self;
}
|
- (Object) on_curve?
|
|
# File 'ext/openssl/ossl_pkey_ec.c'
static VALUE ossl_ec_point_is_on_curve(VALUE self)
{
EC_POINT *point;
VALUE group_v = rb_iv_get(self, "@group");
const EC_GROUP *group;
Require_EC_POINT(self, point);
SafeRequire_EC_GROUP(group_v, group);
switch (EC_POINT_is_on_curve(group, point, ossl_bn_ctx)) {
case 1: return Qtrue;
case 0: return Qfalse;
default: ossl_raise(cEC_POINT, "EC_POINT_is_on_curve");
}
|
- (Point) set_to_infinity!
|
|
# File 'ext/openssl/ossl_pkey_ec.c'
static VALUE ossl_ec_point_set_to_infinity(VALUE self)
{
EC_POINT *point;
VALUE group_v = rb_iv_get(self, "@group");
const EC_GROUP *group;
Require_EC_POINT(self, point);
SafeRequire_EC_GROUP(group_v, group);
if (EC_POINT_set_to_infinity(group, point) != 1)
ossl_raise(cEC_POINT, "EC_POINT_set_to_infinity");
return self;
}
|
- (Object) to_bn
See the OpenSSL documentation for EC_POINT_point2bn()
|
|
# File 'ext/openssl/ossl_pkey_ec.c'
static VALUE ossl_ec_point_to_bn(VALUE self)
{
EC_POINT *point;
VALUE bn_obj;
VALUE group_v = rb_iv_get(self, "@group");
const EC_GROUP *group;
point_conversion_form_t form;
BIGNUM *bn;
Require_EC_POINT(self, point);
SafeRequire_EC_GROUP(group_v, group);
form = EC_GROUP_get_point_conversion_form(group);
bn_obj = rb_obj_alloc(cBN);
bn = GetBNPtr(bn_obj);
if (EC_POINT_point2bn(group, point, form, bn, ossl_bn_ctx) == NULL)
ossl_raise(eEC_POINT, "EC_POINT_point2bn");
return bn_obj;
}
|