Class: Claude::OpenSSLCipherBuilder
- Inherits:
-
Object
- Object
- Claude::OpenSSLCipherBuilder
- Defined in:
- lib/claude/openssl_cipher_builder.rb
Instance Method Summary collapse
- #build(mode) ⇒ Object
-
#initialize(key = nil, iv = nil, ssl_cipher = Claude.ssl_cipher) ⇒ OpenSSLCipherBuilder
constructor
A new instance of OpenSSLCipherBuilder.
Constructor Details
#initialize(key = nil, iv = nil, ssl_cipher = Claude.ssl_cipher) ⇒ OpenSSLCipherBuilder
Returns a new instance of OpenSSLCipherBuilder.
7 8 9 10 11 |
# File 'lib/claude/openssl_cipher_builder.rb', line 7 def initialize(key = nil, iv = nil, ssl_cipher = Claude.ssl_cipher) @key = key && key.to_s @iv = hash_if_too_short(iv) @ssl_cipher = ssl_cipher end |
Instance Method Details
#build(mode) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/claude/openssl_cipher_builder.rb', line 13 def build(mode) OpenSSL::Cipher.new(ssl_cipher).tap do |cipher| cipher.public_send(mode) cipher.key = key if key cipher.iv = iv if iv end end |