class OpenSSL::Engine
This class is the access to opensslโs ENGINE cryptographic module implementation.
See also, www.openssl.org/docs/crypto/engine.html
Constants
- METHOD_ALL
- METHOD_CIPHERS
- METHOD_DH
- METHOD_DIGESTS
- METHOD_DSA
- METHOD_NONE
- METHOD_RAND
- METHOD_RSA
Public Class Methods
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3466
def self.by_id: (String name) -> instance
Fetches 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.
() → void
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3477
def self.cleanup: () -> void
It is only necessary to run cleanup when engines are loaded via OpenSSL::Engine.load. However, running cleanup before exit is recommended.
Note that this is needed and works only in OpenSSL < 1.1.0.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3485
def self.engines: () -> Array[instance]
Returns an array of currently loaded engines.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3495
def self.load: (?String name) -> (true | nil)
This method loads engines. If name is nil, then all builtin engines are loaded. Otherwise, the given name, as a String, is loaded if available to your runtime, and returns true. If name is not found, then nil is returned.
Public Instance Methods
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3511
def cipher: (String cipher) -> Cipher
Returns a new instance of OpenSSL::Cipher by name, if it is available in this engine.
An 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>
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3519
def cmds: () -> Array[[ String, String, String ]]
Returns an array of command definitions for the current engine
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3529
def ctrl_cmd: (String cmd, ?String value) -> self
Sends the given command to this engine.
Raises an EngineError if the command fails.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3546
def digest: (String digest) -> Digest
Returns a new instance of OpenSSL::Digest by name.
Will raise an 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'
() → nil
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3556
def finish: () -> nil
Releases all internal structural references for this engine.
May raise an EngineError if the engine is unavailable
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3569
def id: () -> String
Gets the id for this engine.
OpenSSL::Engine.load OpenSSL::Engine.engines #=> [#<OpenSSL::Engine#>, ...] OpenSSL::Engine.engines.first.id #=> "rsax"
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3577
def inspect: () -> String
Pretty prints this engine.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3587
def load_private_key: (?String id, ?String data) -> PKey::PKey
Loads the given private key identified by id and data.
An EngineError is raised of the OpenSSL::PKey is unavailable.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3597
def load_public_key: (?String id, ?String data) -> PKey::PKey
Loads the given public key identified by id and data.
An EngineError is raised of the OpenSSL::PKey is unavailable.
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3610
def name: () -> String
Get the descriptive name for this engine.
OpenSSL::Engine.load OpenSSL::Engine.engines #=> [#<OpenSSL::Engine#>, ...] OpenSSL::Engine.engines.first.name #=> "RSAX engine support"
(Integer flag) → bool
Source
# File vendor/bundle/ruby/4.0.0/gems/rbs-4.0.3/stdlib/openssl/0/openssl.rbs, line 3632
def set_default: (Integer flag) -> bool
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>