Class: OpenSSL::ASN1::ObjectId
- Defined in:
- ossl_asn1.c,
ossl_asn1.c
Overview
Represents the primitive object id for OpenSSL::ASN1
Instance Attribute Summary
Attributes included from TaggedASN1Data
Attributes inherited from ASN1Data
#indefinite_length, #tag, #tag_class, #value
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 included from TaggedASN1Data
Methods inherited from ASN1Data
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.
1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 |
# File 'ossl_asn1.c', line 1117 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.
1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 |
# File 'ossl_asn1.c', line 1220 static VALUE ossl_asn1obj_eq(VALUE self, VALUE other) { VALUE oid1, oid2; if (!rb_obj_is_kind_of(other, cASN1ObjectId)) return Qfalse; oid1 = ossl_asn1obj_get_oid(self); oid2 = ossl_asn1obj_get_oid(other); return rb_str_equal(oid1, oid2); } |
#ln ⇒ String #long_name ⇒ String Also known as: long_name
The long name of the ObjectId, as defined in <openssl/objects.h>.
1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 |
# File 'ossl_asn1.c', line 1157 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”
1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 |
# File 'ossl_asn1.c', line 1199 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>.
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 |
# File 'ossl_asn1.c', line 1137 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; } |