123456789_123456789_123456789_123456789_123456789_

Class: OpenSSL::Engine

Relationships & Source Files
Namespace Children
Exceptions:
Inherits: Object
Defined in: ext/openssl/ossl_engine.c,
ext/openssl/ossl_engine.c

Overview

This class is the access to openssl's ENGINE cryptographic module implementation.

See also, www.openssl.org/docs/crypto/engine.html

Class Method Summary

Instance Method Summary

Class Method Details

.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 .engines for the currently loaded engines

.cleanup

It is only necessary to run cleanup when engines are loaded via .load. However, running cleanup before exit is recommended.

See also, www.openssl.org/docs/crypto/engine.html

.engines

Returns an array of currently loaded engines.

.load(*args)

Instance Method Details

#cipher(name) ⇒ OpenSSL::Cipher

This returns an Cipher by #name, if it is available in this engine.

A EngineError will be raised if the cipher is unavailable.

e = OpenSSL::Engine.by_id("openssl")
 #=> #<OpenSSL::Engine id="openssl" name="Software engine support">
e.cipher("RC4")
 #=> #<OpenSSL::Cipher:0x007fc5cacc3048>

#cmds

Returns an array of command definitions for the current engine

#ctrl_cmd(command, value = nil) ⇒ Engine

Send the given command to this engine.

Raises an Engine::EngineError if the command fails.

#digest(name) ⇒ OpenSSL::Digest

This returns an Digest by #name.

Will raise an Engine::EngineError if the digest is unavailable.

e = OpenSSL::Engine.by_id("openssl")
  #=> #<OpenSSL::Engine id="openssl" name="Software engine support">
e.digest("SHA1")
  #=> #<OpenSSL::Digest: da39a3ee5e6b4b0d3255bfef95601890afd80709>
e.digest("zomg")
  #=> OpenSSL::Engine::EngineError: no such digest `zomg'

#finish

Releases all internal structural references for this engine.

May raise an Engine::EngineError if the engine is unavailable

#id

Get the id for this engine

OpenSSL::Engine.load
OpenSSL::Engine.engines #=> [#<OpenSSL::Engine#>, ...]
OpenSSL::Engine.engines.first.id
  #=> "rsax"

#inspect

Pretty print this engine

#load_private_key(id = nil, data = nil) ⇒ OpenSSL::PKey

Loads the given private key by #id and data.

An EngineError is raised of the PKey is unavailable.

#load_public_key(id = nil, data = nil) ⇒ OpenSSL::PKey

Loads the given private key by #id and data.

An EngineError is raised of the PKey is unavailable.

#name

Get the descriptive name for this engine

OpenSSL::Engine.load
OpenSSL::Engine.engines #=> [#<OpenSSL::Engine#>, ...]
OpenSSL::Engine.engines.first.name
  #=> "RSAX engine support"

#set_default(flag)

Set the defaults for this engine with the given flag.

These flags are used to control combinations of algorithm methods.

flag can be one of the following, other flags are available depending on your OS.

All flags

0xFFFF

No flags

0x0000

See also <openssl/engine.h>