Class: OpenSSL::SignatureAlgorithm::RSA
- Defined in:
- lib/openssl/signature_algorithm/rsa.rb
Defined Under Namespace
Classes: SigningKey, VerifyKey
Constant Summary collapse
- ACCEPTED_HASH_FUNCTIONS =
["SHA256", "SHA384", "SHA512"].freeze
- DEFAULT_KEY_SIZE =
2048
Instance Attribute Summary collapse
-
#hash_function ⇒ Object
readonly
Returns the value of attribute hash_function.
Attributes inherited from Base
Instance Method Summary collapse
- #generate_signing_key(size: DEFAULT_KEY_SIZE) ⇒ Object
-
#initialize(hash_function: self.class::ACCEPTED_HASH_FUNCTIONS.first) ⇒ RSA
constructor
A new instance of RSA.
Methods inherited from Base
#compatible_verify_key?, #sign, #verify
Constructor Details
#initialize(hash_function: self.class::ACCEPTED_HASH_FUNCTIONS.first) ⇒ RSA
Returns a new instance of RSA.
39 40 41 42 43 44 45 |
# File 'lib/openssl/signature_algorithm/rsa.rb', line 39 def initialize(hash_function: self.class::ACCEPTED_HASH_FUNCTIONS.first) if self.class::ACCEPTED_HASH_FUNCTIONS.include?(hash_function) @hash_function = hash_function else raise(OpenSSL::SignatureAlgorithm::UnsupportedParameterError, "Unsupported hash function '#{hash_function}'") end end |
Instance Attribute Details
#hash_function ⇒ Object (readonly)
Returns the value of attribute hash_function.
37 38 39 |
# File 'lib/openssl/signature_algorithm/rsa.rb', line 37 def hash_function @hash_function end |
Instance Method Details
#generate_signing_key(size: DEFAULT_KEY_SIZE) ⇒ Object
47 48 49 |
# File 'lib/openssl/signature_algorithm/rsa.rb', line 47 def generate_signing_key(size: DEFAULT_KEY_SIZE) @signing_key = SigningKey.new(size) end |