Class: S7n::Key
- Inherits:
-
Object
- Object
- S7n::Key
- Defined in:
- lib/s7n/key.rb
Overview
暗号化用のキーを表現する。
Constant Summary collapse
- @@key_classes =
{}
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(passphrase) ⇒ Key
constructor
A new instance of Key.
Constructor Details
#initialize(passphrase) ⇒ Key
Returns a new instance of Key.
29 30 31 32 |
# File 'lib/s7n/key.rb', line 29 def initialize(passphrase) @key = OpenSSL::Digest.digest(hash_type, passphrase) @length = @key.length end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
26 27 28 |
# File 'lib/s7n/key.rb', line 26 def key @key end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
27 28 29 |
# File 'lib/s7n/key.rb', line 27 def length @length end |
Class Method Details
.create_instance(type, passphrase) ⇒ Object
11 12 13 |
# File 'lib/s7n/key.rb', line 11 def create_instance(type, passphrase) return @@key_classes[type].new(passphrase) end |