Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

class method

OpenSSL::PKey::DSA.new

DSA.new → dsa
DSA.new(size) → dsa
DSA.new(string [, pass]) → dsa

Creates a new DSA instance by reading an existing key from string.

Parameters

  • size is an integer representing the desired key size.

  • string contains a DER or PEM encoded key.

  • pass is a string that contains an optional password.

Examples

DSA.new -> dsa
DSA.new(1024) -> dsa
DSA.new(File.read('dsa.pem')) -> dsa
DSA.new(File.read('dsa.pem'), 'mypassword') -> dsa
See also .generate #export #initialize_copy also in 4.1 · 4.0 · 3.4 · 3.3 · 3.2 · 3.1