lib/legion/crypt/cipher.rb in legion-crypt-0.2.1 vs lib/legion/crypt/cipher.rb in legion-crypt-0.2.2
- old
+ new
@@ -38,10 +38,14 @@
def public_key
@public_key ||= private_key.public_key.to_s
end
def private_key
- @private_key ||= OpenSSL::PKey::RSA.new 2048
+ @private_key ||= if Legion::Settings[:crypt][:read_private_key] && File.exist?('./legionio.key')
+ OpenSSL::PKey::RSA.new File.read './legionio.key'
+ else
+ OpenSSL::PKey::RSA.new 2048
+ end
end
def cs
@cs ||= Digest::SHA256.digest fetch_cs
end