Method: OpenSSL::Timestamp::Request#algorithm=

Defined in:
ossl_ts.c

#algorithm=(algo) ⇒ Object

Allows to set the object identifier or the ‘short name’ of the algorithm that was used to create the message imprint digest.

Example:

    request.algorithm = "SHA1"

call-seq:
     request.algorithm = "string"    -> string


253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
# File 'ossl_ts.c', line 253

static VALUE
ossl_ts_req_set_algorithm(VALUE self, VALUE algo)
{
    TS_REQ *req;
    TS_MSG_IMPRINT *mi;
    ASN1_OBJECT *obj;
    X509_ALGOR *algor;

    GetTSRequest(self, req);
    obj = obj_to_asn1obj(algo);
    mi = TS_REQ_get_msg_imprint(req);
    algor = TS_MSG_IMPRINT_get_algo(mi);
    if (!X509_ALGOR_set0(algor, obj, V_ASN1_NULL, NULL)) {
        ASN1_OBJECT_free(obj);
        ossl_raise(eTimestampError, "X509_ALGOR_set0");
    }

    return algo;
}