Method: OpenSSL::OCSP::BasicResponse#add_nonce

Defined in:
ossl_ocsp.c

#add_nonce(nonce = nil) ⇒ Object

Adds nonce to this response. If no nonce was provided a random nonce will be added.



752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
# File 'ossl_ocsp.c', line 752

static VALUE
ossl_ocspbres_add_nonce(int argc, VALUE *argv, VALUE self)
{
    OCSP_BASICRESP *bs;
    VALUE val;
    int ret;

    rb_scan_args(argc, argv, "01", &val);
    if(NIL_P(val)) {
  GetOCSPBasicRes(self, bs);
  ret = OCSP_basic_add1_nonce(bs, NULL, -1);
    }
    else{
  StringValue(val);
  GetOCSPBasicRes(self, bs);
  ret = OCSP_basic_add1_nonce(bs, (unsigned char *)RSTRING_PTR(val), RSTRING_LENINT(val));
    }
    if(!ret) ossl_raise(eOCSPError, NULL);

    return self;
}