-def deploy_dns01_challenge_token( domain, token, nameserver, config )
+def read_cert_key( domain )
+ folder = "./certs/#{domain}/"
+ path = folder + "current.key"
+ p "Reading cert key from #{path}"
+ if File.readable?( path )
+ p "File #{path} is readable, trying to parse"
+ privatekey_string = File.read( path )
+ private_key = OpenSSL::PKey::EC.new( privatekey_string )
+ else
+ if File.exists?( path )
+ raise( "The file #{path} exists but is not readable. Make it readable or specify different path" )
+ else
+ p "File #{path} does not exist, trying to create"
+ private_key = OpenSSL::PKey::EC.generate( "prime256v1" )
+ pkey_file = File.new( folder + Time.now.to_i.to_s + ".key", 'w' )
+ pkey_file.write( private_key.private_to_pem )
+ File.symlink( File.basename( pkey_file ), File.dirname( pkey_file ) + "/current.key" )
+ end
+ end
+ return private_key
+end
+
+def deploy_dns01_challenge_token( domain, challenge, nameserver, config )