Method: Tem::OpenSSL::Key.load_from_tkfile

Defined in:
lib/openssl/key.rb

.load_from_tkfile(file) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/openssl/key.rb', line 44

def self.load_from_tkfile(file)
  ossl_pub_key = OpenSSL::PKey::RSA.new file
  pub_key = Tem::Key.new_from_ssl_key ossl_pub_key
  begin
    ds_ary, es_ary, ss_ary = *YAML.load(file)
    priv_decrypt_sec = Tem::SecPack.new_from_array ds_ary
    priv_encrypt_sec = Tem::SecPack.new_from_array es_ary      
    priv_sign_sec = Tem::SecPack.new_from_array ss_ary
  rescue
    priv_decrypt_sec = nil
    priv_encrypt_sec = nil
    priv_sign_sec = nil
  end
  self.new pub_key, priv_decrypt_sec, priv_encrypt_sec, priv_sign_sec
end