Module: JOSE::JWK::OpenSSHKey

Extended by:
OpenSSHKey
Included in:
OpenSSHKey
Defined in:
lib/jose/jwk/openssh_key.rb

Instance Method Summary collapse

Instance Method Details

#from_binary(binary, password = nil) ⇒ Object


5
6
7
# File 'lib/jose/jwk/openssh_key.rb', line 5

def from_binary(binary, password = nil)
  return parse_keys(StringIO.new(binary))
end

#to_binary(list, password = nil) ⇒ Object


9
10
11
12
13
14
15
16
17
# File 'lib/jose/jwk/openssh_key.rb', line 9

def to_binary(list, password = nil)
  return list.flat_map do |key_list|
    next [
      "-----BEGIN OPENSSH PRIVATE KEY-----\n",
      chunk(Base64.encode64(write_keylist(*key_list.transpose)), 70),
      "-----END OPENSSH PRIVATE KEY-----\n"
    ]
  end.join
end