Class: OpenSSL::ASN1::ObjectId
- Defined in:
- ossl_asn1.c,
ossl_asn1.c
Overview
Represents the primitive object id for OpenSSL::ASN1
Class Method Summary collapse
-
.OpenSSL::ASN1::ObjectId.register(object_id, short_name, long_name) ⇒ Object
This adds a new ObjectId to the internal tables.
Instance Method Summary collapse
-
#==(other_oid) ⇒ Boolean
Returns
true
if other_oid is the same as oid. -
#ln ⇒ Object
(also: #long_name)
The long name of the ObjectId, as defined in <openssl/objects.h>.
-
#oid ⇒ String
Returns a String representing the Object Identifier in the dot notation, e.g.
-
#sn ⇒ Object
(also: #short_name)
The short name of the ObjectId, as defined in <openssl/objects.h>.
Methods inherited from Primitive
Methods inherited from ASN1Data
Constructor Details
This class inherits a constructor from OpenSSL::ASN1::Primitive
Class Method Details
.OpenSSL::ASN1::ObjectId.register(object_id, short_name, long_name) ⇒ Object
This adds a new ObjectId to the internal tables. Where object_id is the numerical form, short_name is the short name, and long_name is the long name.
Returns true
if successful. Raises an OpenSSL::ASN1::ASN1Error if it fails.
1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 |
# File 'ossl_asn1.c', line 1235
static VALUE
ossl_asn1obj_s_register(VALUE self, VALUE oid, VALUE sn, VALUE ln)
{
StringValueCStr(oid);
StringValueCStr(sn);
StringValueCStr(ln);
if(!OBJ_create(RSTRING_PTR(oid), RSTRING_PTR(sn), RSTRING_PTR(ln)))
ossl_raise(eASN1Error, NULL);
return Qtrue;
}
|
Instance Method Details
#==(other_oid) ⇒ Boolean
Returns true
if other_oid is the same as oid
1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 |
# File 'ossl_asn1.c', line 1294
static VALUE
ossl_asn1obj_eq(VALUE self, VALUE other)
{
VALUE valSelf, valOther;
int nidSelf, nidOther;
valSelf = ossl_asn1_get_value(self);
valOther = ossl_asn1_get_value(other);
if ((nidSelf = OBJ_txt2nid(StringValueCStr(valSelf))) == NID_undef)
ossl_raise(eASN1Error, "OBJ_txt2nid");
if ((nidOther = OBJ_txt2nid(StringValueCStr(valOther))) == NID_undef)
ossl_raise(eASN1Error, "OBJ_txt2nid");
return nidSelf == nidOther ? Qtrue : Qfalse;
}
|
#ln ⇒ String #long_name ⇒ String Also known as: long_name
The long name of the ObjectId, as defined in <openssl/objects.h>.
1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 |
# File 'ossl_asn1.c', line 1275
static VALUE
ossl_asn1obj_get_ln(VALUE self)
{
VALUE val, ret = Qnil;
int nid;
val = ossl_asn1_get_value(self);
if ((nid = OBJ_txt2nid(StringValueCStr(val))) != NID_undef)
ret = rb_str_new2(OBJ_nid2ln(nid));
return ret;
}
|
#oid ⇒ String
Returns a String representing the Object Identifier in the dot notation, e.g. “1.2.3.4.5”
1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 |
# File 'ossl_asn1.c', line 1341
static VALUE
ossl_asn1obj_get_oid(VALUE self)
{
VALUE str;
ASN1_OBJECT *a1obj;
int state;
a1obj = obj_to_asn1obj(ossl_asn1_get_value(self));
str = rb_protect(asn1obj_get_oid_i, (VALUE)a1obj, &state);
ASN1_OBJECT_free(a1obj);
if (state)
rb_jump_tag(state);
return str;
}
|
#sn ⇒ String #short_name ⇒ String Also known as: short_name
The short name of the ObjectId, as defined in <openssl/objects.h>.
1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 |
# File 'ossl_asn1.c', line 1255
static VALUE
ossl_asn1obj_get_sn(VALUE self)
{
VALUE val, ret = Qnil;
int nid;
val = ossl_asn1_get_value(self);
if ((nid = OBJ_txt2nid(StringValueCStr(val))) != NID_undef)
ret = rb_str_new2(OBJ_nid2sn(nid));
return ret;
}
|