Object
static VALUE
ossl_x509revoked_add_extension(VALUE self, VALUE ext)
{
X509_REVOKED *rev;
GetX509Rev(self, rev);
if(!X509_REVOKED_add_ext(rev, DupX509ExtPtr(ext), -1)) {
ossl_raise(eX509RevError, NULL);
}
return ext;
}
Gets X509v3 extensions as array of X509Ext objects
static VALUE
ossl_x509revoked_get_extensions(VALUE self)
{
X509_REVOKED *rev;
int count, i;
X509_EXTENSION *ext;
VALUE ary;
GetX509Rev(self, rev);
count = X509_REVOKED_get_ext_count(rev);
if (count < 0) {
OSSL_Debug("count < 0???");
return rb_ary_new();
}
ary = rb_ary_new2(count);
for (i=0; i<count; i++) {
ext = X509_REVOKED_get_ext(rev, i);
rb_ary_push(ary, ossl_x509ext_new(ext));
}
return ary;
}
Sets X509_EXTENSIONs
static VALUE
ossl_x509revoked_set_extensions(VALUE self, VALUE ary)
{
X509_REVOKED *rev;
X509_EXTENSION *ext;
int i;
VALUE item;
Check_Type(ary, T_ARRAY);
for (i=0; i<RARRAY_LEN(ary); i++) {
OSSL_Check_Kind(RARRAY_PTR(ary)[i], cX509Ext);
}
GetX509Rev(self, rev);
sk_X509_EXTENSION_pop_free(rev->extensions, X509_EXTENSION_free);
rev->extensions = NULL;
for (i=0; i<RARRAY_LEN(ary); i++) {
item = RARRAY_PTR(ary)[i];
ext = DupX509ExtPtr(item);
if(!X509_REVOKED_add_ext(rev, ext, -1)) {
ossl_raise(eX509RevError, NULL);
}
}
return ary;
}
static VALUE
ossl_x509revoked_get_serial(VALUE self)
{
X509_REVOKED *rev;
GetX509Rev(self, rev);
return asn1integer_to_num(rev->serialNumber);
}
static VALUE
ossl_x509revoked_set_serial(VALUE self, VALUE num)
{
X509_REVOKED *rev;
GetX509Rev(self, rev);
rev->serialNumber = num_to_asn1integer(num, rev->serialNumber);
return num;
}
Commenting is here to help enhance the documentation. For example, sample code, or clarification of the documentation.
If you are posting code samples in your comments, please wrap them in "<pre><code class="ruby" > ... </code></pre>" markup in order to get syntax highlighting.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file a bug report so that it can be corrected for the next release. Thank you.