method
value=
v2_5_5 -
Show latest stable
-
0 notes -
Class: Attribute
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378 (0)
- 1_9_2_180 (0)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (0)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (0)
- 2_6_3 (0)
- What's this?
value=(p1)
public
Hide source
static VALUE ossl_x509attr_set_value(VALUE self, VALUE value) { X509_ATTRIBUTE *attr; VALUE asn1_value; int i, asn1_tag; OSSL_Check_Kind(value, cASN1Data); asn1_tag = NUM2INT(rb_attr_get(value, rb_intern("@tag"))); asn1_value = rb_attr_get(value, rb_intern("@value")); if (asn1_tag != V_ASN1_SET) ossl_raise(eASN1Error, "argument must be ASN1::Set"); if (!RB_TYPE_P(asn1_value, T_ARRAY)) ossl_raise(eASN1Error, "ASN1::Set has non-array value"); GetX509Attr(self, attr); if (X509_ATTRIBUTE_count(attr)) { /* populated, reset first */ ASN1_OBJECT *obj = X509_ATTRIBUTE_get0_object(attr); X509_ATTRIBUTE *new_attr = X509_ATTRIBUTE_create_by_OBJ(NULL, obj, 0, NULL, -1); if (!new_attr) ossl_raise(eX509AttrError, NULL); SetX509Attr(self, new_attr); X509_ATTRIBUTE_free(attr); attr = new_attr; } for (i = 0; i < RARRAY_LEN(asn1_value); i++) { ASN1_TYPE *a1type = ossl_asn1_get_asn1type(RARRAY_AREF(asn1_value, i)); if (!X509_ATTRIBUTE_set1_data(attr, ASN1_TYPE_get(a1type), a1type->value.ptr, -1)) { ASN1_TYPE_free(a1type); ossl_raise(eX509AttrError, NULL); } ASN1_TYPE_free(a1type); } return value; }