Method: OpenSSL::Engine.by_id

Defined in:
ossl_engine.c

.by_id(id) ⇒ Object

call-seq:

by_id(name) -> engine

Fetch the engine as specified by the id String

OpenSSL::Engine.by_id("openssl")
 => #<OpenSSL::Engine id="openssl" name="Software engine support">

See OpenSSL::Engine.engines for the currently loaded engines



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'ossl_engine.c', line 194

static VALUE
ossl_engine_s_by_id(VALUE klass, VALUE id)
{
    ENGINE *e;
    VALUE obj;

    StringValue(id);
    ossl_engine_s_load(1, &id, klass);
    if(!(e = ENGINE_by_id(RSTRING_PTR(id))))
  ossl_raise(eEngineError, NULL);
    WrapEngine(klass, obj, e);
    if(rb_block_given_p()) rb_yield(obj);
    if(!ENGINE_init(e))
  ossl_raise(eEngineError, NULL);
    ENGINE_ctrl(e, ENGINE_CTRL_SET_PASSWORD_CALLBACK,
    0, NULL, (void(*)(void))ossl_pem_passwd_cb);
    ERR_clear_error();

    return obj;
}