Module: OpenSSLPKeyED

Defined in:
lib/open_ssl_pkey_ed.rb

Class Method Summary collapse

Class Method Details

.to_der(key) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/open_ssl_pkey_ed.rb', line 4

def self.to_der(key)
  case key
  when OpenSSL::PKey::EC::Point # EC public key
    asn1(key).to_der
  when OpenSSL::PKey::EC, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, OpenSSL::PKey::DH
    key.to_der
  end
end

.to_pem(key) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/open_ssl_pkey_ed.rb', line 13

def self.to_pem(key)
  case key
  when OpenSSL::PKey::EC::Point # EC public key
    raise "not supported OpenSSL::PKey::EC's public key yet", NotImplementedError
  when OpenSSL::PKey::EC, OpenSSL::PKey::RSA, OpenSSL::PKey::DSA, OpenSSL::PKey::DH
    key.to_pem
  end
end